diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-06-14 00:19:13 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-06-14 00:19:13 +0300 |
commit | 6050b1fa1a207a6c13f6ef3af65a042776df2d24 (patch) | |
tree | 8e0625ff34dc5acd6104fe92ac93c30d8043a261 /makeself | |
parent | 97496624ed386392b1e2e6a5f2d971449057b4e7 (diff) |
allow kickstart-static64.sh to run non-interactive; fixes #2305
Diffstat (limited to 'makeself')
-rwxr-xr-x | makeself/makeself-header.sh | 50 | ||||
-rwxr-xr-x | makeself/makeself.sh | 40 |
2 files changed, 70 insertions, 20 deletions
diff --git a/makeself/makeself-header.sh b/makeself/makeself-header.sh index 1d1c3c6a0b..93d937b378 100755 --- a/makeself/makeself-header.sh +++ b/makeself/makeself-header.sh @@ -22,7 +22,9 @@ filesizes="$filesizes" keep="$KEEP" nooverwrite="$NOOVERWRITE" quiet="n" +accept="n" nodiskspace="n" +export_conf="$EXPORT_CONF" print_cmd_arg="" if type printf > /dev/null; then @@ -49,18 +51,20 @@ MS_PrintLicense() { if test x"\$licensetxt" != x; then echo "\$licensetxt" - while true - do - MS_Printf "Please type y to accept, n otherwise: " - read yn - if test x"\$yn" = xn; then - keep=n - eval \$finish; exit 1 - break; - elif test x"\$yn" = xy; then - break; - fi - done + if test x"\$accept" != xy; then + while true + do + MS_Printf "Please type y to accept, n otherwise: " + read yn + if test x"\$yn" = xn; then + keep=n + eval \$finish; exit 1 + break; + elif test x"\$yn" = xy; then + break; + fi + done + fi fi } @@ -140,6 +144,7 @@ MS_Help() with following options (in that order) --confirm Ask before running embedded script --quiet Do not print anything except error messages + --accept Accept the license --noexec Do not run embedded script --keep Do not erase target directory after running the embedded script @@ -213,10 +218,10 @@ MS_Check() UnTAR() { if test x"\$quiet" = xn; then - tar \$1vf - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; } + tar \$1 "$UNTAR_EXTRA" -vf - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; } else - tar \$1f - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; } + tar \$1 "$UNTAR_EXTRA" -f - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; } fi } @@ -242,6 +247,10 @@ do noprogress=y shift ;; + --accept) + accept=y + shift + ;; --info) echo Identification: "\$label" echo Target directory: "\$targetdir" @@ -511,6 +520,19 @@ fi cd "\$tmpdir" res=0 if test x"\$script" != x; then + if test x"\$export_conf" = x"y"; then + MS_BUNDLE="\$0" + MS_LABEL="\$label" + MS_SCRIPT="\$script" + MS_SCRIPTARGS="\$scriptargs" + MS_ARCHDIRNAME="\$archdirname" + MS_KEEP="\$KEEP" + MS_NOOVERWRITE="\$NOOVERWRITE" + MS_COMPRESS="\$COMPRESS" + export MS_BUNDLE MS_LABEL MS_SCRIPT MS_SCRIPTARGS + export MS_ARCHDIRNAME MS_KEEP MS_NOOVERWRITE MS_COMPRESS + fi + if test x"\$verbose" = x"y"; then MS_Printf "OK to execute: \$script \$scriptargs \$* ? [Y/n] " read yn diff --git a/makeself/makeself.sh b/makeself/makeself.sh index 7a7dea0920..709473aabe 100755 --- a/makeself/makeself.sh +++ b/makeself/makeself.sh @@ -100,7 +100,7 @@ MS_Usage() echo " --tar-quietly : Suppress verbose output from the tar command" echo " --quiet | -q : Do not print any messages other than errors." echo " --gzip : Compress using gzip (default if detected)" - echo " --pigz : Compress with pigz" + echo " --pigz : Compress with pigz" echo " --bzip2 : Compress using bzip2 instead of gzip" echo " --pbzip2 : Compress using pbzip2 instead of gzip" echo " --xz : Compress using xz instead of gzip" @@ -110,6 +110,9 @@ MS_Usage() echo " --complevel lvl : Compression level for gzip pigz xz lzo lz4 bzip2 and pbzip2 (default 9)" echo " --base64 : Instead of compressing, encode the data using base64" echo " --gpg-encrypt : Instead of compressing, encrypt the data using GPG" + echo " --gpg-asymmetric-encrypt-sign" + echo " : Instead of compressing, asymmetrically encrypt and sign the data using GPG" + echo " --gpg-extra opt : Append more options to the gpg command line" echo " --ssl-encrypt : Instead of compressing, encrypt the data using OpenSSL" echo " --nocomp : Do not compress the data" echo " --notemp : The archive will create archive_dir in the" @@ -125,6 +128,7 @@ MS_Usage() echo " --current : Files will be extracted to the current directory" echo " Both --current and --target imply --notemp" echo " --tar-extra opt : Append more options to the tar command line" + echo " --untar-extra opt : Append more options to the during the extraction of the tar archive" echo " --nomd5 : Don't calculate an MD5 for archive" echo " --nocrc : Don't calculate a CRC for archive" echo " --header file : Specify location of the header script" @@ -141,6 +145,7 @@ MS_Usage() echo " instead of the current date." echo echo " --keep-umask : Keep the umask set to shell default, rather than overriding when executing self-extracting archive." + echo " --export-conf : Export configuration variables to startup_script" echo echo "Do not forget to give a fully qualified startup script name" echo "(i.e. with a ./ prefix if inside the archive)." @@ -167,11 +172,13 @@ COPY=none NEED_ROOT=n TAR_ARGS=cvf TAR_EXTRA="" +GPG_EXTRA="" DU_ARGS=-ks HEADER=`dirname "$0"`/makeself-header.sh TARGETDIR="" NOOVERWRITE=n DATE=`LC_ALL=C date` +EXPORT_CONF=n # LSM file stuff LSM_CMD="echo No LSM. >> \"\$archname\"" @@ -223,10 +230,18 @@ do COMPRESS=gpg shift ;; + --gpg-asymmetric-encrypt-sign) + COMPRESS=gpg-asymmetric + shift + ;; + --gpg-extra) + GPG_EXTRA="$2" + if ! shift 2; then MS_Help; exit 1; fi + ;; --ssl-encrypt) - COMPRESS=openssl - shift - ;; + COMPRESS=openssl + shift + ;; --nocomp) COMPRESS=none shift @@ -252,6 +267,10 @@ do TAR_EXTRA="$2" if ! shift 2; then MS_Help; exit 1; fi ;; + --untar-extra) + UNTAR_EXTRA="$2" + if ! shift 2; then MS_Help; exit 1; fi + ;; --target) TARGETDIR="$2" KEEP=y @@ -324,6 +343,10 @@ do KEEP_UMASK=y shift ;; + --export-conf) + EXPORT_CONF=y + shift + ;; -q | --quiet) QUIET=y shift @@ -439,9 +462,13 @@ base64) GUNZIP_CMD="base64 -d -i" ;; gpg) - GZIP_CMD="gpg -ac -z$COMPRESS_LEVEL" + GZIP_CMD="gpg $GPG_EXTRA -ac -z$COMPRESS_LEVEL" GUNZIP_CMD="gpg -d" ;; +gpg-asymmetric) + GZIP_CMD="gpg $GPG_EXTRA -z$COMPRESS_LEVEL -es" + GUNZIP_CMD="gpg --yes -d" + ;; openssl) GZIP_CMD="openssl aes-256-cbc -a -salt" GUNZIP_CMD="openssl aes-256-cbc -d -a" @@ -502,7 +529,7 @@ if test "$QUIET" = "n";then echo Adding files to archive named \"$archname\"... fi exec 3<> "$tmpfile" -(cd "$archdir" && ( tar $TAR_EXTRA -$TAR_ARGS - . | eval "$GZIP_CMD" >&3 ) ) || { echo Aborting: Archive directory not found or temporary file: "$tmpfile" could not be created.; exec 3>&-; rm -f "$tmpfile"; exit 1; } +(cd "$archdir" && ( tar "$TAR_EXTRA" -$TAR_ARGS - . | eval "$GZIP_CMD" >&3 ) ) || { echo Aborting: Archive directory not found or temporary file: "$tmpfile" could not be created.; exec 3>&-; rm -f "$tmpfile"; exit 1; } exec 3>&- # try to close the archive fsize=`cat "$tmpfile" | wc -c | tr -d " "` @@ -590,3 +617,4 @@ else fi fi rm -f "$tmpfile" + |