| 1 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 2 | # shellcheck shell=sh |
| 3 | # shellcheck disable=SC2154,SC2039 |
| 4 | cat << EOF > "$archname" |
| 5 | #!/bin/sh |
| 6 | # This script was generated using Makeself $MS_VERSION |
| 7 | # The license covering this archive and its contents, if any, is wholly independent of the Makeself license (GPL) |
| 8 | |
| 9 | ORIG_UMASK=\`umask\` |
| 10 | if test "$KEEP_UMASK" = n; then |
| 11 | umask 077 |
| 12 | fi |
| 13 | |
| 14 | CRCsum="$CRCsum" |
| 15 | MD5="$MD5sum" |
| 16 | SHA="$SHAsum" |
| 17 | SIGNATURE="$Signature" |
| 18 | TMPROOT=\${TMPDIR:=/tmp} |
| 19 | USER_PWD="\$PWD" |
| 20 | export USER_PWD |
| 21 | ARCHIVE_DIR=\`dirname "\$0"\` |
| 22 | export ARCHIVE_DIR |
| 23 | |
| 24 | label="$LABEL" |
| 25 | script="$SCRIPT" |
| 26 | scriptargs="$SCRIPTARGS" |
| 27 | cleanup_script="${CLEANUP_SCRIPT}" |
| 28 | licensetxt="$LICENSE" |
| 29 | helpheader="${HELPHEADER}" |
| 30 | targetdir="$archdirname" |
| 31 | filesizes="$filesizes" |
| 32 | totalsize="$totalsize" |
| 33 | keep="$KEEP" |
| 34 | nooverwrite="$NOOVERWRITE" |
| 35 | quiet="n" |
| 36 | accept="n" |
| 37 | nodiskspace="n" |
| 38 | export_conf="$EXPORT_CONF" |
| 39 | decrypt_cmd="$DECRYPT_CMD" |
| 40 | skip="$SKIP" |
| 41 | |
| 42 | print_cmd_arg="" |
| 43 | if type printf > /dev/null; then |
| 44 | print_cmd="printf" |
| 45 | elif test -x /usr/ucb/echo; then |
| 46 | print_cmd="/usr/ucb/echo" |
| 47 | else |
| 48 | print_cmd="echo" |
| 49 | fi |
| 50 | |
| 51 | if test -d /usr/xpg4/bin; then |
| 52 | PATH=/usr/xpg4/bin:\$PATH |
| 53 | export PATH |
| 54 | fi |
| 55 | |
| 56 | if test -d /usr/sfw/bin; then |
| 57 | PATH=\$PATH:/usr/sfw/bin |
| 58 | export PATH |
| 59 | fi |
| 60 | |
| 61 | unset CDPATH |
| 62 | |
| 63 | MS_Printf() |
| 64 | { |
| 65 | \$print_cmd \$print_cmd_arg "\$1" |
| 66 | } |
| 67 | |
| 68 | MS_PrintLicense() |
| 69 | { |
| 70 | PAGER=\${PAGER:=more} |
| 71 | if test x"\$licensetxt" != x; then |
| 72 | PAGER_PATH=\`exec <&- 2>&-; which \$PAGER || command -v \$PAGER || type \$PAGER\` |
| 73 | if test -x "\$PAGER_PATH" && test x"\$accept" != xy; then |
| 74 | echo "\$licensetxt" | \$PAGER |
| 75 | else |
| 76 | echo "\$licensetxt" |
| 77 | fi |
| 78 | if test x"\$accept" != xy; then |
| 79 | while true |
| 80 | do |
| 81 | MS_Printf "Please type y to accept, n otherwise: " |
| 82 | read yn |
| 83 | if test x"\$yn" = xn; then |
| 84 | keep=n |
| 85 | eval \$finish; exit 1 |
| 86 | break; |
| 87 | elif test x"\$yn" = xy; then |
| 88 | break; |
| 89 | fi |
| 90 | done |
| 91 | fi |
| 92 | fi |
| 93 | } |
| 94 | |
| 95 | MS_diskspace() |
| 96 | { |
| 97 | ( |
| 98 | df -k "\$1" | tail -1 | awk '{ if (\$4 ~ /%/) {print \$3} else {print \$4} }' |
| 99 | ) |
| 100 | } |
| 101 | |
| 102 | MS_dd() |
| 103 | { |
| 104 | blocks=\`expr \$3 / 1024\` |
| 105 | bytes=\`expr \$3 % 1024\` |
| 106 | # Test for ibs, obs and conv feature |
| 107 | if dd if=/dev/zero of=/dev/null count=1 ibs=512 obs=512 conv=sync 2> /dev/null; then |
| 108 | dd if="\$1" ibs=\$2 skip=1 obs=1024 conv=sync 2> /dev/null | \\ |
| 109 | { test \$blocks -gt 0 && dd ibs=1024 obs=1024 count=\$blocks ; \\ |
| 110 | test \$bytes -gt 0 && dd ibs=1 obs=1024 count=\$bytes ; } 2> /dev/null |
| 111 | else |
| 112 | dd if="\$1" bs=\$2 skip=1 2> /dev/null |
| 113 | fi |
| 114 | } |
| 115 | |
| 116 | MS_dd_Progress() |
| 117 | { |
| 118 | if test x"\$noprogress" = xy; then |
| 119 | MS_dd "\$@" |
| 120 | return \$? |
| 121 | fi |
| 122 | file="\$1" |
| 123 | offset=\$2 |
| 124 | length=\$3 |
| 125 | pos=0 |
| 126 | bsize=4194304 |
| 127 | while test \$bsize -gt \$length; do |
| 128 | bsize=\`expr \$bsize / 4\` |
| 129 | done |
| 130 | blocks=\`expr \$length / \$bsize\` |
| 131 | bytes=\`expr \$length % \$bsize\` |
| 132 | ( |
| 133 | dd ibs=\$offset skip=1 count=1 2>/dev/null |
| 134 | pos=\`expr \$pos \+ \$bsize\` |
| 135 | MS_Printf " 0%% " 1>&2 |
| 136 | if test \$blocks -gt 0; then |
| 137 | while test \$pos -le \$length; do |
| 138 | dd bs=\$bsize count=1 2>/dev/null |
| 139 | pcent=\`expr \$length / 100\` |
| 140 | pcent=\`expr \$pos / \$pcent\` |
| 141 | if test \$pcent -lt 100; then |
| 142 | MS_Printf "\b\b\b\b\b\b\b" 1>&2 |
| 143 | if test \$pcent -lt 10; then |
| 144 | MS_Printf " \$pcent%% " 1>&2 |
| 145 | else |
| 146 | MS_Printf " \$pcent%% " 1>&2 |
| 147 | fi |
| 148 | fi |
| 149 | pos=\`expr \$pos \+ \$bsize\` |
| 150 | done |
| 151 | fi |
| 152 | if test \$bytes -gt 0; then |
| 153 | dd bs=\$bytes count=1 2>/dev/null |
| 154 | fi |
| 155 | MS_Printf "\b\b\b\b\b\b\b" 1>&2 |
| 156 | MS_Printf " 100%% " 1>&2 |
| 157 | ) < "\$file" |
| 158 | } |
| 159 | |
| 160 | MS_Help() |
| 161 | { |
| 162 | cat << EOH >&2 |
| 163 | Makeself version $MS_VERSION |
| 164 | 1) Getting help or info about \$0 : |
| 165 | \$0 --help Print this message |
| 166 | \$0 --info Print embedded info : title, default target directory, embedded script ... |
| 167 | \$0 --lsm Print embedded lsm entry (or no LSM) |
| 168 | \$0 --list Print the list of files in the archive |
| 169 | \$0 --check Checks integrity of the archive |
| 170 | \$0 --verify-sig key Verify signature agains a provided key id |
| 171 | |
| 172 | 2) Running \$0 : |
| 173 | \$0 [options] [--] [additional arguments to embedded script] |
| 174 | with following options (in that order) |
| 175 | --confirm Ask before running embedded script |
| 176 | --quiet Do not print anything except error messages |
| 177 | --accept Accept the license |
| 178 | --noexec Do not run embedded script (implies --noexec-cleanup) |
| 179 | --noexec-cleanup Do not run embedded cleanup script |
| 180 | --keep Do not erase target directory after running |
| 181 | the embedded script |
| 182 | --noprogress Do not show the progress during the decompression |
| 183 | --nox11 Do not spawn an xterm |
| 184 | --nochown Do not give the target folder to the current user |
| 185 | --chown Give the target folder to the current user recursively |
| 186 | --nodiskspace Do not check for available disk space |
| 187 | --target dir Extract directly to a target directory (absolute or relative) |
| 188 | This directory may undergo recursive chown (see --nochown). |
| 189 | --tar arg1 [arg2 ...] Access the contents of the archive through the tar command |
| 190 | --ssl-pass-src src Use the given src as the source of password to decrypt the data |
| 191 | using OpenSSL. See "PASS PHRASE ARGUMENTS" in man openssl. |
| 192 | Default is to prompt the user to enter decryption password |
| 193 | on the current terminal. |
| 194 | --cleanup-args args Arguments to the cleanup script. Wrap in quotes to provide |
| 195 | multiple arguments. |
| 196 | -- Following arguments will be passed to the embedded script\${helpheader} |
| 197 | EOH |
| 198 | } |
| 199 | |
| 200 | MS_Verify_Sig() |
| 201 | { |
| 202 | GPG_PATH=\`exec <&- 2>&-; which gpg || command -v gpg || type gpg\` |
| 203 | MKTEMP_PATH=\`exec <&- 2>&-; which mktemp || command -v mktemp || type mktemp\` |
| 204 | test -x "\$GPG_PATH" || GPG_PATH=\`exec <&- 2>&-; which gpg || command -v gpg || type gpg\` |
| 205 | test -x "\$MKTEMP_PATH" || MKTEMP_PATH=\`exec <&- 2>&-; which mktemp || command -v mktemp || type mktemp\` |
| 206 | offset=\`head -n "\$skip" "\$1" | wc -c | sed "s/ //g"\` |
| 207 | temp_sig=\`mktemp -t XXXXX\` |
| 208 | echo \$SIGNATURE | base64 --decode > "\$temp_sig" |
| 209 | gpg_output=\`MS_dd "\$1" \$offset \$totalsize | LC_ALL=C "\$GPG_PATH" --verify "\$temp_sig" - 2>&1\` |
| 210 | gpg_res=\$? |
| 211 | rm -f "\$temp_sig" |
| 212 | if test \$gpg_res -eq 0 && test \`echo \$gpg_output | grep -c Good\` -eq 1; then |
| 213 | if test \`echo \$gpg_output | grep -c \$sig_key\` -eq 1; then |
| 214 | test x"\$quiet" = xn && echo "GPG signature is good" >&2 |
| 215 | else |
| 216 | echo "GPG Signature key does not match" >&2 |
| 217 | exit 2 |
| 218 | fi |
| 219 | else |
| 220 | test x"\$quiet" = xn && echo "GPG signature failed to verify" >&2 |
| 221 | exit 2 |
| 222 | fi |
| 223 | } |
| 224 | |
| 225 | MS_Check() |
| 226 | { |
| 227 | OLD_PATH="\$PATH" |
| 228 | PATH=\${GUESS_MD5_PATH:-"\$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"} |
| 229 | MD5_ARG="" |
| 230 | MD5_PATH=\`exec <&- 2>&-; which md5sum || command -v md5sum || type md5sum\` |
| 231 | test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which md5 || command -v md5 || type md5\` |
| 232 | test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which digest || command -v digest || type digest\` |
| 233 | PATH="\$OLD_PATH" |
| 234 | |
| 235 | SHA_PATH=\`exec <&- 2>&-; which shasum || command -v shasum || type shasum\` |
| 236 | test -x "\$SHA_PATH" || SHA_PATH=\`exec <&- 2>&-; which sha256sum || command -v sha256sum || type sha256sum\` |
| 237 | |
| 238 | if test x"\$quiet" = xn; then |
| 239 | MS_Printf "Verifying archive integrity..." |
| 240 | fi |
| 241 | offset=\`head -n "\$skip" "\$1" | wc -c | sed "s/ //g"\` |
| 242 | fsize=\`cat "\$1" | wc -c | sed "s/ //g"\` |
| 243 | if test \$totalsize -ne \`expr \$fsize - \$offset\`; then |
| 244 | echo " Unexpected archive size." >&2 |
| 245 | exit 2 |
| 246 | fi |
| 247 | verb=\$2 |
| 248 | i=1 |
| 249 | for s in \$filesizes |
| 250 | do |
| 251 | crc=\`echo \$CRCsum | cut -d" " -f\$i\` |
| 252 | if test -x "\$SHA_PATH"; then |
| 253 | if test x"\`basename \$SHA_PATH\`" = xshasum; then |
| 254 | SHA_ARG="-a 256" |
| 255 | fi |
| 256 | sha=\`echo \$SHA | cut -d" " -f\$i\` |
| 257 | if test x"\$sha" = x0000000000000000000000000000000000000000000000000000000000000000; then |
| 258 | test x"\$verb" = xy && echo " \$1 does not contain an embedded SHA256 checksum." >&2 |
| 259 | else |
| 260 | shasum=\`MS_dd_Progress "\$1" \$offset \$s | eval "\$SHA_PATH \$SHA_ARG" | cut -b-64\`; |
| 261 | if test x"\$shasum" != x"\$sha"; then |
| 262 | echo "Error in SHA256 checksums: \$shasum is different from \$sha" >&2 |
| 263 | exit 2 |
| 264 | elif test x"\$quiet" = xn; then |
| 265 | MS_Printf " SHA256 checksums are OK." >&2 |
| 266 | fi |
| 267 | crc="0000000000"; |
| 268 | fi |
| 269 | fi |
| 270 | if test -x "\$MD5_PATH"; then |
| 271 | if test x"\`basename \$MD5_PATH\`" = xdigest; then |
| 272 | MD5_ARG="-a md5" |
| 273 | fi |
| 274 | md5=\`echo \$MD5 | cut -d" " -f\$i\` |
| 275 | if test x"\$md5" = x00000000000000000000000000000000; then |
| 276 | test x"\$verb" = xy && echo " \$1 does not contain an embedded MD5 checksum." >&2 |
| 277 | else |
| 278 | md5sum=\`MS_dd_Progress "\$1" \$offset \$s | eval "\$MD5_PATH \$MD5_ARG" | cut -b-32\`; |
| 279 | if test x"\$md5sum" != x"\$md5"; then |
| 280 | echo "Error in MD5 checksums: \$md5sum is different from \$md5" >&2 |
| 281 | exit 2 |
| 282 | elif test x"\$quiet" = xn; then |
| 283 | MS_Printf " MD5 checksums are OK." >&2 |
| 284 | fi |
| 285 | crc="0000000000"; verb=n |
| 286 | fi |
| 287 | fi |
| 288 | if test x"\$crc" = x0000000000; then |
| 289 | test x"\$verb" = xy && echo " \$1 does not contain a CRC checksum." >&2 |
| 290 | else |
| 291 | sum1=\`MS_dd_Progress "\$1" \$offset \$s | CMD_ENV=xpg4 cksum | awk '{print \$1}'\` |
| 292 | if test x"\$sum1" != x"\$crc"; then |
| 293 | echo "Error in checksums: \$sum1 is different from \$crc" >&2 |
| 294 | exit 2 |
| 295 | elif test x"\$quiet" = xn; then |
| 296 | MS_Printf " CRC checksums are OK." >&2 |
| 297 | fi |
| 298 | fi |
| 299 | i=\`expr \$i + 1\` |
| 300 | offset=\`expr \$offset + \$s\` |
| 301 | done |
| 302 | if test x"\$quiet" = xn; then |
| 303 | echo " All good." |
| 304 | fi |
| 305 | } |
| 306 | |
| 307 | MS_Decompress() |
| 308 | { |
| 309 | if test x"\$decrypt_cmd" != x""; then |
| 310 | { eval "\$decrypt_cmd" || echo " ... Decryption failed." >&2; } | eval "$GUNZIP_CMD" |
| 311 | else |
| 312 | eval "$GUNZIP_CMD" |
| 313 | fi |
| 314 | |
| 315 | if test \$? -ne 0; then |
| 316 | echo " ... Decompression failed." >&2 |
| 317 | fi |
| 318 | } |
| 319 | |
| 320 | UnTAR() |
| 321 | { |
| 322 | if test x"\$quiet" = xn; then |
| 323 | tar \$1vf - $UNTAR_EXTRA 2>&1 || { echo " ... Extraction failed." >&2; kill -15 \$$; } |
| 324 | else |
| 325 | tar \$1f - $UNTAR_EXTRA 2>&1 || { echo Extraction failed. >&2; kill -15 \$$; } |
| 326 | fi |
| 327 | } |
| 328 | |
| 329 | MS_exec_cleanup() { |
| 330 | if test x"\$cleanup" = xy && test x"\$cleanup_script" != x""; then |
| 331 | cleanup=n |
| 332 | cd "\$tmpdir" |
| 333 | eval "\"\$cleanup_script\" \$scriptargs \$cleanupargs" |
| 334 | fi |
| 335 | } |
| 336 | |
| 337 | MS_cleanup() |
| 338 | { |
| 339 | echo 'Signal caught, cleaning up' >&2 |
| 340 | MS_exec_cleanup |
| 341 | cd "\$TMPROOT" |
| 342 | rm -rf "\$tmpdir" |
| 343 | eval \$finish; exit 15 |
| 344 | } |
| 345 | |
| 346 | finish=true |
| 347 | xterm_loop= |
| 348 | noprogress=$NOPROGRESS |
| 349 | nox11=$NOX11 |
| 350 | copy=$COPY |
| 351 | ownership=$OWNERSHIP |
| 352 | verbose=n |
| 353 | cleanup=y |
| 354 | cleanupargs= |
| 355 | sig_key= |
| 356 | |
| 357 | initargs="\$@" |
| 358 | |
| 359 | while true |
| 360 | do |
| 361 | case "\$1" in |
| 362 | -h | --help) |
| 363 | MS_Help |
| 364 | exit 0 |
| 365 | ;; |
| 366 | -q | --quiet) |
| 367 | quiet=y |
| 368 | noprogress=y |
| 369 | shift |
| 370 | ;; |
| 371 | --accept) |
| 372 | accept=y |
| 373 | shift |
| 374 | ;; |
| 375 | --info) |
| 376 | echo Identification: "\$label" |
| 377 | echo Target directory: "\$targetdir" |
| 378 | echo Uncompressed size: $USIZE KB |
| 379 | echo Compression: $COMPRESS |
| 380 | if test x"$ENCRYPT" != x""; then |
| 381 | echo Encryption: $ENCRYPT |
| 382 | fi |
| 383 | echo Date of packaging: $DATE |
| 384 | echo Built with Makeself version $MS_VERSION |
| 385 | echo Build command was: "$MS_COMMAND" |
| 386 | if test x"\$script" != x; then |
| 387 | echo Script run after extraction: |
| 388 | echo " " \$script \$scriptargs |
| 389 | fi |
| 390 | if test x"$copy" = xcopy; then |
| 391 | echo "Archive will copy itself to a temporary location" |
| 392 | fi |
| 393 | if test x"$NEED_ROOT" = xy; then |
| 394 | echo "Root permissions required for extraction" |
| 395 | fi |
| 396 | if test x"$KEEP" = xy; then |
| 397 | echo "directory \$targetdir is permanent" |
| 398 | else |
| 399 | echo "\$targetdir will be removed after extraction" |
| 400 | fi |
| 401 | exit 0 |
| 402 | ;; |
| 403 | --dumpconf) |
| 404 | echo LABEL=\"\$label\" |
| 405 | echo SCRIPT=\"\$script\" |
| 406 | echo SCRIPTARGS=\"\$scriptargs\" |
| 407 | echo CLEANUPSCRIPT=\"\$cleanup_script\" |
| 408 | echo archdirname=\"$archdirname\" |
| 409 | echo KEEP=$KEEP |
| 410 | echo NOOVERWRITE=$NOOVERWRITE |
| 411 | echo COMPRESS=$COMPRESS |
| 412 | echo filesizes=\"\$filesizes\" |
| 413 | echo totalsize=\"\$totalsize\" |
| 414 | echo CRCsum=\"\$CRCsum\" |
| 415 | echo MD5sum=\"\$MD5sum\" |
| 416 | echo SHAsum=\"\$SHAsum\" |
| 417 | echo SKIP=\"\$skip\" |
| 418 | exit 0 |
| 419 | ;; |
| 420 | --lsm) |
| 421 | cat << EOLSM |
| 422 | EOF |
| 423 | eval "$LSM_CMD" |
| 424 | cat << EOF >> "$archname" |
| 425 | EOLSM |
| 426 | exit 0 |
| 427 | ;; |
| 428 | --list) |
| 429 | echo Target directory: \$targetdir |
| 430 | offset=\`head -n "\$skip" "\$0" | wc -c | sed "s/ //g"\` |
| 431 | for s in \$filesizes |
| 432 | do |
| 433 | MS_dd "\$0" \$offset \$s | MS_Decompress | UnTAR t |
| 434 | offset=\`expr \$offset + \$s\` |
| 435 | done |
| 436 | exit 0 |
| 437 | ;; |
| 438 | --tar) |
| 439 | offset=\`head -n "\$skip" "\$0" | wc -c | sed "s/ //g"\` |
| 440 | arg1="\$2" |
| 441 | shift 2 || { MS_Help; exit 1; } |
| 442 | for s in \$filesizes |
| 443 | do |
| 444 | MS_dd "\$0" \$offset \$s | MS_Decompress | tar "\$arg1" - "\$@" |
| 445 | offset=\`expr \$offset + \$s\` |
| 446 | done |
| 447 | exit 0 |
| 448 | ;; |
| 449 | --check) |
| 450 | MS_Check "\$0" y |
| 451 | exit 0 |
| 452 | ;; |
| 453 | --verify-sig) |
| 454 | sig_key="\$2" |
| 455 | shift 2 || { MS_Help; exit 1; } |
| 456 | MS_Verify_Sig "\$0" |
| 457 | ;; |
| 458 | --confirm) |
| 459 | verbose=y |
| 460 | shift |
| 461 | ;; |
| 462 | --noexec) |
| 463 | script="" |
| 464 | cleanup_script="" |
| 465 | shift |
| 466 | ;; |
| 467 | --noexec-cleanup) |
| 468 | cleanup_script="" |
| 469 | shift |
| 470 | ;; |
| 471 | --keep) |
| 472 | keep=y |
| 473 | shift |
| 474 | ;; |
| 475 | --target) |
| 476 | keep=y |
| 477 | targetdir="\${2:-.}" |
| 478 | shift 2 || { MS_Help; exit 1; } |
| 479 | ;; |
| 480 | --noprogress) |
| 481 | noprogress=y |
| 482 | shift |
| 483 | ;; |
| 484 | --nox11) |
| 485 | nox11=y |
| 486 | shift |
| 487 | ;; |
| 488 | --nochown) |
| 489 | ownership=n |
| 490 | shift |
| 491 | ;; |
| 492 | --chown) |
| 493 | ownership=y |
| 494 | shift |
| 495 | ;; |
| 496 | --nodiskspace) |
| 497 | nodiskspace=y |
| 498 | shift |
| 499 | ;; |
| 500 | --xwin) |
| 501 | if test "$NOWAIT" = n; then |
| 502 | finish="echo Press Return to close this window...; read junk" |
| 503 | fi |
| 504 | xterm_loop=1 |
| 505 | shift |
| 506 | ;; |
| 507 | --phase2) |
| 508 | copy=phase2 |
| 509 | shift |
| 510 | ;; |
| 511 | --ssl-pass-src) |
| 512 | if test x"$ENCRYPT" != x"openssl"; then |
| 513 | echo "Invalid option --ssl-pass-src: \$0 was not encrypted with OpenSSL!" >&2 |
| 514 | exit 1 |
| 515 | fi |
| 516 | decrypt_cmd="\$decrypt_cmd -pass \$2" |
| 517 | shift 2 || { MS_Help; exit 1; } |
| 518 | ;; |
| 519 | --cleanup-args) |
| 520 | cleanupargs="\$2" |
| 521 | shift 2 || { MS_Help; exit 1; } |
| 522 | ;; |
| 523 | --) |
| 524 | shift |
| 525 | break ;; |
| 526 | -*) |
| 527 | echo Unrecognized flag : "\$1" >&2 |
| 528 | MS_Help |
| 529 | exit 1 |
| 530 | ;; |
| 531 | *) |
| 532 | break ;; |
| 533 | esac |
| 534 | done |
| 535 | |
| 536 | if test x"\$quiet" = xy -a x"\$verbose" = xy; then |
| 537 | echo Cannot be verbose and quiet at the same time. >&2 |
| 538 | exit 1 |
| 539 | fi |
| 540 | |
| 541 | if test x"$NEED_ROOT" = xy -a \`id -u\` -ne 0; then |
| 542 | echo "Administrative privileges required for this archive (use su or sudo)" >&2 |
| 543 | exit 1 |
| 544 | fi |
| 545 | |
| 546 | if test x"\$copy" \!= xphase2; then |
| 547 | MS_PrintLicense |
| 548 | fi |
| 549 | |
| 550 | case "\$copy" in |
| 551 | copy) |
| 552 | tmpdir="\$TMPROOT"/makeself.\$RANDOM.\`date +"%y%m%d%H%M%S"\`.\$\$ |
| 553 | mkdir "\$tmpdir" || { |
| 554 | echo "Could not create temporary directory \$tmpdir" >&2 |
| 555 | exit 1 |
| 556 | } |
| 557 | SCRIPT_COPY="\$tmpdir/makeself" |
| 558 | echo "Copying to a temporary location..." >&2 |
| 559 | cp "\$0" "\$SCRIPT_COPY" |
| 560 | chmod +x "\$SCRIPT_COPY" |
| 561 | cd "\$TMPROOT" |
| 562 | export USER_PWD="\$tmpdir" |
| 563 | exec "\$SCRIPT_COPY" --phase2 -- \$initargs |
| 564 | ;; |
| 565 | phase2) |
| 566 | finish="\$finish ; rm -rf \`dirname \$0\`" |
| 567 | ;; |
| 568 | esac |
| 569 | |
| 570 | if test x"\$nox11" = xn; then |
| 571 | if test -t 1; then # Do we have a terminal on stdout? |
| 572 | : |
| 573 | else |
| 574 | if test x"\$DISPLAY" != x -a x"\$xterm_loop" = x; then # No, but do we have X? |
| 575 | if xset q > /dev/null 2>&1; then # Check for valid DISPLAY variable |
| 576 | GUESS_XTERMS="xterm gnome-terminal rxvt dtterm eterm Eterm xfce4-terminal lxterminal kvt konsole aterm terminology" |
| 577 | for a in \$GUESS_XTERMS; do |
| 578 | if type \$a >/dev/null 2>&1; then |
| 579 | XTERM=\$a |
| 580 | break |
| 581 | fi |
| 582 | done |
| 583 | chmod a+x \$0 || echo Please add execution rights on \$0 >&2 |
| 584 | if test \`echo "\$0" | cut -c1\` = "/"; then # Spawn a terminal! |
| 585 | exec \$XTERM -e "\$0 --xwin \$initargs" |
| 586 | else |
| 587 | exec \$XTERM -e "./\$0 --xwin \$initargs" |
| 588 | fi |
| 589 | fi |
| 590 | fi |
| 591 | fi |
| 592 | fi |
| 593 | |
| 594 | if test x"\$targetdir" = x.; then |
| 595 | tmpdir="." |
| 596 | else |
| 597 | if test x"\$keep" = xy; then |
| 598 | if test x"\$nooverwrite" = xy && test -d "\$targetdir"; then |
| 599 | echo "Target directory \$targetdir already exists, aborting." >&2 |
| 600 | exit 1 |
| 601 | fi |
| 602 | if test x"\$quiet" = xn; then |
| 603 | echo "Creating directory \$targetdir" >&2 |
| 604 | fi |
| 605 | tmpdir="\$targetdir" |
| 606 | dashp="-p" |
| 607 | else |
| 608 | tmpdir="\$TMPROOT/selfgz\$\$\$RANDOM" |
| 609 | dashp="" |
| 610 | fi |
| 611 | mkdir \$dashp "\$tmpdir" || { |
| 612 | echo 'Cannot create target directory' \$tmpdir >&2 |
| 613 | echo 'You should try option --target dir' >&2 |
| 614 | eval \$finish |
| 615 | exit 1 |
| 616 | } |
| 617 | fi |
| 618 | |
| 619 | location="\`pwd\`" |
| 620 | if test x"\$SETUP_NOCHECK" != x1; then |
| 621 | MS_Check "\$0" |
| 622 | fi |
| 623 | offset=\`head -n "\$skip" "\$0" | wc -c | sed "s/ //g"\` |
| 624 | |
| 625 | if test x"\$verbose" = xy; then |
| 626 | MS_Printf "About to extract $USIZE KB in \$tmpdir ... Proceed ? [Y/n] " |
| 627 | read yn |
| 628 | if test x"\$yn" = xn; then |
| 629 | eval \$finish; exit 1 |
| 630 | fi |
| 631 | fi |
| 632 | |
| 633 | if test x"\$quiet" = xn; then |
| 634 | # Decrypting with openssl will ask for password, |
| 635 | # the prompt needs to start on new line |
| 636 | if test x"$ENCRYPT" = x"openssl"; then |
| 637 | echo "Decrypting and uncompressing \$label..." |
| 638 | else |
| 639 | MS_Printf "Uncompressing \$label" |
| 640 | fi |
| 641 | fi |
| 642 | res=3 |
| 643 | if test x"\$keep" = xn; then |
| 644 | trap MS_cleanup 1 2 3 15 |
| 645 | fi |
| 646 | |
| 647 | if test x"\$nodiskspace" = xn; then |
| 648 | leftspace=\`MS_diskspace "\$tmpdir"\` |
| 649 | if test -n "\$leftspace"; then |
| 650 | if test "\$leftspace" -lt $USIZE; then |
| 651 | echo |
| 652 | echo "Not enough space left in "\`dirname \$tmpdir\`" (\$leftspace KB) to decompress \$0 ($USIZE KB)" >&2 |
| 653 | echo "Use --nodiskspace option to skip this check and proceed anyway" >&2 |
| 654 | if test x"\$keep" = xn; then |
| 655 | echo "Consider setting TMPDIR to a directory with more free space." |
| 656 | fi |
| 657 | eval \$finish; exit 1 |
| 658 | fi |
| 659 | fi |
| 660 | fi |
| 661 | |
| 662 | for s in \$filesizes |
| 663 | do |
| 664 | if MS_dd_Progress "\$0" \$offset \$s | MS_Decompress | ( cd "\$tmpdir"; umask \$ORIG_UMASK ; UnTAR xp ) 1>/dev/null; then |
| 665 | if test x"\$ownership" = xy; then |
| 666 | (cd "\$tmpdir"; chown -R \`id -u\` .; chgrp -R \`id -g\` .) |
| 667 | fi |
| 668 | else |
| 669 | echo >&2 |
| 670 | echo "Unable to decompress \$0" >&2 |
| 671 | eval \$finish; exit 1 |
| 672 | fi |
| 673 | offset=\`expr \$offset + \$s\` |
| 674 | done |
| 675 | if test x"\$quiet" = xn; then |
| 676 | echo |
| 677 | fi |
| 678 | |
| 679 | cd "\$tmpdir" |
| 680 | res=0 |
| 681 | if test x"\$script" != x; then |
| 682 | if test x"\$export_conf" = x"y"; then |
| 683 | MS_BUNDLE="\$0" |
| 684 | MS_LABEL="\$label" |
| 685 | MS_SCRIPT="\$script" |
| 686 | MS_SCRIPTARGS="\$scriptargs" |
| 687 | MS_ARCHDIRNAME="\$archdirname" |
| 688 | MS_KEEP="\$KEEP" |
| 689 | MS_NOOVERWRITE="\$NOOVERWRITE" |
| 690 | MS_COMPRESS="\$COMPRESS" |
| 691 | MS_CLEANUP="\$cleanup" |
| 692 | export MS_BUNDLE MS_LABEL MS_SCRIPT MS_SCRIPTARGS |
| 693 | export MS_ARCHDIRNAME MS_KEEP MS_NOOVERWRITE MS_COMPRESS |
| 694 | fi |
| 695 | |
| 696 | if test x"\$verbose" = x"y"; then |
| 697 | MS_Printf "OK to execute: \$script \$scriptargs \$* ? [Y/n] " |
| 698 | read yn |
| 699 | if test x"\$yn" = x -o x"\$yn" = xy -o x"\$yn" = xY; then |
| 700 | eval "\"\$script\" \$scriptargs \"\\\$@\""; res=\$?; |
| 701 | fi |
| 702 | else |
| 703 | eval "\"\$script\" \$scriptargs \"\\\$@\""; res=\$? |
| 704 | fi |
| 705 | if test "\$res" -ne 0; then |
| 706 | test x"\$verbose" = xy && echo "The program '\$script' returned an error code (\$res)" >&2 |
| 707 | fi |
| 708 | fi |
| 709 | |
| 710 | MS_exec_cleanup |
| 711 | |
| 712 | if test x"\$keep" = xn; then |
| 713 | cd "\$TMPROOT" |
| 714 | rm -rf "\$tmpdir" |
| 715 | fi |
| 716 | eval \$finish; exit \$res |
| 717 | EOF |