Fix update-binary
* Some devices get linkage errors executing toybox without linking against /system Signed-off-by: Paul Keith <javelinanddart@bestas.gr>
This commit is contained in:
@@ -2,17 +2,21 @@
|
|||||||
|
|
||||||
ZIP=$3
|
ZIP=$3
|
||||||
|
|
||||||
|
exec_util() {
|
||||||
|
LD_LIBRARY_PATH=$LD_PATH $UTILS $1
|
||||||
|
}
|
||||||
|
|
||||||
set_con() {
|
set_con() {
|
||||||
$UTILS chcon -h u:object_r:"$1":s0 $2
|
exec_util "chcon -h u:object_r:"$1":s0 $2"
|
||||||
$UTILS chcon u:object_r:"$1":s0 $2
|
exec_util "chcon u:object_r:"$1":s0 $2"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_perm() {
|
set_perm() {
|
||||||
$UTILS chmod $1 $2
|
exec_util "chmod $1 $2"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_owner() {
|
set_owner() {
|
||||||
$UTILS chown $1:$2 $3
|
exec_util "chown $1:$2 $3"
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print "*****************"
|
ui_print "*****************"
|
||||||
@@ -36,27 +40,30 @@ fi
|
|||||||
|
|
||||||
if [ -f /system/bin/toybox ]; then
|
if [ -f /system/bin/toybox ]; then
|
||||||
UTILS=/system/bin/toybox
|
UTILS=/system/bin/toybox
|
||||||
|
LD_PATH=/system/lib
|
||||||
else
|
else
|
||||||
ui_print "Could not find /system/bin/toybox! Aborting..."
|
ui_print "Could not find /system/bin/toybox! Aborting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DIRS="addon.d app priv-app framework etc lib"
|
||||||
|
|
||||||
|
if [ -d /system/lib64 ]; then
|
||||||
|
DIRS="$DIRS lib64"
|
||||||
|
LD_PATH=/system/lib64
|
||||||
|
fi
|
||||||
|
|
||||||
ui_print "Extracting files"
|
ui_print "Extracting files"
|
||||||
cd /tmp
|
cd /tmp
|
||||||
unzip -o "$ZIP" system/*
|
unzip -o "$ZIP" system/*
|
||||||
cd system
|
cd system
|
||||||
DIRS="addon.d app priv-app framework etc lib"
|
|
||||||
if [ -d /system/lib64 ]; then
|
|
||||||
DIRS="$DIRS lib64"
|
|
||||||
fi
|
|
||||||
for dirs in $DIRS; do
|
for dirs in $DIRS; do
|
||||||
set_perm 0755 $dir
|
set_perm 0755 $dir
|
||||||
for d in `$UTILS find ./$dir -type d`; do
|
for d in `exec_util "find ./$dir -type d"`; do
|
||||||
set_perm 0755 $d
|
set_perm 0755 $d
|
||||||
set_owner system system $d
|
set_owner system system $d
|
||||||
done
|
done
|
||||||
for f in `$UTILS find ./$dir -type f`; do
|
for f in `exec_util "find ./$dir -type f"`; do
|
||||||
type=$(echo "$f" | sed 's/.*\.//')
|
type=$(echo "$f" | sed 's/.*\.//')
|
||||||
if [ "$type" == "sh" ] || [ "$type" == "$f" ]; then
|
if [ "$type" == "sh" ] || [ "$type" == "$f" ]; then
|
||||||
set_perm 0755 $f
|
set_perm 0755 $f
|
||||||
@@ -68,10 +75,10 @@ for dirs in $DIRS; do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
ui_print "Copying files"
|
ui_print "Copying files"
|
||||||
$UTILS cp --preserve=a -r ./* /system/
|
exec_util "cp --preserve=a -r ./* /system/"
|
||||||
ui_print "Cleaning up files"
|
ui_print "Cleaning up files"
|
||||||
cd ../
|
cd ../
|
||||||
$UTILS rm -rf system/
|
exec_util "rm -rf system/"
|
||||||
|
|
||||||
ui_print "Unmounting /system"
|
ui_print "Unmounting /system"
|
||||||
umount /system
|
umount /system
|
||||||
|
Reference in New Issue
Block a user