From 0619ced59bfa68d03d395bb54c5b0278f4b48498 Mon Sep 17 00:00:00 2001 From: levasseur Date: Wed, 8 Sep 2021 16:53:52 +0200 Subject: [PATCH] reworked mk_archive.sh, few ajustment --- init.sh | 4 ++-- lib/filefct.sh | 2 +- mk_archive.sh | 38 +++++++++++++++++++++++++++++++++----- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/init.sh b/init.sh index 61e0c1e..85df625 100755 --- a/init.sh +++ b/init.sh @@ -24,9 +24,9 @@ set -o pipefail set -o errtrace # set -e : exit the script if any statement returns a non-true return value -#set -o errexit +set -o errexit -# set +u : allow undeclared variables +# set +u : allow undeclared variables (configuration files don't need to be complete) set +o nounset # We want english messages diff --git a/lib/filefct.sh b/lib/filefct.sh index 5e41282..22600e8 100644 --- a/lib/filefct.sh +++ b/lib/filefct.sh @@ -87,7 +87,7 @@ installfile() prnt I "Copie des fichiers ${filelist}..." cp -av $filelist if [[ $? -ne 0 ]]; then - prnt E "installfile(): Couldn't copy some required files!" && + prnt E "installfile(): Couldn't copy some required files!" die 12 fi } diff --git a/mk_archive.sh b/mk_archive.sh index e5be357..55f66ce 100755 --- a/mk_archive.sh +++ b/mk_archive.sh @@ -1,15 +1,43 @@ #!/bin/bash -# That script is used to create an archive for init deployment +# ------------------------------------------------------------------------------ +# That script is used to create an archive for init.sh deployment +# This file is part of the init.sh project +# Copyright (c) 2019-2021 Geoffray Levasseur +# ------------------------------------------------------------------------------ +# This file is distributed under 3-clause BSD license. +# The complete license agreement can be obtained at: +# https://opensource.org/licenses/BSD-3-Clause +# ------------------------------------------------------------------------------ VERSION=$(grep "VERSION=" init.sh | cut -d'=' -f 2 | sed s/\"//g) TMPDIR="/tmp/init-$VERSION" +CWD=$(pwd) -mkdir $TMPDIR +mkdir -pv $TMPDIR -cp -av conf lib modules repo doc init.sh README.* LICENSE $TMPDIR +echo +echo "***" +echo "*** Copying files..." +echo "***" +cp -av conf doc init.sh lib LICENSE modules README.* repo $TMPDIR -tar --gzip -cvf ~/init.sh-$VERSION.tar.gz $TMPDIR +cd $(dirname $TMPDIR) +echo +echo "***" +echo "*** Creating archive..." +echo "***" +tar --gzip -cvf $CWD/init.sh-$VERSION.tar.gz $(basename $TMPDIR) +cd $CWD +echo +echo "***" +echo "*** Removing temporary files..." +echo "***" rm -rfv $TMPDIR -echo "L'archive ~/init.sh-$VERSION.tar.gz a été créé avec succès dans votre home directory." +echo +echo "***" +echo "*** Done." +echo "***" +echo +echo "Archive init.sh-$VERSION.tar.gz was created succesfully in working directory."