-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mkinitramfs-ll.{ba,z}sh: 0.15.0 version bump (minor clean up)
- Loading branch information
1 parent
28a4b12
commit 0a35f8b
Showing
2 changed files
with
45 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,14 @@ | |
# $Header: mkinitramfs-ll/mkinitramfs-ll.bash Exp $ | ||
# $Author: (c) 2011-2014 -tclover <[email protected]> Exp $ | ||
# $License: 2-clause/new/simplified BSD Exp $ | ||
# $Version: 0.14.4 2014/10/10 12:33:03 Exp $ | ||
# $Version: 0.15.0 2014/12/30 12:33:03 Exp $ | ||
# | ||
|
||
typeset -A PKG | ||
PKG=( | ||
[name]=mkinitramfs-ll | ||
[shell]=bash | ||
[version]=0.14.4 | ||
[version]=0.15.0 | ||
) | ||
|
||
# @FUNCTION: usage | ||
|
@@ -208,6 +208,9 @@ fi | |
# @DESCRIPTION: tmp dir where to generate initramfs | ||
# an initramfs compressed image | ||
opts[-tmpdir]="$(mktmp ${opts[-initramfs]})" | ||
# @VARIABLE: opts[-confdir] | ||
# @DESCRIPTION: configuration directory | ||
opts[-confdir]="etc/${PKG[name]}" | ||
|
||
declare -a compressor | ||
compressor=(bzip2 gzip lzip lzop lz4 xz) | ||
|
@@ -278,7 +281,7 @@ pushd "${opts[-tmpdir]}" || die "${opts[-tmpdir]} not found" | |
if [[ "${opts[-r]}" ]] || [[ "${opts[-regen]}" ]]; then | ||
cp -af {${opts[-usrdir]}/,}lib/${PKG[name]}/functions && | ||
cp -af ${opts[-usrdir]}/../init . && chmod 775 init || die | ||
docpio "${opts[-initramfs]}" || die | ||
docpio || die | ||
echo ">>> regenerated ${opts[-initramfs]}..." && exit | ||
else | ||
rm -fr * | ||
|
@@ -304,7 +307,7 @@ ln -sf lib{${opts[-arc]},} && | |
echo "${key}=${PKG[$key]}" | ||
done | ||
echo "build=$(date +%Y-%m-%d-%H-%M-%S)" | ||
} >etc/${PKG[name]}/id | ||
} >${opts[-confdir]}/id | ||
touch etc/{fs,m}tab | ||
|
||
cp -a /dev/{console,random,urandom,mem,null,tty{,[0-6]},zero} dev/ || donod | ||
|
@@ -361,7 +364,7 @@ if [[ -x usr/bin/busybox ]]; then | |
elif type -p busybox >/dev/null; then | ||
bb=$(type -p busybox) | ||
if ldd ${bb} >/dev/null; then | ||
busybox --list-full >etc/${PKG[name]}/busybox.applets | ||
busybox --list-full >${opts[-confdir]}/busybox.applets | ||
opts[-bin]+=:${bb} | ||
warn "busybox is not a static binary" | ||
fi | ||
|
@@ -371,22 +374,22 @@ else | |
die "no busybox binary found" | ||
fi | ||
|
||
if [[ ! -f etc/${PKG[name]}/busybox.applets ]]; then | ||
bin/busybox --list-full >etc/${PKG[name]}/busybox.applets || die | ||
if [[ ! -f ${opts[-confdir]}/busybox.applets ]]; then | ||
bin/busybox --list-full >${opts[-confdir]}/busybox.applets || die | ||
fi | ||
|
||
while read line; do | ||
grep -q ${line} etc/${PKG[name]}/busybox.applets || | ||
grep -q ${line} ${opts[-confdir]}/busybox.applets || | ||
die "${line} applet not found, no suitable busybox found" | ||
done <etc/${PKG[name]}/minimal.applets | ||
done <${opts[-confdir]}/minimal.applets | ||
|
||
pushd bin || die | ||
for applet in $(grep '^bin' ../etc/${PKG[name]}/busybox.applets); do | ||
for applet in $(grep '^bin' ../${opts[-confdir]}/busybox.applets); do | ||
ln -s busybox ${applet#bin/} | ||
done | ||
popd | ||
pushd sbin || die | ||
for applet in $(grep '^sbin' ../etc/${PKG[name]}/busybox.applets); do | ||
for applet in $(grep '^sbin' ../${opts[-confdir]}/busybox.applets); do | ||
ln -s ../bin/busybox ${applet#sbin/} | ||
done | ||
popd | ||
|
@@ -460,16 +463,16 @@ for keymap in ${opts[-y]//:/ } ${opts[-keymap]//:/ }; do | |
fi | ||
(( $? == 0 )) && KEYMAP+=(${keymap}-${opts[-arch]}.bin) | ||
done | ||
echo "${KEYMAP[0]}" > etc/${PKG[name]}/kmap | ||
unset KEYMAP | ||
echo "${KEYMAP[0]}" >${opts[-confdir]}/kmap | ||
unset KEYMAP keymap | ||
|
||
declare -a FONT | ||
for font in ${opts[-f]//:/ } ${opts[-font]//:/ }; do | ||
if [[ -f usr/share/consolefonts/${font} ]]; then :; | ||
elif [[ -f ${font} ]]; then | ||
cp -a ${font} usr/share/consolefonts/ | ||
else | ||
for file in $(ls /usr/share/consolefonts/${font}*.gz); do | ||
for file in /usr/share/consolefonts/${font}*.gz; do | ||
if [[ -f ${file} ]]; then | ||
cp ${file} . | ||
gzip -d ${file##*/} | ||
|
@@ -479,9 +482,8 @@ for font in ${opts[-f]//:/ } ${opts[-font]//:/ }; do | |
fi | ||
(( $? == 0 )) && FONT+=(${font}) | ||
done | ||
echo "${FONT[0]}" > etc/${PKG[name]}/font | ||
unset FONT | ||
|
||
echo "${FONT[0]}" >${opts[-confdir]}/font | ||
unset FONT font | ||
|
||
if [[ "${opts[-s]}" ]] || [[ "${opts[-splash]}" ]]; then | ||
opts[-bin]+=:splash_util.static:fbcondecor_helper | ||
|
@@ -543,28 +545,28 @@ for bin in ${opts[-b]//:/ } ${opts[-bin]//:/ }; do | |
[[ "${binary}" ]] && dobin ${binary} || warn "no ${bin} binary found" | ||
binary= | ||
done | ||
unset binary | ||
unset binary bin b | ||
|
||
domod ${opts[-m]//:/ } ${opts[-kmod]//:/ } | ||
|
||
# Remove module group name from boot group before processing module groups | ||
for mod in ${opts[-mboot]//:/ }; do | ||
if [[ "${opts[-m$mod]}" ]]; then | ||
echo "${mod}" >> etc/${PKG[name]}/boot | ||
echo "${mod}" >> ${opts[-confdir]}/boot | ||
else | ||
mboot+=":${mod}" | ||
fi | ||
done | ||
opts[-mboot]="${mboot}" | ||
unset mboot | ||
unset mboot mod | ||
|
||
for grp in ${opts[-mgrp]//:/ }; do | ||
domod -v etc/${PKG[name]}/${grp} ${opts[-m${grp}]//:/ } | ||
domod -v ${opts[-confdir]}/${grp} ${opts[-m${grp}]//:/ } | ||
done | ||
|
||
# Set up user environment if present | ||
for (( i=0; i < ${#env[@]}; i++ )); do | ||
echo "${env[i]}" >> etc/${PKG[name]}/env | ||
echo "${env[i]}" >> ${opts[-confdir]}/env | ||
done | ||
unset env | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,14 @@ | |
# $Header: mkinitramfs-ll/mkinitramfs-ll.zsh Exp $ | ||
# $Author: (c) 2011-2014 -tclover <[email protected]> Exp $ | ||
# $License: 2-clause/new/simplified BSD Exp $ | ||
# $Version: 0.14.4 2014/10/10 12:33:03 Exp $ | ||
# $Version: 0.15.0 2014/12/30 12:33:03 Exp $ | ||
# | ||
|
||
typeset -A PKG | ||
PKG=( | ||
name mkinitramfs-ll | ||
shell zsh | ||
version 0.14.4 | ||
version 0.15.0 | ||
) | ||
|
||
# @FUNCTION: usage | ||
|
@@ -198,6 +198,9 @@ if [[ -f "${PKG[name]}".conf ]] { | |
# @DESCRIPTION: tmp dir where to generate initramfs | ||
# an initramfs compressed image | ||
: ${opts[-tmpdir]:=$(mktmp ${opts[-initramfs]:t})} | ||
# @VARIABLE: opts[-confdir] | ||
# @DESCRIPTION: configuration directory | ||
: ${opts[-confdir]=etc/${PKG[name]}} | ||
|
||
typeset -a compressor | ||
compressor=(bzip2 gzip lzip lzop lz4 xz) | ||
|
@@ -263,7 +266,7 @@ pushd ${opts[-tmpdir]} || die "no ${opts[-tmpdir]} tmpdir found" | |
if (( ${+opts[-r]} )) || (( ${+opts[-rebuild]} )) { | ||
cp -af {${opts[-usrdir]}/,}lib/${PKG[name]}/functions && | ||
cp -af ${opts[-usrdir]}/../init . && chmod 775 init || die | ||
docpio ${opts[-initramfs]} || die | ||
docpio || die | ||
print -P "%F{green}>>> regenerated ${opts[-initramfs]}...%f" && exit | ||
} else { | ||
rm -fr * | ||
|
@@ -287,7 +290,7 @@ ln -sf lib{${opts[-arc]},} && | |
{ | ||
for key (${(k)PKG[@]}) print "${key}=${PKG[$key]}" | ||
print "build=$(date +%Y-%m-%d-%H-%M-%S)" | ||
} >etc/${PKG[name]}/id | ||
} >${opts[-confdir]}/id | ||
touch etc/{fs,m}tab | ||
|
||
cp -a /dev/{console,random,urandom,mem,null,tty{,[0-6]},zero} dev/ || donod | ||
|
@@ -341,23 +344,23 @@ if [[ -x usr/bin/busybox ]] { | |
mv -f {usr/,}bin/busybox | ||
} elif (( ${+commands[busybox]} )) { | ||
if (ldd ${commands[busybox]} >/dev/null) { | ||
busybox --list-full >etc/${PKG[name]}/busybox.applets | ||
busybox --list-full >${opts[-confdir]}/busybox.applets | ||
opts[-bin]+=:${commands[busybox]} | ||
warn "busybox is not a static binary" | ||
} | ||
cp -a ${commands[busybox]} bin/ | ||
} else { die "no busybox binary found" } | ||
|
||
if [[ ! -f etc/${PKG[name]}/busybox.applets ]] { | ||
bin/busybox --list-full >etc/${PKG[name]}/busybox.applets || die | ||
if [[ ! -f ${opts[-confdir]}/busybox.applets ]] { | ||
bin/busybox --list-full >${opts[-confdir]}/busybox.applets || die | ||
} | ||
|
||
pushd bin || die | ||
for applet ($(grep '^bin' ../etc/${PKG[name]}/busybox.applets)) | ||
for applet ($(grep '^bin' ../${opts[-confdir]}/busybox.applets)) | ||
ln -s busybox ${applet:t} | ||
popd | ||
pushd sbin || die | ||
for applet ($(grep '^sbin' ../etc/${PKG[name]}/busybox.applets)) | ||
for applet ($(grep '^sbin' ../${opts[-confdir]}/busybox.applets)) | ||
ln -s ../bin/busybox ${applet:t} | ||
popd | ||
|
||
|
@@ -427,8 +430,8 @@ for keymap (${(pws,:,)opts[-y]} ${(pws,:,)opts[-keymap]}) { | |
} | ||
(( $? == 0 )) && KEYMAP+=(${keymap}-${opts[-arch]}.bin) | ||
} | ||
print ${KEYMAP[1]} > etc/${PKG[name]}/kmap | ||
unset KEYMAP | ||
print ${KEYMAP[1]} >${opts[-confdir]}/kmap | ||
unset KEYMAP keymap | ||
|
||
typeset -a FONT | ||
for font (${(pws,:,)opts[-f]} ${(pws,:,)opts[-font]}) { | ||
|
@@ -445,8 +448,8 @@ for font (${(pws,:,)opts[-f]} ${(pws,:,)opts[-font]}) { | |
} | ||
(( $? == 0 )) && FONT+=(${font}) | ||
} | ||
print ${FONT[1]} > etc/${PKG[name]}/font | ||
unset FONT | ||
print ${FONT[1]} >${opts[-confdir]}/font | ||
unset FONT font | ||
|
||
if (( ${+$opts[-s]} )) || (( ${+opts[-splash]} )) { | ||
opts[-bin]+=:splash_util.static:fbcondecor_helper | ||
|
@@ -504,23 +507,23 @@ for bin (${(pws,:,)opts[-b]} ${(pws,:,)opts[-bin]}) { | |
[[ -n ${binary} ]] && dobin ${binary} || warn "no ${bin} binary found" | ||
binary= | ||
} | ||
unset -v binary | ||
unset -v binary bin b | ||
|
||
# Remove module group name from boot group before processing module groups | ||
for mod (${(pws,:,)opts[-mboot]}) | ||
if (( ${+opts[-m$mod]} )) { | ||
print ${mod} >> etc/${PKG[name]}/boot | ||
print ${mod} >>${opts[-confdir]}/boot | ||
} else { mboot+=:${mod} } | ||
opts[-mboot]=${mboot} | ||
unset mboot | ||
unset mboot mod | ||
|
||
for module (${(pws,:,)opts[-m]}${(pws,:,)opts[-kmod]}) domod ${module} | ||
for grp (${(pws,:,)opts[-mgrp]}) | ||
domod -v etc/${PKG[name]}/${grp} ${(pws,:,)opts[-m${grp}]} | ||
domod -v ${opts[-confdir]}/${grp} ${(pws,:,)opts[-m${grp}]} | ||
|
||
# Set up user environment if present | ||
for (( i=1; i <= ${#env[@]}; i++ )) | ||
print ${env[i]} >> etc/${PKG[name]}/env | ||
print ${env[i]} >>${opts[-confdir]}/env | ||
unset env | ||
|
||
for lib (usr/lib/gcc/**/lib*.so*(.N)) { | ||
|