@cryptotaxi247 / netdata-1 / commits / 6050b1fa1

allow kickstart-static64.sh to run non-interactive; fixes #2305

Costa Tsaousis (ktsaou) committed Jun 14, 2017 at 00:19 UTC 6050b1fa1a207a6c13f6ef3af65a042776df2d24
3 files changed +77 -21
kickstart-static64.sh
+7 -1
@@ -212,11 +212,17 @@ fi
212
213 # ---------------------------------------------------------------------------------------------------------------------
214
215 +opts=
216 +if [ "${1}" = "--dont-wait" -o "${1}" = "--non-interactive" ]
217 +then
218 + opts="--accept"
219 +fi
220 +
221 progress "Installing netdata"
222
223 sudo=
224 [ "${UID}" != "0" ] && sudo="sudo"
219 -run ${sudo} sh "/tmp/${LATEST}"
225 +run ${sudo} sh "/tmp/${LATEST}" ${opts}
226
227 if [ $? -eq 0 ]
228 then
makeself/makeself-header.sh
+36 -14
@@ -22,7 +22,9 @@ filesizes="$filesizes"
22 keep="$KEEP"
23 nooverwrite="$NOOVERWRITE"
24 quiet="n"
25 +accept="n"
26 nodiskspace="n"
27 +export_conf="$EXPORT_CONF"
28
29 print_cmd_arg=""
30 if type printf > /dev/null; then
@@ -49,18 +51,20 @@ MS_PrintLicense()
51 {
52 if test x"\$licensetxt" != x; then
53 echo "\$licensetxt"
52 - while true
53 - do
54 - MS_Printf "Please type y to accept, n otherwise: "
55 - read yn
56 - if test x"\$yn" = xn; then
57 - keep=n
58 - eval \$finish; exit 1
59 - break;
60 - elif test x"\$yn" = xy; then
61 - break;
62 - fi
63 - done
54 + if test x"\$accept" != xy; then
55 + while true
56 + do
57 + MS_Printf "Please type y to accept, n otherwise: "
58 + read yn
59 + if test x"\$yn" = xn; then
60 + keep=n
61 + eval \$finish; exit 1
62 + break;
63 + elif test x"\$yn" = xy; then
64 + break;
65 + fi
66 + done
67 + fi
68 fi
69 }
70
@@ -140,6 +144,7 @@ MS_Help()
144 with following options (in that order)
145 --confirm Ask before running embedded script
146 --quiet Do not print anything except error messages
147 + --accept Accept the license
148 --noexec Do not run embedded script
149 --keep Do not erase target directory after running
150 the embedded script
@@ -213,10 +218,10 @@ MS_Check()
218 UnTAR()
219 {
220 if test x"\$quiet" = xn; then
216 - tar \$1vf - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; }
221 + tar \$1 "$UNTAR_EXTRA" -vf - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; }
222 else
223
219 - tar \$1f - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; }
224 + tar \$1 "$UNTAR_EXTRA" -f - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; }
225 fi
226 }
227
@@ -242,6 +247,10 @@ do
247 noprogress=y
248 shift
249 ;;
250 + --accept)
251 + accept=y
252 + shift
253 + ;;
254 --info)
255 echo Identification: "\$label"
256 echo Target directory: "\$targetdir"
@@ -511,6 +520,19 @@ fi
520 cd "\$tmpdir"
521 res=0
522 if test x"\$script" != x; then
523 + if test x"\$export_conf" = x"y"; then
524 + MS_BUNDLE="\$0"
525 + MS_LABEL="\$label"
526 + MS_SCRIPT="\$script"
527 + MS_SCRIPTARGS="\$scriptargs"
528 + MS_ARCHDIRNAME="\$archdirname"
529 + MS_KEEP="\$KEEP"
530 + MS_NOOVERWRITE="\$NOOVERWRITE"
531 + MS_COMPRESS="\$COMPRESS"
532 + export MS_BUNDLE MS_LABEL MS_SCRIPT MS_SCRIPTARGS
533 + export MS_ARCHDIRNAME MS_KEEP MS_NOOVERWRITE MS_COMPRESS
534 + fi
535 +
536 if test x"\$verbose" = x"y"; then
537 MS_Printf "OK to execute: \$script \$scriptargs \$* ? [Y/n] "
538 read yn
makeself/makeself.sh
+34 -6
@@ -100,7 +100,7 @@ MS_Usage()
100 echo " --tar-quietly : Suppress verbose output from the tar command"
101 echo " --quiet | -q : Do not print any messages other than errors."
102 echo " --gzip : Compress using gzip (default if detected)"
103 - echo " --pigz : Compress with pigz"
103 + echo " --pigz : Compress with pigz"
104 echo " --bzip2 : Compress using bzip2 instead of gzip"
105 echo " --pbzip2 : Compress using pbzip2 instead of gzip"
106 echo " --xz : Compress using xz instead of gzip"
@@ -110,6 +110,9 @@ MS_Usage()
110 echo " --complevel lvl : Compression level for gzip pigz xz lzo lz4 bzip2 and pbzip2 (default 9)"
111 echo " --base64 : Instead of compressing, encode the data using base64"
112 echo " --gpg-encrypt : Instead of compressing, encrypt the data using GPG"
113 + echo " --gpg-asymmetric-encrypt-sign"
114 + echo " : Instead of compressing, asymmetrically encrypt and sign the data using GPG"
115 + echo " --gpg-extra opt : Append more options to the gpg command line"
116 echo " --ssl-encrypt : Instead of compressing, encrypt the data using OpenSSL"
117 echo " --nocomp : Do not compress the data"
118 echo " --notemp : The archive will create archive_dir in the"
@@ -125,6 +128,7 @@ MS_Usage()
128 echo " --current : Files will be extracted to the current directory"
129 echo " Both --current and --target imply --notemp"
130 echo " --tar-extra opt : Append more options to the tar command line"
131 + echo " --untar-extra opt : Append more options to the during the extraction of the tar archive"
132 echo " --nomd5 : Don't calculate an MD5 for archive"
133 echo " --nocrc : Don't calculate a CRC for archive"
134 echo " --header file : Specify location of the header script"
@@ -141,6 +145,7 @@ MS_Usage()
145 echo " instead of the current date."
146 echo
147 echo " --keep-umask : Keep the umask set to shell default, rather than overriding when executing self-extracting archive."
148 + echo " --export-conf : Export configuration variables to startup_script"
149 echo
150 echo "Do not forget to give a fully qualified startup script name"
151 echo "(i.e. with a ./ prefix if inside the archive)."
@@ -167,11 +172,13 @@ COPY=none
172 NEED_ROOT=n
173 TAR_ARGS=cvf
174 TAR_EXTRA=""
175 +GPG_EXTRA=""
176 DU_ARGS=-ks
177 HEADER=`dirname "$0"`/makeself-header.sh
178 TARGETDIR=""
179 NOOVERWRITE=n
180 DATE=`LC_ALL=C date`
181 +EXPORT_CONF=n
182
183 # LSM file stuff
184 LSM_CMD="echo No LSM. >> \"\$archname\""
@@ -223,10 +230,18 @@ do
230 COMPRESS=gpg
231 shift
232 ;;
233 + --gpg-asymmetric-encrypt-sign)
234 + COMPRESS=gpg-asymmetric
235 + shift
236 + ;;
237 + --gpg-extra)
238 + GPG_EXTRA="$2"
239 + if ! shift 2; then MS_Help; exit 1; fi
240 + ;;
241 --ssl-encrypt)
227 - COMPRESS=openssl
228 - shift
229 - ;;
242 + COMPRESS=openssl
243 + shift
244 + ;;
245 --nocomp)
246 COMPRESS=none
247 shift
@@ -252,6 +267,10 @@ do
267 TAR_EXTRA="$2"
268 if ! shift 2; then MS_Help; exit 1; fi
269 ;;
270 + --untar-extra)
271 + UNTAR_EXTRA="$2"
272 + if ! shift 2; then MS_Help; exit 1; fi
273 + ;;
274 --target)
275 TARGETDIR="$2"
276 KEEP=y
@@ -324,6 +343,10 @@ do
343 KEEP_UMASK=y
344 shift
345 ;;
346 + --export-conf)
347 + EXPORT_CONF=y
348 + shift
349 + ;;
350 -q | --quiet)
351 QUIET=y
352 shift
@@ -439,9 +462,13 @@ base64)
462 GUNZIP_CMD="base64 -d -i"
463 ;;
464 gpg)
442 - GZIP_CMD="gpg -ac -z$COMPRESS_LEVEL"
465 + GZIP_CMD="gpg $GPG_EXTRA -ac -z$COMPRESS_LEVEL"
466 GUNZIP_CMD="gpg -d"
467 ;;
468 +gpg-asymmetric)
469 + GZIP_CMD="gpg $GPG_EXTRA -z$COMPRESS_LEVEL -es"
470 + GUNZIP_CMD="gpg --yes -d"
471 + ;;
472 openssl)
473 GZIP_CMD="openssl aes-256-cbc -a -salt"
474 GUNZIP_CMD="openssl aes-256-cbc -d -a"
@@ -502,7 +529,7 @@ if test "$QUIET" = "n";then
529 echo Adding files to archive named \"$archname\"...
530 fi
531 exec 3<> "$tmpfile"
505 -(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; }
532 +(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; }
533 exec 3>&- # try to close the archive
534
535 fsize=`cat "$tmpfile" | wc -c | tr -d " "`
@@ -590,3 +617,4 @@ else
617 fi
618 fi
619 rm -f "$tmpfile"
620 +