summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2008-07-29 15:22:38 -0400
committerPeter Jones <pjones@pjones2.localdomain>2008-07-29 15:27:20 -0400
commitc01d237689f1e76fdaf77f6b8fd0149b362b9293 (patch)
tree15fe6216ea42cb826e757b5ad7bc42eb2baac574
parentb7dd9dcb77b808fbd3eecb8f19e3b0cb3c6ae629 (diff)
downloadplymouth-c01d237689f1e76fdaf77f6b8fd0149b362b9293.tar.gz
plymouth-c01d237689f1e76fdaf77f6b8fd0149b362b9293.tar.xz
plymouth-c01d237689f1e76fdaf77f6b8fd0149b362b9293.zip
Make plymouth-populate-initrd use utility functions from mkinitrd
-rwxr-xr-xscripts/plymouth-populate-initrd.in137
1 files changed, 56 insertions, 81 deletions
diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in
index e4ccded..e584ee6 100755
--- a/scripts/plymouth-populate-initrd.in
+++ b/scripts/plymouth-populate-initrd.in
@@ -13,111 +13,86 @@ set -e
[ -z "$GRUB_MENU_TITLE" ] && GRUB_MENU_TITLE="Graphical Bootup"
[ -z "$PLYMOUTH_LOGO_FILE" ] && PLYMOUTH_LOGO_FILE="@logofile@"
-INITRDDIR=$1 && shift
-if [ -z "$INITRDDIR" ]; then
- echo "usage: plymouth <initrd_directory>" 1>&2
- exit 1
+if [ -f "${LIBEXECDIR}/initrd-functions" ]; then
+ . "${LIBEXECDIR}/initrd-functions"
+else
+ echo "Couldn't import initrd functions." > /dev/stderr
+ exit 1
fi
-RTLD=""
-function get_dso_deps() {
- bin="$1" ; shift
-
- declare -a FILES
- declare -a NAMES
-
- LDSO=$(echo nash-showelfinterp $bin | /sbin/nash --forcequiet)
- [ -z "$LDSO" -o "$LDSO" == "$bin" ] && LDSO="$RTLD"
- [ -z "$LDSO" -o "$LDSO" == "$bin" ] && return 1
- [ -z "$RTLD" ] && RTLD="$LDSO"
-
- # I hate shell.
- declare -i n=0
- while read NAME I0 FILE ADDR I1 ; do
- [ "$FILE" == "not" ] && FILE="$FILE $ADDR"
- NAMES[$n]="$NAME"
- FILES[$n]="$FILE"
- let n++
- done << EOF
- $(LD_TRACE_PRELINKING=1 LD_WARN= LD_TRACE_LOADED_OBJECTS=1 \
- $LDSO $bin 2>/dev/null)
-EOF
-
- [ ${#FILES[*]} -eq 0 ] && return 1
-
- # we don't want the name of the binary in the list
- if [ "${FILES[0]}" == "$bin" ]; then
- FILES[0]=""
- NAMES[0]=""
- [ ${#FILES[*]} -eq 1 ] && return 1
+function usage() {
+ local output="/dev/stdout"
+ local rc=0
+ if [ "$1" == "error" ]; then
+ output="/dev/stderr"
+ rc=1
fi
- declare -i n=0
- while [ $n -lt ${#FILES[*]} ]; do
- FILE="${FILES[$n]}"
- if [ "$FILE" == "not found" ]; then
- cat 1>&2 <<EOF
-There are missing files on your system. The dynamic object $bin
-requires ${NAMES[$n]} n order to properly function. mkinitrd cannot continue.
-EOF
- exit 1
- fi
- case "$FILE" in
- /lib*)
- TLIBDIR=`echo "$FILE" | sed 's,\(/lib[^/]*\)/.*$,\1,'`
- BASE=`basename "$FILE"`
- # Prefer nosegneg libs over direct segment accesses on i686.
- if [ -f "$TLIBDIR/i686/nosegneg/$BASE" ]; then
- FILE="$TLIBDIR/i686/nosegneg/$BASE"
- # Otherwise, prefer base libraries rather than their optimized
- # variants.
- elif [ -f "$TLIBDIR/$BASE" ]; then
- FILE="$TLIBDIR/$BASE"
- fi
- FILES[$n]="$FILE"
- ;;
- esac
- dynamic="yes"
- let n++
- done
-
- echo "${FILES[@]}"
+ echo "usage: plymouth [ --verbose | -v ] { --targetdir | -t } <initrd_directory>" > $output
+ exit $rc
}
+verbose=false
+INITRDDIR=""
+while [ $# -gt 0 ]; do
+ case $1 in
+ --verbose|-v)
+ verbose=true
+ ;;
+ --targetdir|-t)
+ shift
+ INITRDDIR="$1"
+ ;;
+ --help|-h)
+ usage normal
+ ;;
+ *)
+ usage error
+ break
+ ;;
+ esac
+ shift
+done
+set_verbose $verbose
+
+[ -z "$INITRDDIR" ] && usage error
+
(cd $LIBDIR
BINS="${LIBEXECDIR}/plymouth/plymouthd ${BINDIR}/plymouth ${LIBDIR}/plymouth/spinfinity.so ${LIBDIR}/plymouth/text.so ${LIBDIR}/plymouth/details.so"
for bin in $BINS ; do
DEPS=$(get_dso_deps $bin)
for dep in $DEPS; do
- install -D -m755 $dep ${INITRDDIR}$(dirname $dep)
+ inst $dep $INITRDDIR
done
done
)
-install -m755 ${LIBEXECDIR}/plymouth/plymouthd ${INITRDDIR}/bin
-install -m755 ${BINDIR}/plymouth ${INITRDDIR}/bin
-mkdir -p ${INITRDDIR}${LIBDIR}/plymouth
-install -m755 ${LIBDIR}/plymouth/text.so ${INITRDDIR}${LIBDIR}/plymouth
-install -m755 ${LIBDIR}/plymouth/details.so ${INITRDDIR}${LIBDIR}/plymouth
-install -D -m644 ${PLYMOUTH_LOGO_FILE} ${INITRDDIR}${PLYMOUTH_LOGO_FILE}
+inst ${LIBEXECDIR}/plymouth/plymouthd $INITRDDIR /bin/plymouthd
+inst ${BINDIR}/plymouth $INITRDDIR
+inst ${LIBDIR}/plymouth/text.so $INITRDDIR
+inst ${LIBDIR}/plymouth/details.so $INITRDDIR
+inst ${PLYMOUH_LOGO_FILE} $INITRDDIR
mkdir -p ${INITRDDIR}${DATADIR}/plymouth
-
PLUGIN_NAME=$(plymouth-set-default-plugin)
if [ -z "$PLUGIN_NAME" ]; then
- echo "No default plymouth plugin is set" > /dev/stderr
- exit 1
+ echo "No default plymouth plugin is set" > /dev/stderr
+ exit 1
fi
if [ ! -f ${LIBDIR}/plymouth/${PLUGIN_NAME}.so ]; then
- echo "The default plymouth plugin (${PLUGIN_NAME}) doesn't exist" > /dev/stderr
- exit 1
+ echo "The default plymouth plugin (${PLUGIN_NAME}) doesn't exist" > /dev/stderr
+ exit 1
fi
-install -m755 ${LIBDIR}/plymouth/${PLUGIN_NAME}.so ${INITRDDIR}${LIBDIR}/plymouth
-(cd ${INITRDDIR}${LIBDIR}/plymouth; ln -sf ${PLUGIN_NAME}.so default.so)
+inst ${LIBDIR}/plymouth/${PLUGIN_NAME}.so $INITRDDIR
+inst ${LIBDIR}/plymouth/default.so $INITRDIR
if [ -d ${DATADIR}/plymouth/${PLUGIN_NAME} ]; then
- mkdir -p ${INITRDDIR}${DATADIR}/plymouth/${PLUGIN_NAME}
- install -D -m644 ${DATADIR}/plymouth/${PLUGIN_NAME}/* ${INITRDDIR}${DATADIR}/plymouth/${PLUGIN_NAME}
+ for x in ${DATADIR}/plymouth/${PLUGIN_NAME}/* ; do
+ [ ! -f "$x" ] && break
+ inst $x $INITRDDIR
+ done
fi
+
+# vim:ts=8:sw=4:sts=4:et