Advertisement
Guest User

postal fudge pack : linux_installer.sh

a guest
Oct 31st, 2010
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.03 KB | None | 0 0
  1. #!/bin/sh
  2. # This script was generated using Makeself 2.1.4
  3.  
  4. CRCsum="2836821469"
  5. MD5="057d585fac0ac6b4168fa6e181ca435a"
  6. TMPROOT=${TMPDIR:=/tmp}
  7.  
  8. label="The Postal Fudge Pack for x86 GNU/Linux"
  9. script="./setup.sh"
  10. scriptargs=""
  11. targetdir="postal_fudge_pack_installer"
  12. filesizes="23767040"
  13. keep=n
  14.  
  15. print_cmd_arg=""
  16. if type printf > /dev/null; then
  17.     print_cmd="printf"
  18. elif test -x /usr/ucb/echo; then
  19.     print_cmd="/usr/ucb/echo"
  20. else
  21.     print_cmd="echo"
  22. fi
  23.  
  24. unset CDPATH
  25.  
  26. MS_Printf()
  27. {
  28.     $print_cmd $print_cmd_arg "$1"
  29. }
  30.  
  31. MS_Progress()
  32. {
  33.     while read a; do
  34.     MS_Printf .
  35.     done
  36. }
  37.  
  38. MS_dd()
  39. {
  40.     blocks=`expr $3 / 1024`
  41.     bytes=`expr $3 % 1024`
  42.     dd if="$1" ibs=$2 skip=1 obs=1024 conv=sync 2> /dev/null | \
  43.     { test $blocks -gt 0 && dd ibs=1024 obs=1024 count=$blocks ; \
  44.       test $bytes  -gt 0 && dd ibs=1 obs=1024 count=$bytes ; } 2> /dev/null
  45. }
  46.  
  47. MS_Help()
  48. {
  49.     cat << EOH >&2
  50. Makeself version 2.1.4
  51.  1) Getting help or info about $0 :
  52.   $0 --help   Print this message
  53.   $0 --info   Print embedded info : title, default target directory, embedded script ...
  54.   $0 --lsm    Print embedded lsm entry (or no LSM)
  55.   $0 --list   Print the list of files in the archive
  56.   $0 --check  Checks integrity of the archive
  57.  
  58.  2) Running $0 :
  59.   $0 [options] [--] [additional arguments to embedded script]
  60.   with following options (in that order)
  61.   --confirm             Ask before running embedded script
  62.   --noexec              Do not run embedded script
  63.   --keep                Do not erase target directory after running
  64.             the embedded script
  65.   --nox11               Do not spawn an xterm
  66.   --nochown             Do not give the extracted files to the current user
  67.   --target NewDirectory Extract in NewDirectory
  68.   --tar arg1 [arg2 ...] Access the contents of the archive through the tar command
  69.   --                    Following arguments will be passed to the embedded script
  70. EOH
  71. }
  72.  
  73. MS_Check()
  74. {
  75.     OLD_PATH=$PATH
  76.     PATH=${GUESS_MD5_PATH:-"$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"}
  77.     MD5_PATH=`exec 2>&-; which md5sum || type md5sum`
  78.     MD5_PATH=${MD5_PATH:-`exec 2>&-; which md5 || type md5`}
  79.     PATH=$OLD_PATH
  80.     MS_Printf "Verifying archive integrity..."
  81.     offset=`head -n 377 "$1" | wc -c | tr -d " "`
  82.     verb=$2
  83.     i=1
  84.     for s in $filesizes
  85.     do
  86.     crc=`echo $CRCsum | cut -d" " -f$i`
  87.     if test -x "$MD5_PATH"; then
  88.         md5=`echo $MD5 | cut -d" " -f$i`
  89.         if test $md5 = "00000000000000000000000000000000"; then
  90.         test x$verb = xy && echo " $1 does not contain an embedded MD5 checksum." >&2
  91.         else
  92.         md5sum=`MS_dd "$1" $offset $s | "$MD5_PATH" | cut -b-32`;
  93.         if test "$md5sum" != "$md5"; then
  94.             echo "Error in MD5 checksums: $md5sum is different from $md5" >&2
  95.             exit 2
  96.         else
  97.             test x$verb = xy && MS_Printf " MD5 checksums are OK." >&2
  98.         fi
  99.         crc="0000000000"; verb=n
  100.         fi
  101.     fi
  102.     if test $crc = "0000000000"; then
  103.         test x$verb = xy && echo " $1 does not contain a CRC checksum." >&2
  104.     else
  105.         sum1=`MS_dd "$1" $offset $s | CMD_ENV=xpg4 cksum | awk '{print $1}'`
  106.         if test "$sum1" = "$crc"; then
  107.         test x$verb = xy && MS_Printf " CRC checksums are OK." >&2
  108.         else
  109.         echo "Error in checksums: $sum1 is different from $crc"
  110.         exit 2;
  111.         fi
  112.     fi
  113.     i=`expr $i + 1`
  114.     offset=`expr $offset + $s`
  115.     done
  116.     echo " All good."
  117. }
  118.  
  119. UnTAR()
  120. {
  121.     tar $1vf - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 $$; }
  122. }
  123.  
  124. finish=true
  125. xterm_loop=
  126. nox11=n
  127. copy=copy
  128. ownership=y
  129. verbose=n
  130.  
  131. initargs="$@"
  132.  
  133. while true
  134. do
  135.     case "$1" in
  136.     -h | --help)
  137.     MS_Help
  138.     exit 0
  139.     ;;
  140.     --info)
  141.     echo Identification: "$label"
  142.     echo Target directory: "$targetdir"
  143.     echo Uncompressed size: 23392 KB
  144.     echo Compression: none
  145.     echo Date of packaging: Thu Oct 12 10:07:23 EDT 2006
  146.     echo Built with Makeself version 2.1.4 on linux-gnu
  147.     echo Build command was: "/home/icculus/projects/loki_setup.cvs/loki_setup/makeself/makeself.sh \\
  148.    \"--nocomp\" \\
  149.    \"--copy\" \\
  150.    \"postal_fudge_pack_installer\" \\
  151.    \"linux_installer.sh\" \\
  152.    \"The Postal Fudge Pack for x86 GNU/Linux\" \\
  153.    \"./setup.sh\""
  154.     if test x$script != x; then
  155.         echo Script run after extraction:
  156.         echo "    " $script $scriptargs
  157.     fi
  158.     if test x"" = xcopy; then
  159.         echo "Archive will copy itself to a temporary location"
  160.     fi
  161.     if test x"n" = xy; then
  162.         echo "directory $targetdir is permanent"
  163.     else
  164.         echo "$targetdir will be removed after extraction"
  165.     fi
  166.     exit 0
  167.     ;;
  168.     --dumpconf)
  169.     echo LABEL=\"$label\"
  170.     echo SCRIPT=\"$script\"
  171.     echo SCRIPTARGS=\"$scriptargs\"
  172.     echo archdirname=\"postal_fudge_pack_installer\"
  173.     echo KEEP=n
  174.     echo COMPRESS=none
  175.     echo filesizes=\"$filesizes\"
  176.     echo CRCsum=\"$CRCsum\"
  177.     echo MD5sum=\"$MD5\"
  178.     echo OLDUSIZE=23392
  179.     echo OLDSKIP=378
  180.     exit 0
  181.     ;;
  182.     --lsm)
  183. cat << EOLSM
  184. No LSM.
  185. EOLSM
  186.     exit 0
  187.     ;;
  188.     --list)
  189.     echo Target directory: $targetdir
  190.     offset=`head -n 377 "$0" | wc -c | tr -d " "`
  191.     for s in $filesizes
  192.     do
  193.         MS_dd "$0" $offset $s | eval "cat" | UnTAR t
  194.         offset=`expr $offset + $s`
  195.     done
  196.     exit 0
  197.     ;;
  198.     --tar)
  199.     offset=`head -n 377 "$0" | wc -c | tr -d " "`
  200.     arg1="$2"
  201.     shift 2
  202.     for s in $filesizes
  203.     do
  204.         MS_dd "$0" $offset $s | eval "cat" | tar "$arg1" - $*
  205.         offset=`expr $offset + $s`
  206.     done
  207.     exit 0
  208.     ;;
  209.     --check)
  210.     MS_Check "$0" y
  211.     exit 0
  212.     ;;
  213.     --confirm)
  214.     verbose=y
  215.     shift
  216.     ;;
  217.     --noexec)
  218.     script=""
  219.     shift
  220.     ;;
  221.     --keep)
  222.     keep=y
  223.     shift
  224.     ;;
  225.     --target)
  226.     keep=y
  227.     targetdir=${2:-.}
  228.     shift 2
  229.     ;;
  230.     --nox11)
  231.     nox11=y
  232.     shift
  233.     ;;
  234.     --nochown)
  235.     ownership=n
  236.     shift
  237.     ;;
  238.     --xwin)
  239.     finish="echo Press Return to close this window...; read junk"
  240.     xterm_loop=1
  241.     shift
  242.     ;;
  243.     --phase2)
  244.     copy=phase2
  245.     shift
  246.     ;;
  247.     --)
  248.     shift
  249.     break ;;
  250.     -*)
  251.     echo Unrecognized flag : "$1" >&2
  252.     MS_Help
  253.     exit 1
  254.     ;;
  255.     *)
  256.     break ;;
  257.     esac
  258. done
  259.  
  260. case "$copy" in
  261. copy)
  262.     tmpdir=$TMPROOT/makeself.$RANDOM.`date +"%y%m%d%H%M%S"`.$$
  263.     mkdir "$tmpdir" || {
  264.     echo "Could not create temporary directory $tmpdir" >&2
  265.     exit 1
  266.     }
  267.     SCRIPT_COPY="$tmpdir/makeself"
  268.     echo "Copying to a temporary location..." >&2
  269.     cp "$0" "$SCRIPT_COPY"
  270.     chmod +x "$SCRIPT_COPY"
  271.     cd "$TMPROOT"
  272.     exec "$SCRIPT_COPY" --phase2
  273.     ;;
  274. phase2)
  275.     finish="$finish ; rm -rf `dirname $0`"
  276.     ;;
  277. esac
  278.  
  279. if test "$nox11" = "n"; then
  280.     if tty -s; then                 # Do we have a terminal?
  281.     :
  282.     else
  283.         if test x"$DISPLAY" != x -a x"$xterm_loop" = x; then  # No, but do we have X?
  284.             if xset q > /dev/null 2>&1; then # Check for valid DISPLAY variable
  285.                 GUESS_XTERMS="xterm rxvt dtterm eterm Eterm kvt konsole aterm"
  286.                 for a in $GUESS_XTERMS; do
  287.                     if type $a >/dev/null 2>&1; then
  288.                         XTERM=$a
  289.                         break
  290.                     fi
  291.                 done
  292.                 chmod a+x $0 || echo Please add execution rights on $0
  293.                 if test `echo "$0" | cut -c1` = "/"; then # Spawn a terminal!
  294.                     exec $XTERM -title "$label" -e "$0" --xwin "$initargs"
  295.                 else
  296.                     exec $XTERM -title "$label" -e "./$0" --xwin "$initargs"
  297.                 fi
  298.             fi
  299.         fi
  300.     fi
  301. fi
  302.  
  303. if test "$targetdir" = "."; then
  304.     tmpdir="."
  305. else
  306.     if test "$keep" = y; then
  307.     echo "Creating directory $targetdir" >&2
  308.     tmpdir="$targetdir"
  309.     dashp="-p"
  310.     else
  311.     tmpdir="$TMPROOT/selfgz$$$RANDOM"
  312.     dashp=""
  313.     fi
  314.     mkdir $dashp $tmpdir || {
  315.     echo 'Cannot create target directory' $tmpdir >&2
  316.     echo 'You should try option --target OtherDirectory' >&2
  317.     eval $finish
  318.     exit 1
  319.     }
  320. fi
  321.  
  322. location="`pwd`"
  323. if test x$SETUP_NOCHECK != x1; then
  324.     MS_Check "$0"
  325. fi
  326. offset=`head -n 377 "$0" | wc -c | tr -d " "`
  327.  
  328. if test x"$verbose" = xy; then
  329.     MS_Printf "About to extract 23392 KB in $tmpdir ... Proceed ? [Y/n] "
  330.     read yn
  331.     if test x"$yn" = xn; then
  332.         eval $finish; exit 1
  333.     fi
  334. fi
  335.  
  336. MS_Printf "Uncompressing $label"
  337. res=3
  338. if test "$keep" = n; then
  339.     trap 'echo Signal caught, cleaning up >&2; cd $TMPROOT; /bin/rm -rf $tmpdir; eval $finish; exit 15' 1 2 3 15
  340. fi
  341.  
  342. for s in $filesizes
  343. do
  344.     if MS_dd "$0" $offset $s | eval "cat" | ( cd "$tmpdir"; UnTAR x ) | MS_Progress; then
  345.         if test x"$ownership" = xy; then
  346.             (PATH=/usr/xpg4/bin:$PATH; cd "$tmpdir"; chown -R `id -u` .;  chgrp -R `id -g` .)
  347.         fi
  348.     else
  349.         echo
  350.         echo "Unable to decompress $0" >&2
  351.         eval $finish; exit 1
  352.     fi
  353.     offset=`expr $offset + $s`
  354. done
  355. echo
  356.  
  357. cd "$tmpdir"
  358. res=0
  359. if test x"$script" != x; then
  360.     if test x"$verbose" = xy; then
  361.         MS_Printf "OK to execute: $script $scriptargs $* ? [Y/n] "
  362.         read yn
  363.         if test x"$yn" = x -o x"$yn" = xy -o x"$yn" = xY; then
  364.             eval $script $scriptargs $*; res=$?;
  365.         fi
  366.     else
  367.         eval $script $scriptargs $*; res=$?
  368.     fi
  369.     if test $res -ne 0; then
  370.         test x"$verbose" = xy && echo "The program '$script' returned an error code ($res)" >&2
  371.     fi
  372. fi
  373. if test "$keep" = n; then
  374.     cd $TMPROOT
  375.     /bin/rm -rf $tmpdir
  376. fi
  377. eval $finish; exit $res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement