added makeself - untested
Costa Tsaousis (ktsaou) committed
Mar 28, 2017 at 03:04 UTC
0567a9ba4cc74f0c8f629859215045eb2203b8e5
6 files changed
+1172
makeself/jobs/99-makeself.install.sh
new
+18
@@ -0,0 +1,18 @@
1
+#!/usr/bin/env bash
2
+
3
+. ${NETDATA_MAKESELF_PATH}/functions.sh "${@}" || exit 1
4
+
5
+"${NETDATA_MAKESELF_PATH}/makeself.sh" \
6
+ --gzip \
7
+ --notemp \
8
+ --header "${NETDATA_MAKESELF_PATH}/makeself-header.sh" \
9
+ --lsm "${NETDATA_MAKESELF_PATH}/makeself.lsm" \
10
+ --license "${NETDATA_MAKESELF_PATH}/makeself-license.txt" \
11
+ --help-header "${NETDATA_MAKESELF_PATH}/makeself-help-header.txt" \
12
+ "${NETDATA_INSTALL_PATH}" \
13
+ "${NETDATA_INSTALL_PATH}.gz.run" \
14
+ "LABEL: netdata, real-time performance monitoring" \
15
+ ./system/install-or-update.sh \
16
+ ${NULL}
17
+
18
+
makeself/makeself-header.sh
new
+532
@@ -0,0 +1,532 @@
1
+cat << EOF > "$archname"
2
+#!/bin/sh
3
+# This script was generated using Makeself $MS_VERSION
4
+
5
+ORIG_UMASK=\`umask\`
6
+if test "$KEEP_UMASK" = n; then
7
+ umask 077
8
+fi
9
+
10
+CRCsum="$CRCsum"
11
+MD5="$MD5sum"
12
+TMPROOT=\${TMPDIR:=/tmp}
13
+USER_PWD="\$PWD"; export USER_PWD
14
+
15
+label="$LABEL"
16
+script="$SCRIPT"
17
+scriptargs="$SCRIPTARGS"
18
+licensetxt="$LICENSE"
19
+helpheader='$HELPHEADER'
20
+targetdir="$archdirname"
21
+filesizes="$filesizes"
22
+keep="$KEEP"
23
+nooverwrite="$NOOVERWRITE"
24
+quiet="n"
25
+nodiskspace="n"
26
+
27
+print_cmd_arg=""
28
+if type printf > /dev/null; then
29
+ print_cmd="printf"
30
+elif test -x /usr/ucb/echo; then
31
+ print_cmd="/usr/ucb/echo"
32
+else
33
+ print_cmd="echo"
34
+fi
35
+
36
+if test -d /usr/xpg4/bin; then
37
+ PATH=/usr/xpg4/bin:\$PATH
38
+ export PATH
39
+fi
40
+
41
+unset CDPATH
42
+
43
+MS_Printf()
44
+{
45
+ \$print_cmd \$print_cmd_arg "\$1"
46
+}
47
+
48
+MS_PrintLicense()
49
+{
50
+ if test x"\$licensetxt" != x; then
51
+ 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
64
+ fi
65
+}
66
+
67
+MS_diskspace()
68
+{
69
+ (
70
+ df -kP "\$1" | tail -1 | awk '{ if (\$4 ~ /%/) {print \$3} else {print \$4} }'
71
+ )
72
+}
73
+
74
+MS_dd()
75
+{
76
+ blocks=\`expr \$3 / 1024\`
77
+ bytes=\`expr \$3 % 1024\`
78
+ dd if="\$1" ibs=\$2 skip=1 obs=1024 conv=sync 2> /dev/null | \\
79
+ { test \$blocks -gt 0 && dd ibs=1024 obs=1024 count=\$blocks ; \\
80
+ test \$bytes -gt 0 && dd ibs=1 obs=1024 count=\$bytes ; } 2> /dev/null
81
+}
82
+
83
+MS_dd_Progress()
84
+{
85
+ if test x"\$noprogress" = xy; then
86
+ MS_dd \$@
87
+ return \$?
88
+ fi
89
+ file="\$1"
90
+ offset=\$2
91
+ length=\$3
92
+ pos=0
93
+ bsize=4194304
94
+ while test \$bsize -gt \$length; do
95
+ bsize=\`expr \$bsize / 4\`
96
+ done
97
+ blocks=\`expr \$length / \$bsize\`
98
+ bytes=\`expr \$length % \$bsize\`
99
+ (
100
+ dd ibs=\$offset skip=1 2>/dev/null
101
+ pos=\`expr \$pos \+ \$bsize\`
102
+ MS_Printf " 0%% " 1>&2
103
+ if test \$blocks -gt 0; then
104
+ while test \$pos -le \$length; do
105
+ dd bs=\$bsize count=1 2>/dev/null
106
+ pcent=\`expr \$length / 100\`
107
+ pcent=\`expr \$pos / \$pcent\`
108
+ if test \$pcent -lt 100; then
109
+ MS_Printf "\b\b\b\b\b\b\b" 1>&2
110
+ if test \$pcent -lt 10; then
111
+ MS_Printf " \$pcent%% " 1>&2
112
+ else
113
+ MS_Printf " \$pcent%% " 1>&2
114
+ fi
115
+ fi
116
+ pos=\`expr \$pos \+ \$bsize\`
117
+ done
118
+ fi
119
+ if test \$bytes -gt 0; then
120
+ dd bs=\$bytes count=1 2>/dev/null
121
+ fi
122
+ MS_Printf "\b\b\b\b\b\b\b" 1>&2
123
+ MS_Printf " 100%% " 1>&2
124
+ ) < "\$file"
125
+}
126
+
127
+MS_Help()
128
+{
129
+ cat << EOH >&2
130
+\${helpheader}Makeself version $MS_VERSION
131
+ 1) Getting help or info about \$0 :
132
+ \$0 --help Print this message
133
+ \$0 --info Print embedded info : title, default target directory, embedded script ...
134
+ \$0 --lsm Print embedded lsm entry (or no LSM)
135
+ \$0 --list Print the list of files in the archive
136
+ \$0 --check Checks integrity of the archive
137
+
138
+ 2) Running \$0 :
139
+ \$0 [options] [--] [additional arguments to embedded script]
140
+ with following options (in that order)
141
+ --confirm Ask before running embedded script
142
+ --quiet Do not print anything except error messages
143
+ --noexec Do not run embedded script
144
+ --keep Do not erase target directory after running
145
+ the embedded script
146
+ --noprogress Do not show the progress during the decompression
147
+ --nox11 Do not spawn an xterm
148
+ --nochown Do not give the extracted files to the current user
149
+ --nodiskspace Do not check for available disk space
150
+ --target dir Extract directly to a target directory
151
+ directory path can be either absolute or relative
152
+ --tar arg1 [arg2 ...] Access the contents of the archive through the tar command
153
+ -- Following arguments will be passed to the embedded script
154
+EOH
155
+}
156
+
157
+MS_Check()
158
+{
159
+ OLD_PATH="\$PATH"
160
+ PATH=\${GUESS_MD5_PATH:-"\$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"}
161
+ MD5_ARG=""
162
+ MD5_PATH=\`exec <&- 2>&-; which md5sum || command -v md5sum || type md5sum\`
163
+ test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which md5 || command -v md5 || type md5\`
164
+ test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which digest || command -v digest || type digest\`
165
+ PATH="\$OLD_PATH"
166
+
167
+ if test x"\$quiet" = xn; then
168
+ MS_Printf "Verifying archive integrity..."
169
+ fi
170
+ offset=\`head -n $SKIP "\$1" | wc -c | tr -d " "\`
171
+ verb=\$2
172
+ i=1
173
+ for s in \$filesizes
174
+ do
175
+ crc=\`echo \$CRCsum | cut -d" " -f\$i\`
176
+ if test -x "\$MD5_PATH"; then
177
+ if test x"\`basename \$MD5_PATH\`" = xdigest; then
178
+ MD5_ARG="-a md5"
179
+ fi
180
+ md5=\`echo \$MD5 | cut -d" " -f\$i\`
181
+ if test x"\$md5" = x00000000000000000000000000000000; then
182
+ test x"\$verb" = xy && echo " \$1 does not contain an embedded MD5 checksum." >&2
183
+ else
184
+ md5sum=\`MS_dd_Progress "\$1" \$offset \$s | eval "\$MD5_PATH \$MD5_ARG" | cut -b-32\`;
185
+ if test x"\$md5sum" != x"\$md5"; then
186
+ echo "Error in MD5 checksums: \$md5sum is different from \$md5" >&2
187
+ exit 2
188
+ else
189
+ test x"\$verb" = xy && MS_Printf " MD5 checksums are OK." >&2
190
+ fi
191
+ crc="0000000000"; verb=n
192
+ fi
193
+ fi
194
+ if test x"\$crc" = x0000000000; then
195
+ test x"\$verb" = xy && echo " \$1 does not contain a CRC checksum." >&2
196
+ else
197
+ sum1=\`MS_dd_Progress "\$1" \$offset \$s | CMD_ENV=xpg4 cksum | awk '{print \$1}'\`
198
+ if test x"\$sum1" = x"\$crc"; then
199
+ test x"\$verb" = xy && MS_Printf " CRC checksums are OK." >&2
200
+ else
201
+ echo "Error in checksums: \$sum1 is different from \$crc" >&2
202
+ exit 2;
203
+ fi
204
+ fi
205
+ i=\`expr \$i + 1\`
206
+ offset=\`expr \$offset + \$s\`
207
+ done
208
+ if test x"\$quiet" = xn; then
209
+ echo " All good."
210
+ fi
211
+}
212
+
213
+UnTAR()
214
+{
215
+ if test x"\$quiet" = xn; then
216
+ tar \$1vf - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; }
217
+ else
218
+
219
+ tar \$1f - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; }
220
+ fi
221
+}
222
+
223
+finish=true
224
+xterm_loop=
225
+noprogress=$NOPROGRESS
226
+nox11=$NOX11
227
+copy=$COPY
228
+ownership=y
229
+verbose=n
230
+
231
+initargs="\$@"
232
+
233
+while true
234
+do
235
+ case "\$1" in
236
+ -h | --help)
237
+ MS_Help
238
+ exit 0
239
+ ;;
240
+ -q | --quiet)
241
+ quiet=y
242
+ noprogress=y
243
+ shift
244
+ ;;
245
+ --info)
246
+ echo Identification: "\$label"
247
+ echo Target directory: "\$targetdir"
248
+ echo Uncompressed size: $USIZE KB
249
+ echo Compression: $COMPRESS
250
+ echo Date of packaging: $DATE
251
+ echo Built with Makeself version $MS_VERSION on $OSTYPE
252
+ echo Build command was: "$MS_COMMAND"
253
+ if test x"\$script" != x; then
254
+ echo Script run after extraction:
255
+ echo " " \$script \$scriptargs
256
+ fi
257
+ if test x"$copy" = xcopy; then
258
+ echo "Archive will copy itself to a temporary location"
259
+ fi
260
+ if test x"$NEED_ROOT" = xy; then
261
+ echo "Root permissions required for extraction"
262
+ fi
263
+ if test x"$KEEP" = xy; then
264
+ echo "directory \$targetdir is permanent"
265
+ else
266
+ echo "\$targetdir will be removed after extraction"
267
+ fi
268
+ exit 0
269
+ ;;
270
+ --dumpconf)
271
+ echo LABEL=\"\$label\"
272
+ echo SCRIPT=\"\$script\"
273
+ echo SCRIPTARGS=\"\$scriptargs\"
274
+ echo archdirname=\"$archdirname\"
275
+ echo KEEP=$KEEP
276
+ echo NOOVERWRITE=$NOOVERWRITE
277
+ echo COMPRESS=$COMPRESS
278
+ echo filesizes=\"\$filesizes\"
279
+ echo CRCsum=\"\$CRCsum\"
280
+ echo MD5sum=\"\$MD5\"
281
+ echo OLDUSIZE=$USIZE
282
+ echo OLDSKIP=`expr $SKIP + 1`
283
+ exit 0
284
+ ;;
285
+ --lsm)
286
+cat << EOLSM
287
+EOF
288
+eval "$LSM_CMD"
289
+cat << EOF >> "$archname"
290
+EOLSM
291
+ exit 0
292
+ ;;
293
+ --list)
294
+ echo Target directory: \$targetdir
295
+ offset=\`head -n $SKIP "\$0" | wc -c | tr -d " "\`
296
+ for s in \$filesizes
297
+ do
298
+ MS_dd "\$0" \$offset \$s | eval "$GUNZIP_CMD" | UnTAR t
299
+ offset=\`expr \$offset + \$s\`
300
+ done
301
+ exit 0
302
+ ;;
303
+ --tar)
304
+ offset=\`head -n $SKIP "\$0" | wc -c | tr -d " "\`
305
+ arg1="\$2"
306
+ if ! shift 2; then MS_Help; exit 1; fi
307
+ for s in \$filesizes
308
+ do
309
+ MS_dd "\$0" \$offset \$s | eval "$GUNZIP_CMD" | tar "\$arg1" - "\$@"
310
+ offset=\`expr \$offset + \$s\`
311
+ done
312
+ exit 0
313
+ ;;
314
+ --check)
315
+ MS_Check "\$0" y
316
+ exit 0
317
+ ;;
318
+ --confirm)
319
+ verbose=y
320
+ shift
321
+ ;;
322
+ --noexec)
323
+ script=""
324
+ shift
325
+ ;;
326
+ --keep)
327
+ keep=y
328
+ shift
329
+ ;;
330
+ --target)
331
+ keep=y
332
+ targetdir=\${2:-.}
333
+ if ! shift 2; then MS_Help; exit 1; fi
334
+ ;;
335
+ --noprogress)
336
+ noprogress=y
337
+ shift
338
+ ;;
339
+ --nox11)
340
+ nox11=y
341
+ shift
342
+ ;;
343
+ --nochown)
344
+ ownership=n
345
+ shift
346
+ ;;
347
+ --nodiskspace)
348
+ nodiskspace=y
349
+ shift
350
+ ;;
351
+ --xwin)
352
+ if test "$NOWAIT" = n; then
353
+ finish="echo Press Return to close this window...; read junk"
354
+ fi
355
+ xterm_loop=1
356
+ shift
357
+ ;;
358
+ --phase2)
359
+ copy=phase2
360
+ shift
361
+ ;;
362
+ --)
363
+ shift
364
+ break ;;
365
+ -*)
366
+ echo Unrecognized flag : "\$1" >&2
367
+ MS_Help
368
+ exit 1
369
+ ;;
370
+ *)
371
+ break ;;
372
+ esac
373
+done
374
+
375
+if test x"\$quiet" = xy -a x"\$verbose" = xy; then
376
+ echo Cannot be verbose and quiet at the same time. >&2
377
+ exit 1
378
+fi
379
+
380
+if test x"$NEED_ROOT" = xy -a \`id -u\` -ne 0; then
381
+ echo "Administrative privileges required for this archive (use su or sudo)" >&2
382
+ exit 1
383
+fi
384
+
385
+if test x"\$copy" \!= xphase2; then
386
+ MS_PrintLicense
387
+fi
388
+
389
+case "\$copy" in
390
+copy)
391
+ tmpdir=\$TMPROOT/makeself.\$RANDOM.\`date +"%y%m%d%H%M%S"\`.\$\$
392
+ mkdir "\$tmpdir" || {
393
+ echo "Could not create temporary directory \$tmpdir" >&2
394
+ exit 1
395
+ }
396
+ SCRIPT_COPY="\$tmpdir/makeself"
397
+ echo "Copying to a temporary location..." >&2
398
+ cp "\$0" "\$SCRIPT_COPY"
399
+ chmod +x "\$SCRIPT_COPY"
400
+ cd "\$TMPROOT"
401
+ exec "\$SCRIPT_COPY" --phase2 -- \$initargs
402
+ ;;
403
+phase2)
404
+ finish="\$finish ; rm -rf \`dirname \$0\`"
405
+ ;;
406
+esac
407
+
408
+if test x"\$nox11" = xn; then
409
+ if tty -s; then # Do we have a terminal?
410
+ :
411
+ else
412
+ if test x"\$DISPLAY" != x -a x"\$xterm_loop" = x; then # No, but do we have X?
413
+ if xset q > /dev/null 2>&1; then # Check for valid DISPLAY variable
414
+ GUESS_XTERMS="xterm gnome-terminal rxvt dtterm eterm Eterm xfce4-terminal lxterminal kvt konsole aterm terminology"
415
+ for a in \$GUESS_XTERMS; do
416
+ if type \$a >/dev/null 2>&1; then
417
+ XTERM=\$a
418
+ break
419
+ fi
420
+ done
421
+ chmod a+x \$0 || echo Please add execution rights on \$0
422
+ if test \`echo "\$0" | cut -c1\` = "/"; then # Spawn a terminal!
423
+ exec \$XTERM -title "\$label" -e "\$0" --xwin "\$initargs"
424
+ else
425
+ exec \$XTERM -title "\$label" -e "./\$0" --xwin "\$initargs"
426
+ fi
427
+ fi
428
+ fi
429
+ fi
430
+fi
431
+
432
+if test x"\$targetdir" = x.; then
433
+ tmpdir="."
434
+else
435
+ if test x"\$keep" = xy; then
436
+ if test x"\$nooverwrite" = xy && test -d "\$targetdir"; then
437
+ echo "Target directory \$targetdir already exists, aborting." >&2
438
+ exit 1
439
+ fi
440
+ if test x"\$quiet" = xn; then
441
+ echo "Creating directory \$targetdir" >&2
442
+ fi
443
+ tmpdir="\$targetdir"
444
+ dashp="-p"
445
+ else
446
+ tmpdir="\$TMPROOT/selfgz\$\$\$RANDOM"
447
+ dashp=""
448
+ fi
449
+ mkdir \$dashp \$tmpdir || {
450
+ echo 'Cannot create target directory' \$tmpdir >&2
451
+ echo 'You should try option --target dir' >&2
452
+ eval \$finish
453
+ exit 1
454
+ }
455
+fi
456
+
457
+location="\`pwd\`"
458
+if test x"\$SETUP_NOCHECK" != x1; then
459
+ MS_Check "\$0"
460
+fi
461
+offset=\`head -n $SKIP "\$0" | wc -c | tr -d " "\`
462
+
463
+if test x"\$verbose" = xy; then
464
+ MS_Printf "About to extract $USIZE KB in \$tmpdir ... Proceed ? [Y/n] "
465
+ read yn
466
+ if test x"\$yn" = xn; then
467
+ eval \$finish; exit 1
468
+ fi
469
+fi
470
+
471
+if test x"\$quiet" = xn; then
472
+ MS_Printf "Uncompressing \$label"
473
+fi
474
+res=3
475
+if test x"\$keep" = xn; then
476
+ trap 'echo Signal caught, cleaning up >&2; cd \$TMPROOT; /bin/rm -rf \$tmpdir; eval \$finish; exit 15' 1 2 3 15
477
+fi
478
+
479
+if test x"\$nodiskspace" = xn; then
480
+ leftspace=\`MS_diskspace \$tmpdir\`
481
+ if test -n "\$leftspace"; then
482
+ if test "\$leftspace" -lt $USIZE; then
483
+ echo
484
+ echo "Not enough space left in "\`dirname \$tmpdir\`" (\$leftspace KB) to decompress \$0 ($USIZE KB)" >&2
485
+ echo "Use --nodiskspace option to skip this check and proceed anyway" >&2
486
+ if test x"\$keep" = xn; then
487
+ echo "Consider setting TMPDIR to a directory with more free space."
488
+ fi
489
+ eval \$finish; exit 1
490
+ fi
491
+ fi
492
+fi
493
+
494
+for s in \$filesizes
495
+do
496
+ if MS_dd_Progress "\$0" \$offset \$s | eval "$GUNZIP_CMD" | ( cd "\$tmpdir"; umask \$ORIG_UMASK ; UnTAR xp ) 1>/dev/null; then
497
+ if test x"\$ownership" = xy; then
498
+ (cd "\$tmpdir"; chown -R \`id -u\` .; chgrp -R \`id -g\` .)
499
+ fi
500
+ else
501
+ echo >&2
502
+ echo "Unable to decompress \$0" >&2
503
+ eval \$finish; exit 1
504
+ fi
505
+ offset=\`expr \$offset + \$s\`
506
+done
507
+if test x"\$quiet" = xn; then
508
+ echo
509
+fi
510
+
511
+cd "\$tmpdir"
512
+res=0
513
+if test x"\$script" != x; then
514
+ if test x"\$verbose" = x"y"; then
515
+ MS_Printf "OK to execute: \$script \$scriptargs \$* ? [Y/n] "
516
+ read yn
517
+ if test x"\$yn" = x -o x"\$yn" = xy -o x"\$yn" = xY; then
518
+ eval "\"\$script\" \$scriptargs \"\\\$@\""; res=\$?;
519
+ fi
520
+ else
521
+ eval "\"\$script\" \$scriptargs \"\\\$@\""; res=\$?
522
+ fi
523
+ if test "\$res" -ne 0; then
524
+ test x"\$verbose" = xy && echo "The program '\$script' returned an error code (\$res)" >&2
525
+ fi
526
+fi
527
+if test x"\$keep" = xn; then
528
+ cd \$TMPROOT
529
+ /bin/rm -rf \$tmpdir
530
+fi
531
+eval \$finish; exit \$res
532
+EOF
makeself/makeself-help-header.txt
new
+3
@@ -0,0 +1,3 @@
1
+netdata help header
2
+
3
+
makeself/makeself-license.txt
new
+11
@@ -0,0 +1,11 @@
1
+netdata
2
+(C) Copyright 2017, Costa Tsaousis
3
+All rights reserved
4
+
5
+Released under GPL v3+
6
+
7
+netdata re-distributes a lot of open source software components.
8
+Check its full license at:
9
+
10
+https://github.com/firehol/netdata/blob/master/LICENSE.md
11
+
makeself/makeself.lsm
new
+16
@@ -0,0 +1,16 @@
1
+Begin3
2
+Title: netdata
3
+Version: 1.6.0
4
+Description: netdata is a system for distributed real-time performance and health monitoring.
5
+ It provides unparalleled insights, in real-time, of everything happening on the
6
+ system it runs (including applications such as web and database servers), using
7
+ modern interactive web dashboards. netdata is fast and efficient, designed to
8
+ permanently run on all systems (physical & virtual servers, containers, IoT
9
+ devices), without disrupting their core function.
10
+Keywords: real-time performance and health monitoring
11
+Author: Costa Tsaousis (costa@tsaousis.gr)
12
+Maintained-by: Costa Tsaousis (costa@tsaousis.gr)
13
+Original-site: https://my-netdata.io/
14
+Platform: Unix
15
+Copying-policy: GPL
16
+End
makeself/makeself.sh
new
+592
@@ -0,0 +1,592 @@
1
+#!/bin/sh
2
+#
3
+# Makeself version 2.3.x
4
+# by Stephane Peter <megastep@megastep.org>
5
+#
6
+# Utility to create self-extracting tar.gz archives.
7
+# The resulting archive is a file holding the tar.gz archive with
8
+# a small Shell script stub that uncompresses the archive to a temporary
9
+# directory and then executes a given script from withing that directory.
10
+#
11
+# Makeself home page: http://makeself.io/
12
+#
13
+# Version 2.0 is a rewrite of version 1.0 to make the code easier to read and maintain.
14
+#
15
+# Version history :
16
+# - 1.0 : Initial public release
17
+# - 1.1 : The archive can be passed parameters that will be passed on to
18
+# the embedded script, thanks to John C. Quillan
19
+# - 1.2 : Package distribution, bzip2 compression, more command line options,
20
+# support for non-temporary archives. Ideas thanks to Francois Petitjean
21
+# - 1.3 : More patches from Bjarni R. Einarsson and Francois Petitjean:
22
+# Support for no compression (--nocomp), script is no longer mandatory,
23
+# automatic launch in an xterm, optional verbose output, and -target
24
+# archive option to indicate where to extract the files.
25
+# - 1.4 : Improved UNIX compatibility (Francois Petitjean)
26
+# Automatic integrity checking, support of LSM files (Francois Petitjean)
27
+# - 1.5 : Many bugfixes. Optionally disable xterm spawning.
28
+# - 1.5.1 : More bugfixes, added archive options -list and -check.
29
+# - 1.5.2 : Cosmetic changes to inform the user of what's going on with big
30
+# archives (Quake III demo)
31
+# - 1.5.3 : Check for validity of the DISPLAY variable before launching an xterm.
32
+# More verbosity in xterms and check for embedded command's return value.
33
+# Bugfix for Debian 2.0 systems that have a different "print" command.
34
+# - 1.5.4 : Many bugfixes. Print out a message if the extraction failed.
35
+# - 1.5.5 : More bugfixes. Added support for SETUP_NOCHECK environment variable to
36
+# bypass checksum verification of archives.
37
+# - 1.6.0 : Compute MD5 checksums with the md5sum command (patch from Ryan Gordon)
38
+# - 2.0 : Brand new rewrite, cleaner architecture, separated header and UNIX ports.
39
+# - 2.0.1 : Added --copy
40
+# - 2.1.0 : Allow multiple tarballs to be stored in one archive, and incremental updates.
41
+# Added --nochown for archives
42
+# Stopped doing redundant checksums when not necesary
43
+# - 2.1.1 : Work around insane behavior from certain Linux distros with no 'uncompress' command
44
+# Cleaned up the code to handle error codes from compress. Simplified the extraction code.
45
+# - 2.1.2 : Some bug fixes. Use head -n to avoid problems.
46
+# - 2.1.3 : Bug fixes with command line when spawning terminals.
47
+# Added --tar for archives, allowing to give arbitrary arguments to tar on the contents of the archive.
48
+# Added --noexec to prevent execution of embedded scripts.
49
+# Added --nomd5 and --nocrc to avoid creating checksums in archives.
50
+# Added command used to create the archive in --info output.
51
+# Run the embedded script through eval.
52
+# - 2.1.4 : Fixed --info output.
53
+# Generate random directory name when extracting files to . to avoid problems. (Jason Trent)
54
+# Better handling of errors with wrong permissions for the directory containing the files. (Jason Trent)
55
+# Avoid some race conditions (Ludwig Nussel)
56
+# Unset the $CDPATH variable to avoid problems if it is set. (Debian)
57
+# Better handling of dot files in the archive directory.
58
+# - 2.1.5 : Made the md5sum detection consistent with the header code.
59
+# Check for the presence of the archive directory
60
+# Added --encrypt for symmetric encryption through gpg (Eric Windisch)
61
+# Added support for the digest command on Solaris 10 for MD5 checksums
62
+# Check for available disk space before extracting to the target directory (Andreas Schweitzer)
63
+# Allow extraction to run asynchronously (patch by Peter Hatch)
64
+# Use file descriptors internally to avoid error messages (patch by Kay Tiong Khoo)
65
+# - 2.1.6 : Replaced one dot per file progress with a realtime progress percentage and a spining cursor (Guy Baconniere)
66
+# Added --noprogress to prevent showing the progress during the decompression (Guy Baconniere)
67
+# Added --target dir to allow extracting directly to a target directory (Guy Baconniere)
68
+# - 2.2.0 : Many bugfixes, updates and contributions from users. Check out the project page on Github for the details.
69
+# - 2.3.0 : Option to specify packaging date to enable byte-for-byte reproducibility. (Marc Pawlowsky)
70
+#
71
+# (C) 1998-2017 by Stephane Peter <megastep@megastep.org>
72
+#
73
+# This software is released under the terms of the GNU GPL version 2 and above
74
+# Please read the license at http://www.gnu.org/copyleft/gpl.html
75
+#
76
+
77
+MS_VERSION=2.3.1
78
+MS_COMMAND="$0"
79
+unset CDPATH
80
+
81
+for f in "${1+"$@"}"; do
82
+ MS_COMMAND="$MS_COMMAND \\\\
83
+ \\\"$f\\\""
84
+done
85
+
86
+# For Solaris systems
87
+if test -d /usr/xpg4/bin; then
88
+ PATH=/usr/xpg4/bin:$PATH
89
+ export PATH
90
+fi
91
+
92
+# Procedures
93
+
94
+MS_Usage()
95
+{
96
+ echo "Usage: $0 [params] archive_dir file_name label startup_script [args]"
97
+ echo "params can be one or more of the following :"
98
+ echo " --version | -v : Print out Makeself version number and exit"
99
+ echo " --help | -h : Print out this help message"
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"
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"
107
+ echo " --lzo : Compress using lzop instead of gzip"
108
+ echo " --lz4 : Compress using lz4 instead of gzip"
109
+ echo " --compress : Compress using the UNIX 'compress' command"
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 " --ssl-encrypt : Instead of compressing, encrypt the data using OpenSSL"
114
+ echo " --nocomp : Do not compress the data"
115
+ echo " --notemp : The archive will create archive_dir in the"
116
+ echo " current directory and uncompress in ./archive_dir"
117
+ echo " --needroot : Check that the root user is extracting the archive before proceeding"
118
+ echo " --copy : Upon extraction, the archive will first copy itself to"
119
+ echo " a temporary directory"
120
+ echo " --append : Append more files to an existing Makeself archive"
121
+ echo " The label and startup scripts will then be ignored"
122
+ echo " --target dir : Extract directly to a target directory"
123
+ echo " directory path can be either absolute or relative"
124
+ echo " --nooverwrite : Do not extract the archive if the specified target directory exists"
125
+ echo " --current : Files will be extracted to the current directory"
126
+ echo " Both --current and --target imply --notemp"
127
+ echo " --tar-extra opt : Append more options to the tar command line"
128
+ echo " --nomd5 : Don't calculate an MD5 for archive"
129
+ echo " --nocrc : Don't calculate a CRC for archive"
130
+ echo " --header file : Specify location of the header script"
131
+ echo " --follow : Follow the symlinks in the archive"
132
+ echo " --noprogress : Do not show the progress during the decompression"
133
+ echo " --nox11 : Disable automatic spawn of a xterm"
134
+ echo " --nowait : Do not wait for user input after executing embedded"
135
+ echo " program from an xterm"
136
+ echo " --lsm file : LSM file describing the package"
137
+ echo " --license file : Append a license file"
138
+ echo " --help-header file : Add a header to the archive's --help output"
139
+ echo " --packaging-date date"
140
+ echo " : Use provided string as the packaging date"
141
+ echo " instead of the current date."
142
+ echo
143
+ echo " --keep-umask : Keep the umask set to shell default, rather than overriding when executing self-extracting archive."
144
+ echo
145
+ echo "Do not forget to give a fully qualified startup script name"
146
+ echo "(i.e. with a ./ prefix if inside the archive)."
147
+ exit 1
148
+}
149
+
150
+# Default settings
151
+if type gzip 2>&1 > /dev/null; then
152
+ COMPRESS=gzip
153
+else
154
+ COMPRESS=Unix
155
+fi
156
+COMPRESS_LEVEL=9
157
+KEEP=n
158
+CURRENT=n
159
+NOX11=n
160
+NOWAIT=n
161
+APPEND=n
162
+TAR_QUIETLY=n
163
+KEEP_UMASK=n
164
+QUIET=n
165
+NOPROGRESS=n
166
+COPY=none
167
+NEED_ROOT=n
168
+TAR_ARGS=cvf
169
+TAR_EXTRA=""
170
+DU_ARGS=-ks
171
+HEADER=`dirname "$0"`/makeself-header.sh
172
+TARGETDIR=""
173
+NOOVERWRITE=n
174
+DATE=`LC_ALL=C date`
175
+
176
+# LSM file stuff
177
+LSM_CMD="echo No LSM. >> \"\$archname\""
178
+
179
+while true
180
+do
181
+ case "$1" in
182
+ --version | -v)
183
+ echo Makeself version $MS_VERSION
184
+ exit 0
185
+ ;;
186
+ --pbzip2)
187
+ COMPRESS=pbzip2
188
+ shift
189
+ ;;
190
+ --bzip2)
191
+ COMPRESS=bzip2
192
+ shift
193
+ ;;
194
+ --gzip)
195
+ COMPRESS=gzip
196
+ shift
197
+ ;;
198
+ --pigz)
199
+ COMPRESS=pigz
200
+ shift
201
+ ;;
202
+ --xz)
203
+ COMPRESS=xz
204
+ shift
205
+ ;;
206
+ --lzo)
207
+ COMPRESS=lzo
208
+ shift
209
+ ;;
210
+ --lz4)
211
+ COMPRESS=lz4
212
+ shift
213
+ ;;
214
+ --compress)
215
+ COMPRESS=Unix
216
+ shift
217
+ ;;
218
+ --base64)
219
+ COMPRESS=base64
220
+ shift
221
+ ;;
222
+ --gpg-encrypt)
223
+ COMPRESS=gpg
224
+ shift
225
+ ;;
226
+ --ssl-encrypt)
227
+ COMPRESS=openssl
228
+ shift
229
+ ;;
230
+ --nocomp)
231
+ COMPRESS=none
232
+ shift
233
+ ;;
234
+ --complevel)
235
+ COMPRESS_LEVEL="$2"
236
+ if ! shift 2; then MS_Help; exit 1; fi
237
+ ;;
238
+ --notemp)
239
+ KEEP=y
240
+ shift
241
+ ;;
242
+ --copy)
243
+ COPY=copy
244
+ shift
245
+ ;;
246
+ --current)
247
+ CURRENT=y
248
+ KEEP=y
249
+ shift
250
+ ;;
251
+ --tar-extra)
252
+ TAR_EXTRA="$2"
253
+ if ! shift 2; then MS_Help; exit 1; fi
254
+ ;;
255
+ --target)
256
+ TARGETDIR="$2"
257
+ KEEP=y
258
+ if ! shift 2; then MS_Help; exit 1; fi
259
+ ;;
260
+ --nooverwrite)
261
+ NOOVERWRITE=y
262
+ shift
263
+ ;;
264
+ --needroot)
265
+ NEED_ROOT=y
266
+ shift
267
+ ;;
268
+ --header)
269
+ HEADER="$2"
270
+ if ! shift 2; then MS_Help; exit 1; fi
271
+ ;;
272
+ --license)
273
+ LICENSE=`cat $2`
274
+ if ! shift 2; then MS_Help; exit 1; fi
275
+ ;;
276
+ --follow)
277
+ TAR_ARGS=cvhf
278
+ DU_ARGS=-ksL
279
+ shift
280
+ ;;
281
+ --noprogress)
282
+ NOPROGRESS=y
283
+ shift
284
+ ;;
285
+ --nox11)
286
+ NOX11=y
287
+ shift
288
+ ;;
289
+ --nowait)
290
+ NOWAIT=y
291
+ shift
292
+ ;;
293
+ --nomd5)
294
+ NOMD5=y
295
+ shift
296
+ ;;
297
+ --nocrc)
298
+ NOCRC=y
299
+ shift
300
+ ;;
301
+ --append)
302
+ APPEND=y
303
+ shift
304
+ ;;
305
+ --lsm)
306
+ LSM_CMD="cat \"$2\" >> \"\$archname\""
307
+ if ! shift 2; then MS_Help; exit 1; fi
308
+ ;;
309
+ --packaging-date)
310
+ DATE="$2"
311
+ if ! shift 2; then MS_Help; exit 1; fi
312
+ ;;
313
+ --help-header)
314
+ HELPHEADER=`sed -e "s/'/'\\\\\''/g" $2`
315
+ if ! shift 2; then MS_Help; exit 1; fi
316
+ [ -n "$HELPHEADER" ] && HELPHEADER="$HELPHEADER
317
+"
318
+ ;;
319
+ --tar-quietly)
320
+ TAR_QUIETLY=y
321
+ shift
322
+ ;;
323
+ --keep-umask)
324
+ KEEP_UMASK=y
325
+ shift
326
+ ;;
327
+ -q | --quiet)
328
+ QUIET=y
329
+ shift
330
+ ;;
331
+ -h | --help)
332
+ MS_Usage
333
+ ;;
334
+ -*)
335
+ echo Unrecognized flag : "$1"
336
+ MS_Usage
337
+ ;;
338
+ *)
339
+ break
340
+ ;;
341
+ esac
342
+done
343
+
344
+if test $# -lt 1; then
345
+ MS_Usage
346
+else
347
+ if test -d "$1"; then
348
+ archdir="$1"
349
+ else
350
+ echo "Directory $1 does not exist." >&2
351
+ exit 1
352
+ fi
353
+fi
354
+archname="$2"
355
+
356
+if test "$QUIET" = "y" || test "$TAR_QUIETLY" = "y"; then
357
+ if test "$TAR_ARGS" = "cvf"; then
358
+ TAR_ARGS="cf"
359
+ elif test "$TAR_ARGS" = "cvhf";then
360
+ TAR_ARGS="chf"
361
+ fi
362
+fi
363
+
364
+if test "$APPEND" = y; then
365
+ if test $# -lt 2; then
366
+ MS_Usage
367
+ fi
368
+
369
+ # Gather the info from the original archive
370
+ OLDENV=`sh "$archname" --dumpconf`
371
+ if test $? -ne 0; then
372
+ echo "Unable to update archive: $archname" >&2
373
+ exit 1
374
+ else
375
+ eval "$OLDENV"
376
+ fi
377
+else
378
+ if test "$KEEP" = n -a $# = 3; then
379
+ echo "ERROR: Making a temporary archive with no embedded command does not make sense!" >&2
380
+ echo >&2
381
+ MS_Usage
382
+ fi
383
+ # We don't want to create an absolute directory unless a target directory is defined
384
+ if test "$CURRENT" = y; then
385
+ archdirname="."
386
+ elif test x$TARGETDIR != x; then
387
+ archdirname="$TARGETDIR"
388
+ else
389
+ archdirname=`basename "$1"`
390
+ fi
391
+
392
+ if test $# -lt 3; then
393
+ MS_Usage
394
+ fi
395
+
396
+ LABEL="$3"
397
+ SCRIPT="$4"
398
+ test "x$SCRIPT" = x || shift 1
399
+ shift 3
400
+ SCRIPTARGS="$*"
401
+fi
402
+
403
+if test "$KEEP" = n -a "$CURRENT" = y; then
404
+ echo "ERROR: It is A VERY DANGEROUS IDEA to try to combine --notemp and --current." >&2
405
+ exit 1
406
+fi
407
+
408
+case $COMPRESS in
409
+gzip)
410
+ GZIP_CMD="gzip -c$COMPRESS_LEVEL"
411
+ GUNZIP_CMD="gzip -cd"
412
+ ;;
413
+pigz)
414
+ GZIP_CMD="pigz -$COMPRESS_LEVEL"
415
+ GUNZIP_CMD="gzip -cd"
416
+ ;;
417
+pbzip2)
418
+ GZIP_CMD="pbzip2 -c$COMPRESS_LEVEL"
419
+ GUNZIP_CMD="bzip2 -d"
420
+ ;;
421
+bzip2)
422
+ GZIP_CMD="bzip2 -$COMPRESS_LEVEL"
423
+ GUNZIP_CMD="bzip2 -d"
424
+ ;;
425
+xz)
426
+ GZIP_CMD="xz -c$COMPRESS_LEVEL"
427
+ GUNZIP_CMD="xz -d"
428
+ ;;
429
+lzo)
430
+ GZIP_CMD="lzop -c$COMPRESS_LEVEL"
431
+ GUNZIP_CMD="lzop -d"
432
+ ;;
433
+lz4)
434
+ GZIP_CMD="lz4 -c$COMPRESS_LEVEL"
435
+ GUNZIP_CMD="lz4 -d"
436
+ ;;
437
+base64)
438
+ GZIP_CMD="base64"
439
+ GUNZIP_CMD="base64 -d -i"
440
+ ;;
441
+gpg)
442
+ GZIP_CMD="gpg -ac -z$COMPRESS_LEVEL"
443
+ GUNZIP_CMD="gpg -d"
444
+ ;;
445
+openssl)
446
+ GZIP_CMD="openssl aes-256-cbc -a -salt"
447
+ GUNZIP_CMD="openssl aes-256-cbc -d -a"
448
+ ;;
449
+Unix)
450
+ GZIP_CMD="compress -cf"
451
+ GUNZIP_CMD="exec 2>&-; uncompress -c || test \\\$? -eq 2 || gzip -cd"
452
+ ;;
453
+none)
454
+ GZIP_CMD="cat"
455
+ GUNZIP_CMD="cat"
456
+ ;;
457
+esac
458
+
459
+tmpfile="${TMPDIR:=/tmp}/mkself$$"
460
+
461
+if test -f "$HEADER"; then
462
+ oldarchname="$archname"
463
+ archname="$tmpfile"
464
+ # Generate a fake header to count its lines
465
+ SKIP=0
466
+ . "$HEADER"
467
+ SKIP=`cat "$tmpfile" |wc -l`
468
+ # Get rid of any spaces
469
+ SKIP=`expr $SKIP`
470
+ rm -f "$tmpfile"
471
+ if test "$QUIET" = "n";then
472
+ echo Header is $SKIP lines long >&2
473
+ fi
474
+
475
+ archname="$oldarchname"
476
+else
477
+ echo "Unable to open header file: $HEADER" >&2
478
+ exit 1
479
+fi
480
+
481
+if test "$QUIET" = "n";then
482
+ echo
483
+fi
484
+
485
+if test "$APPEND" = n; then
486
+ if test -f "$archname"; then
487
+ echo "WARNING: Overwriting existing file: $archname" >&2
488
+ fi
489
+fi
490
+
491
+USIZE=`du $DU_ARGS "$archdir" | awk '{print $1}'`
492
+
493
+if test "." = "$archdirname"; then
494
+ if test "$KEEP" = n; then
495
+ archdirname="makeself-$$-`date +%Y%m%d%H%M%S`"
496
+ fi
497
+fi
498
+
499
+test -d "$archdir" || { echo "Error: $archdir does not exist."; rm -f "$tmpfile"; exit 1; }
500
+if test "$QUIET" = "n";then
501
+ echo About to compress $USIZE KB of data...
502
+ echo Adding files to archive named \"$archname\"...
503
+fi
504
+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; }
506
+exec 3>&- # try to close the archive
507
+
508
+fsize=`cat "$tmpfile" | wc -c | tr -d " "`
509
+
510
+# Compute the checksums
511
+
512
+md5sum=00000000000000000000000000000000
513
+crcsum=0000000000
514
+
515
+if test "$NOCRC" = y; then
516
+ if test "$QUIET" = "n";then
517
+ echo "skipping crc at user request"
518
+ fi
519
+else
520
+ crcsum=`cat "$tmpfile" | CMD_ENV=xpg4 cksum | sed -e 's/ /Z/' -e 's/ /Z/' | cut -dZ -f1`
521
+ if test "$QUIET" = "n";then
522
+ echo "CRC: $crcsum"
523
+ fi
524
+fi
525
+
526
+if test "$NOMD5" = y; then
527
+ if test "$QUIET" = "n";then
528
+ echo "skipping md5sum at user request"
529
+ fi
530
+else
531
+ # Try to locate a MD5 binary
532
+ OLD_PATH=$PATH
533
+ PATH=${GUESS_MD5_PATH:-"$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"}
534
+ MD5_ARG=""
535
+ MD5_PATH=`exec <&- 2>&-; which md5sum || command -v md5sum || type md5sum`
536
+ test -x "$MD5_PATH" || MD5_PATH=`exec <&- 2>&-; which md5 || command -v md5 || type md5`
537
+ test -x "$MD5_PATH" || MD5_PATH=`exec <&- 2>&-; which digest || command -v digest || type digest`
538
+ PATH=$OLD_PATH
539
+ if test -x "$MD5_PATH"; then
540
+ if test `basename ${MD5_PATH}`x = digestx; then
541
+ MD5_ARG="-a md5"
542
+ fi
543
+ md5sum=`cat "$tmpfile" | eval "$MD5_PATH $MD5_ARG" | cut -b-32`;
544
+ if test "$QUIET" = "n";then
545
+ echo "MD5: $md5sum"
546
+ fi
547
+ else
548
+ if test "$QUIET" = "n";then
549
+ echo "MD5: none, MD5 command not found"
550
+ fi
551
+ fi
552
+fi
553
+
554
+if test "$APPEND" = y; then
555
+ mv "$archname" "$archname".bak || exit
556
+
557
+ # Prepare entry for new archive
558
+ filesizes="$filesizes $fsize"
559
+ CRCsum="$CRCsum $crcsum"
560
+ MD5sum="$MD5sum $md5sum"
561
+ USIZE=`expr $USIZE + $OLDUSIZE`
562
+ # Generate the header
563
+ . "$HEADER"
564
+ # Append the original data
565
+ tail -n +$OLDSKIP "$archname".bak >> "$archname"
566
+ # Append the new data
567
+ cat "$tmpfile" >> "$archname"
568
+
569
+ chmod +x "$archname"
570
+ rm -f "$archname".bak
571
+ if test "$QUIET" = "n";then
572
+ echo Self-extractable archive \"$archname\" successfully updated.
573
+ fi
574
+else
575
+ filesizes="$fsize"
576
+ CRCsum="$crcsum"
577
+ MD5sum="$md5sum"
578
+
579
+ # Generate the header
580
+ . "$HEADER"
581
+
582
+ # Append the compressed tar data after the stub
583
+ if test "$QUIET" = "n";then
584
+ echo
585
+ fi
586
+ cat "$tmpfile" >> "$archname"
587
+ chmod +x "$archname"
588
+ if test "$QUIET" = "n";then
589
+ echo Self-extractable archive \"$archname\" successfully created.
590
+ fi
591
+fi
592
+rm -f "$tmpfile"