mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
applets: Add installation of individual binaries
Adding support to install individual binaries if the option is enabled. This also installs the shared libbusybox.so.* library. Signed-off-by: Clayton Shotwell <clshotwe@rockwellcollins.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
c9091d8947
commit
b7ee7e1e13
@ -28,6 +28,10 @@ ifeq ($(CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER),y)
|
|||||||
INSTALL_OPTS:= --scriptwrapper
|
INSTALL_OPTS:= --scriptwrapper
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(CONFIG_FEATURE_INDIVIDUAL),y)
|
||||||
|
INSTALL_OPTS:= --binaries
|
||||||
|
LIBBUSYBOX_SONAME:= 0_lib/libbusybox.so.$(BB_VER)
|
||||||
|
endif
|
||||||
install: $(srctree)/applets/install.sh busybox busybox.links
|
install: $(srctree)/applets/install.sh busybox busybox.links
|
||||||
$(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
|
$(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
|
||||||
$(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS)
|
$(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS)
|
||||||
|
@ -5,19 +5,26 @@ export LC_CTYPE=POSIX
|
|||||||
|
|
||||||
prefix=$1
|
prefix=$1
|
||||||
if [ -z "$prefix" ]; then
|
if [ -z "$prefix" ]; then
|
||||||
echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--scriptwrapper]"
|
echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--binaries/--scriptwrapper]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Source the configuration
|
||||||
|
. ./.config
|
||||||
|
|
||||||
h=`sort busybox.links | uniq`
|
h=`sort busybox.links | uniq`
|
||||||
|
|
||||||
|
sharedlib_dir="0_lib"
|
||||||
|
|
||||||
linkopts=""
|
linkopts=""
|
||||||
scriptwrapper="n"
|
scriptwrapper="n"
|
||||||
|
binaries="n"
|
||||||
cleanup="0"
|
cleanup="0"
|
||||||
noclobber="0"
|
noclobber="0"
|
||||||
case "$2" in
|
case "$2" in
|
||||||
--hardlinks) linkopts="-f";;
|
--hardlinks) linkopts="-f";;
|
||||||
--symlinks) linkopts="-fs";;
|
--symlinks) linkopts="-fs";;
|
||||||
|
--binaries) binaries="y";;
|
||||||
--scriptwrapper) scriptwrapper="y";swrapall="y";;
|
--scriptwrapper) scriptwrapper="y";swrapall="y";;
|
||||||
--sw-sh-hard) scriptwrapper="y";linkopts="-f";;
|
--sw-sh-hard) scriptwrapper="y";linkopts="-f";;
|
||||||
--sw-sh-sym) scriptwrapper="y";linkopts="-fs";;
|
--sw-sh-sym) scriptwrapper="y";linkopts="-fs";;
|
||||||
@ -40,8 +47,9 @@ if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then
|
|||||||
for i in $DO_INSTALL_LIBS; do
|
for i in $DO_INSTALL_LIBS; do
|
||||||
rm -f "$prefix/$libdir/$i" || exit 1
|
rm -f "$prefix/$libdir/$i" || exit 1
|
||||||
if [ -f "$i" ]; then
|
if [ -f "$i" ]; then
|
||||||
|
echo " Installing $i to the target at $prefix/$libdir/"
|
||||||
cp -pPR "$i" "$prefix/$libdir/" || exit 1
|
cp -pPR "$i" "$prefix/$libdir/" || exit 1
|
||||||
chmod 0644 "$prefix/$libdir/$i" || exit 1
|
chmod 0644 "$prefix/$libdir/`basename $i`" || exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -68,6 +76,7 @@ install -m 755 busybox "$prefix/bin/busybox" || exit 1
|
|||||||
|
|
||||||
for i in $h; do
|
for i in $h; do
|
||||||
appdir=`dirname "$i"`
|
appdir=`dirname "$i"`
|
||||||
|
app=`basename "$i"`
|
||||||
mkdir -p "$prefix/$appdir" || exit 1
|
mkdir -p "$prefix/$appdir" || exit 1
|
||||||
if [ "$scriptwrapper" = "y" ]; then
|
if [ "$scriptwrapper" = "y" ]; then
|
||||||
if [ "$swrapall" != "y" ] && [ "$i" = "/bin/sh" ]; then
|
if [ "$swrapall" != "y" ] && [ "$i" = "/bin/sh" ]; then
|
||||||
@ -78,6 +87,19 @@ for i in $h; do
|
|||||||
chmod +x "$prefix/$i"
|
chmod +x "$prefix/$i"
|
||||||
fi
|
fi
|
||||||
echo " $prefix/$i"
|
echo " $prefix/$i"
|
||||||
|
elif [ "$binaries" = "y" ]; then
|
||||||
|
# Copy the binary over rather
|
||||||
|
if [ -e $sharedlib_dir/$app ]; then
|
||||||
|
if [ "$noclobber" = "0" ] || [ ! -e "$prefix/$i" ]; then
|
||||||
|
echo " Copying $sharedlib_dir/$app to $prefix/$i"
|
||||||
|
cp -pPR $sharedlib_dir/$app $prefix/$i || exit 1
|
||||||
|
else
|
||||||
|
echo " $prefix/$i already exists"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: Could not find $sharedlib_dir/$app"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
if [ "$2" = "--hardlinks" ]; then
|
if [ "$2" = "--hardlinks" ]; then
|
||||||
bb_path="$prefix/bin/busybox"
|
bb_path="$prefix/bin/busybox"
|
||||||
|
Loading…
Reference in New Issue
Block a user