71 offset=$((offset + 1)) |
77 offset=$((offset + 1)) |
72 $cat $0 | $tail -n+$offset |
78 $cat $0 | $tail -n+$offset |
73 } |
79 } |
74 |
80 |
75 # Go through each required command, and make sure it's on the system. If not, fail. |
81 # Go through each required command, and make sure it's on the system. If not, fail. |
76 for cmd in bzip2 tar grep tail cat wc dd md5sum; do |
82 for cmd in bzip2 tar grep tail cat wc dd; do |
77 my_which $cmd>/dev/null || exit 1 |
83 my_which $cmd>/dev/null || exit 1 |
78 eval $cmd=`my_which $cmd` |
84 eval $cmd=`my_which $cmd` |
79 if test x$? = x1; then |
85 if test x$? = x1; then |
80 exit 1 |
86 exit 1 |
81 fi |
87 fi |
82 done |
88 done |
|
89 |
|
90 # special case for md5sum |
|
91 if my_which_real md5sum 2>&1 > /dev/null; then |
|
92 md5sum=`my_which_real md5sum` |
|
93 elif my_which_real openssl 2>&1 > /dev/null; then |
|
94 md5sum=md5sum |
|
95 md5sum() |
|
96 { |
|
97 local f=${1:--} |
|
98 cat $f | openssl dgst -md5 | sed -$sedflags 's/^\(stdin\)= //' |
|
99 } |
|
100 else |
|
101 echo "Could not find md5sum or openssl" |
|
102 exit 1 |
|
103 fi |
83 |
104 |
84 tempdir="" |
105 tempdir="" |
85 extractonly=0 |
106 extractonly=0 |
86 while test -n "$1"; do |
107 while test -n "$1"; do |
87 case "$1" in |
108 case "$1" in |
88 -x) |
109 -x) |
89 extractonly=1 |
110 extractonly=1 |
90 if test -n "$2"; then |
111 if test -n "$2"; then |
91 tempdir=$2 |
112 tempdir=$2 |
92 else |
113 else |
93 tempdir=`echo $0 | sed -re 's/\.[a-z0-9_-]{1,5}$//'` |
114 tempdir=`echo $0 | sed -$sedflags 's/\.[a-z0-9_-]{1,5}$//'` |
94 fi |
115 fi |
95 ;; |
116 ;; |
96 esac |
117 esac |
97 shift |
118 shift |
98 done |
119 done |