Skip to content

Commit

Permalink
Added addon.d support
Browse files Browse the repository at this point in the history
  • Loading branch information
meefik committed Aug 13, 2018
1 parent 45695f4 commit b0d162e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 34 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog (English)
1.29.2-38
Updated to busybox v1.29.2 (static)
Translated into Ukrainian
Added addon.d support

1.28.4-37
Updated to busybox v1.28.4 (static)
Expand Down Expand Up @@ -69,6 +70,7 @@ Added feature of creating a zip-archive for installation via recovery
1.29.2-38
Обновлено до busybox v1.29.2 (статическая сборка)
Переведено на украинский язык
Добавлена поддержка addon.d

1.28.4-37
Обновлено до busybox v1.28.4 (статическая сборка)
Expand Down
46 changes: 23 additions & 23 deletions app/src/main/assets/all/scripts/info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,66 +9,66 @@ ANDROID=$(getprop ro.build.version.release)
busybox printf "* android: $ANDROID\n"
ARCH=$(busybox uname -m)
busybox printf "* architecture: $ARCH\n"
if busybox test -d /system/addon.d
then
busybox printf "* addon.d: supported\n"
else
busybox printf "* addon.d: unsupported\n"
fi

busybox printf "\nFree space:\n"
DATA_FREE=$(busybox df -Ph /data | busybox grep -v ^Filesystem | busybox awk '{print $4}')
busybox printf "* /data: $DATA_FREE\n"
SYSTEM_FREE=$(busybox df -Ph /system | busybox grep -v ^Filesystem | busybox awk '{print $4}')
busybox printf "* /system: $SYSTEM_FREE\n"

busybox printf "\naddon.d support:\n"
if busybox test -d /system/addon.d
then
busybox printf "* available\n"
else
busybox printf "* unavailable\n"
fi

busybox printf "\nLatest BusyBox:\n"
BB_BIN=$(busybox which busybox)
BB_VERSION=$(busybox | busybox head -1 | busybox awk '{print $2}')
busybox printf "* version: $BB_VERSION\n"
BB_APPLETS=$(busybox --list | busybox wc -l)
busybox printf "* applets: $BB_APPLETS items\n"
BB_SIZE=$(busybox stat -c '%s' $BB_BIN)
BB_SIZE=$(busybox stat -c '%s' "$BB_BIN")
busybox printf "* size: $BB_SIZE bytes\n"
BB_MD5=$(busybox md5sum $BB_BIN | busybox awk '{print $1}')
BB_MD5=$(busybox md5sum "$BB_BIN" | busybox awk '{print $1}')
busybox printf "* md5: $BB_MD5\n"

busybox printf "\nInstalled BusyBox:\n"
BB_BIN=""
if busybox test -e "$INSTALL_DIR/busybox"
then
BB_PATH="$INSTALL_DIR"
BB_BIN="$BB_PATH/busybox"
elif busybox test -e "/system/bin/busybox"
then
BB_PATH="/system/bin"
BB_BIN="$BB_PATH/busybox"
elif busybox test -e "/system/xbin/busybox"
then
BB_PATH="/system/xbin"
BB_BIN="$BB_PATH/busybox"
fi
BB_BIN="$BB_PATH/busybox"
if busybox test -e "$BB_BIN"
then
busybox printf "* location: $BB_PATH\n"
BB_VERSION=$($BB_BIN | busybox head -1 | busybox awk '{print $2}')
BB_VERSION=$("$BB_BIN" | busybox head -1 | busybox awk '{print $2}')
busybox printf "* version: $BB_VERSION\n"
BB_APPLETS=$($BB_BIN --list | busybox wc -l)
BB_APPLETS=$("$BB_BIN" --list | busybox wc -l)
busybox printf "* applets: $BB_APPLETS items\n"
BB_SIZE=$(busybox stat -c '%s' $BB_BIN)
BB_SIZE=$(busybox stat -c '%s' "$BB_BIN")
busybox printf "* size: $BB_SIZE bytes\n"
BB_MD5=$(busybox md5sum $BB_BIN | busybox awk '{print $1}')
BB_MD5=$(busybox md5sum "$BB_BIN" | busybox awk '{print $1}')
busybox printf "* md5: $BB_MD5\n"

if test -d /system/addon.d
if busybox test -e "$BB_PATH/ssl_helper"
then
busybox printf "* ssl_helper: yes\n"
else
busybox printf "* ssl_helper: no\n"
fi
if busybox test -d /system/addon.d
then
if test -f /system/addon.d/99-busybox.sh
if busybox test -f /system/addon.d/99-busybox.sh
then
busybox printf "* addon.d script: found\n"
busybox printf "* addon.d: yes\n"
else
busybox printf "* addon.d script: not found\n"
busybox printf "* addon.d: no\n"
fi
fi
else
Expand Down
28 changes: 17 additions & 11 deletions app/src/main/assets/all/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ do
fi
done

if busybox test "$SYSTEM_REMOUNT" -ne 0 -a -d /system/addon.d
then
busybox cp "$ENV_DIR/scripts/addon.d.sh" /system/addon.d/99-busybox.sh
echo "$INSTALL_DIR" > /system/addon.d/busybox-install-dir

busybox chown 0:0 /system/addon.d/99-busybox.sh
busybox chmod 755 /system/addon.d/99-busybox.sh
busybox chmod 644 /system/addon.d/busybox-install-dir
fi

if busybox test "$REPLACE_APPLETS" = "true"
then
busybox printf "Removing old applets ... "
Expand All @@ -76,7 +66,23 @@ fi
if busybox test "$INSTALL_APPLETS" = "true"
then
busybox printf "Installing new applets ... "
$INSTALL_DIR/busybox --install -s "$INSTALL_DIR"
"$INSTALL_DIR/busybox" --install -s "$INSTALL_DIR"
if busybox test $? -eq 0
then
busybox printf "done\n"
else
busybox printf "fail\n"
fi
fi

if busybox test "$SYSTEM_REMOUNT" -ne 0 -a -d /system/addon.d
then
busybox printf "Installing addon.d script ... "
echo "$INSTALL_DIR" > /system/addon.d/busybox-install-dir
busybox chmod 644 /system/addon.d/busybox-install-dir
busybox cp "$ENV_DIR/scripts/addon.d.sh" /system/addon.d/99-busybox.sh
busybox chown 0:0 /system/addon.d/99-busybox.sh
busybox chmod 755 /system/addon.d/99-busybox.sh
if busybox test $? -eq 0
then
busybox printf "done\n"
Expand Down

0 comments on commit b0d162e

Please sign in to comment.