Lines 29-34
Link Here
|
29 |
-c, --copy=DIR copy all necessary files into the specified directory; |
29 |
-c, --copy=DIR copy all necessary files into the specified directory; |
30 |
DIR should point to the root directory of an initramfs |
30 |
DIR should point to the root directory of an initramfs |
31 |
-o, --overlay=DIR include the contents of DIR in the initramfs image |
31 |
-o, --overlay=DIR include the contents of DIR in the initramfs image |
|
|
32 |
-z, --compress=ZIP use compression method ZIP (either of gzip, bzip2, xz) |
32 |
-h, --help show this help message |
33 |
-h, --help show this help message |
33 |
|
34 |
|
34 |
Options: |
35 |
Options: |
Lines 62-67
Link Here
|
62 |
|
63 |
|
63 |
themedir="//etc/splash" |
64 |
themedir="//etc/splash" |
64 |
declare -a themes |
65 |
declare -a themes |
|
|
66 |
compress=$(type -p gzip) |
65 |
mode="h" |
67 |
mode="h" |
66 |
splash_hlp="//sbin/fbcondecor_helper" |
68 |
splash_hlp="//sbin/fbcondecor_helper" |
67 |
res="" |
69 |
res="" |
Lines 71-77
Link Here
|
71 |
no8bpp=0 |
73 |
no8bpp=0 |
72 |
|
74 |
|
73 |
args="$@" |
75 |
args="$@" |
74 |
temp=`getopt -l no8bpp,all,generate:,append:,copy:,overlay:,help,verbose,res: a:g:c:r:o:hv "$@"` |
76 |
temp=`getopt -l no8bpp,all,generate:,append:,copy:,overlay:,help,verbose,res:,compress: a:g:c:r:o:z:hv "$@"` |
75 |
|
77 |
|
76 |
if [ $? != 0 ]; then |
78 |
if [ $? != 0 ]; then |
77 |
usage; exit 2 |
79 |
usage; exit 2 |
Lines 81-95
Link Here
|
81 |
|
83 |
|
82 |
for i ; do |
84 |
for i ; do |
83 |
case "$i" in |
85 |
case "$i" in |
84 |
-a|--append) mode='a'; img="$2"; shift; shift;; |
86 |
-a|--append) mode='a'; img="$2"; shift 2;; |
85 |
-g|--generate) mode='g'; img="$2"; shift; shift;; |
87 |
-g|--generate) mode='g'; img="$2"; shift 2;; |
86 |
-c|--copy) mode='c'; destdir="$2"; shift; shift;; |
88 |
-c|--copy) mode='c'; destdir="$2"; shift 2;; |
87 |
-h|--help) usage; exit 2;; |
89 |
-h|--help) usage; exit 2;; |
88 |
-r|--res) res=${2/,/ }; shift; shift;; |
90 |
-r|--res) res=${2/,/ }; shift 2;; |
89 |
-v|--verbose) verbose=$(($verbose + 1)); shift;; |
91 |
-v|--verbose) verbose=$(($verbose + 1)); shift;; |
90 |
-o|--overlay) overlay="$2"; shift; shift;; |
92 |
-o|--overlay) overlay="$2"; shift 2;; |
91 |
--no8bpp) no8bpp=1; shift;; |
93 |
-z|--compress) case "$2" in |
92 |
--) shift; break;; |
94 |
xz|bzip2|gzip) compress=$(type -p $2) || \ |
|
|
95 |
(echo "Compression type $2 not available." && exit 6);; |
96 |
*) echo "Unsupported compression type $2."; exit 7;; |
97 |
esac; shift 2;; |
98 |
--no8bpp) no8bpp=1; shift;; |
99 |
--) shift; break;; |
93 |
--all) |
100 |
--all) |
94 |
shift; |
101 |
shift; |
95 |
for i in ${themedir}/* ; do |
102 |
for i in ${themedir}/* ; do |
Lines 144-150
Link Here
|
144 |
if [ "$mode" == "a" ]; then |
151 |
if [ "$mode" == "a" ]; then |
145 |
printv "o Unpacking $img.." |
152 |
printv "o Unpacking $img.." |
146 |
cp "$img" "${imgdir}" |
153 |
cp "$img" "${imgdir}" |
147 |
(cd "${imgdir}"; (gunzip -c "$(basename $img)" 2>/dev/null || cat "$(basename $img)") | cpio -idm --no-absolute-filenames --quiet -H newc) |
154 |
(cd "${imgdir}"; ($compress -dc "$(basename $img)" 2>/dev/null || cat "$(basename $img)") | cpio -idm --no-absolute-filenames --quiet -H newc) |
148 |
rm -f "${imgdir}/$(basename $img)" |
155 |
rm -f "${imgdir}/$(basename $img)" |
149 |
fi |
156 |
fi |
150 |
|
157 |
|
Lines 234-240
Link Here
|
234 |
|
241 |
|
235 |
printv "o Creating initramfs image.." |
242 |
printv "o Creating initramfs image.." |
236 |
if [ "$mode" == "g" ] || [ "$mode" == "a" ]; then |
243 |
if [ "$mode" == "g" ] || [ "$mode" == "a" ]; then |
237 |
(cd "${imgdir}" ; find . | cpio --quiet -o -H newc | gzip -9 >../img.cpio.gz) |
244 |
(cd "${imgdir}" ; find . | cpio --quiet -o -H newc | $compress -9 >../img.cpio.gz) && \ |
238 |
mv "${workdir}/img.cpio.gz" "${img}" |
245 |
mv "${workdir}/img.cpio.gz" "${img}" |
239 |
fi |
246 |
fi |
240 |
|
247 |
|