mirror of
https://github.com/LSPosed/MagiskOnWSALocal.git
synced 2025-04-18 06:29:09 +00:00
parent
f07cafe63f
commit
ad396d6810
3 changed files with 82 additions and 82 deletions
|
@ -8,10 +8,10 @@
|
|||
|
||||
The following dependencies are required:
|
||||
|
||||
| DistrOS | | | |
|
||||
|:-------------------:|---------------------------------------------------------------------------|------------|--------------|
|
||||
| Debian | `lzip patchelf e2fsprogs python3 python3-pip aria2 p7zip-full attr unzip` | `whiptail` | `qemu-utils` |
|
||||
| openSUSE Tumbleweed | Same as above | `dialog` | `qemu-tools` |
|
||||
| DistrOS | | | |
|
||||
|:-------------------:|--------------------------------------------------------------------------------|------------|--------------|
|
||||
| Debian | `lzip patchelf e2fsprogs python3 python3-pip aria2 p7zip-full attr unzip sudo` | `whiptail` | `qemu-utils` |
|
||||
| openSUSE Tumbleweed | Same as above | `dialog` | `qemu-tools` |
|
||||
|
||||
The python3 library `requests` is used.
|
||||
|
||||
|
|
155
scripts/build.sh
155
scripts/build.sh
|
@ -38,24 +38,23 @@ SYSTEM_MNT="$ROOT_MNT/system"
|
|||
VENDOR_MNT="$ROOT_MNT/vendor"
|
||||
PRODUCT_MNT="$ROOT_MNT/product"
|
||||
SYSTEM_EXT_MNT="$ROOT_MNT/system_ext"
|
||||
SUDO="$(which sudo 2>/dev/null)"
|
||||
DOWNLOAD_DIR=../download
|
||||
DOWNLOAD_CONF_NAME=download.list
|
||||
umount_clean() {
|
||||
if [ -d "$ROOT_MNT" ]; then
|
||||
echo "Cleanup Mount Directory"
|
||||
if [ -d "$VENDOR_MNT" ]; then
|
||||
$SUDO umount -v "$VENDOR_MNT"
|
||||
sudo umount -v "$VENDOR_MNT"
|
||||
fi
|
||||
if [ -d "$PRODUCT_MNT" ]; then
|
||||
$SUDO umount -v "$PRODUCT_MNT"
|
||||
sudo umount -v "$PRODUCT_MNT"
|
||||
fi
|
||||
if [ -d "$SYSTEM_EXT_MNT" ]; then
|
||||
$SUDO umount -v "$SYSTEM_EXT_MNT"
|
||||
sudo umount -v "$SYSTEM_EXT_MNT"
|
||||
fi
|
||||
$SUDO umount -v "$ROOT_MNT"
|
||||
sudo umount -v "$ROOT_MNT"
|
||||
|
||||
$SUDO rm -rf "${WORK_DIR:?}"
|
||||
sudo rm -rf "${WORK_DIR:?}"
|
||||
else
|
||||
rm -rf "${WORK_DIR:?}"
|
||||
fi
|
||||
|
@ -357,7 +356,7 @@ fi
|
|||
|
||||
require_su() {
|
||||
if test "$(id -u)" != "0"; then
|
||||
if [ -z "$SUDO" ] || [ "$($SUDO id -u)" != "0" ]; then
|
||||
if [ "$(sudo id -u)" != "0" ]; then
|
||||
echo "ROOT/SUDO is required to run this script"
|
||||
abort
|
||||
fi
|
||||
|
@ -512,8 +511,8 @@ if [ "$GAPPS_BRAND" != "none" ] || [ "$ROOT_SOL" = "magisk" ]; then
|
|||
echo "Please install Magisk 25211+"
|
||||
abort
|
||||
fi
|
||||
$SUDO chmod +x "../linker/$HOST_ARCH/linker64" || abort
|
||||
$SUDO patchelf --set-interpreter "../linker/$HOST_ARCH/linker64" "$WORK_DIR/magisk/magiskpolicy" || abort
|
||||
sudo chmod +x "../linker/$HOST_ARCH/linker64" || abort
|
||||
sudo patchelf --set-interpreter "../linker/$HOST_ARCH/linker64" "$WORK_DIR/magisk/magiskpolicy" || abort
|
||||
chmod +x "$WORK_DIR/magisk/magiskpolicy" || abort
|
||||
elif [ -z "${CUSTOM_MAGISK+x}" ]; then
|
||||
echo "The Magisk zip package does not exist, is the download incomplete?"
|
||||
|
@ -630,34 +629,34 @@ resize_img "$WORK_DIR/wsa/$ARCH/vendor.img" "$VENDOR_TAGET_SIZE"s || abort
|
|||
echo -e "Expand images done\n"
|
||||
|
||||
echo "Mount images"
|
||||
$SUDO mkdir "$ROOT_MNT" || abort
|
||||
$SUDO mount -vo loop "$WORK_DIR/wsa/$ARCH/system.img" "$ROOT_MNT" || abort
|
||||
$SUDO mount -vo loop "$WORK_DIR/wsa/$ARCH/vendor.img" "$VENDOR_MNT" || abort
|
||||
$SUDO mount -vo loop "$WORK_DIR/wsa/$ARCH/product.img" "$PRODUCT_MNT" || abort
|
||||
$SUDO mount -vo loop "$WORK_DIR/wsa/$ARCH/system_ext.img" "$SYSTEM_EXT_MNT" || abort
|
||||
sudo mkdir "$ROOT_MNT" || abort
|
||||
sudo mount -vo loop "$WORK_DIR/wsa/$ARCH/system.img" "$ROOT_MNT" || abort
|
||||
sudo mount -vo loop "$WORK_DIR/wsa/$ARCH/vendor.img" "$VENDOR_MNT" || abort
|
||||
sudo mount -vo loop "$WORK_DIR/wsa/$ARCH/product.img" "$PRODUCT_MNT" || abort
|
||||
sudo mount -vo loop "$WORK_DIR/wsa/$ARCH/system_ext.img" "$SYSTEM_EXT_MNT" || abort
|
||||
echo -e "done\n"
|
||||
|
||||
if [ "$REMOVE_AMAZON" ]; then
|
||||
echo "Remove Amazon Appstore"
|
||||
find "${PRODUCT_MNT:?}"/{etc/permissions,etc/sysconfig,framework,priv-app} 2>/dev/null | grep -e amazon -e venezia | $SUDO xargs rm -rf
|
||||
find "${SYSTEM_EXT_MNT:?}"/{etc/*permissions,framework,priv-app} 2>/dev/null | grep -e amazon -e venezia | $SUDO xargs rm -rf
|
||||
find "${PRODUCT_MNT:?}"/{etc/permissions,etc/sysconfig,framework,priv-app} 2>/dev/null | grep -e amazon -e venezia | sudo xargs rm -rf
|
||||
find "${SYSTEM_EXT_MNT:?}"/{etc/*permissions,framework,priv-app} 2>/dev/null | grep -e amazon -e venezia | sudo xargs rm -rf
|
||||
echo -e "done\n"
|
||||
fi
|
||||
|
||||
echo "Add device administration features"
|
||||
$SUDO sed -i -e '/cts/a \ \ \ \ <feature name="android.software.device_admin" />' -e '/print/i \ \ \ \ <feature name="android.software.managed_users" />' "$VENDOR_MNT/etc/permissions/windows.permissions.xml"
|
||||
$SUDO setfattr -n security.selinux -v "u:object_r:vendor_configs_file:s0" "$VENDOR_MNT/etc/permissions/windows.permissions.xml" || abort
|
||||
sudo sed -i -e '/cts/a \ \ \ \ <feature name="android.software.device_admin" />' -e '/print/i \ \ \ \ <feature name="android.software.managed_users" />' "$VENDOR_MNT/etc/permissions/windows.permissions.xml"
|
||||
sudo setfattr -n security.selinux -v "u:object_r:vendor_configs_file:s0" "$VENDOR_MNT/etc/permissions/windows.permissions.xml" || abort
|
||||
echo -e "done\n"
|
||||
|
||||
if [ "$ROOT_SOL" = 'magisk' ]; then
|
||||
echo "Integrate Magisk"
|
||||
$SUDO mkdir "$ROOT_MNT/sbin"
|
||||
$SUDO setfattr -n security.selinux -v "u:object_r:rootfs:s0" "$ROOT_MNT/sbin" || abort
|
||||
$SUDO chown root:root "$ROOT_MNT/sbin"
|
||||
$SUDO chmod 0700 "$ROOT_MNT/sbin"
|
||||
$SUDO cp "$WORK_DIR/magisk/magisk/"* "$ROOT_MNT/sbin/"
|
||||
$SUDO cp "$MAGISK_PATH" "$ROOT_MNT/sbin/magisk.apk" || abort
|
||||
$SUDO tee -a "$ROOT_MNT/sbin/loadpolicy.sh" <<EOF >/dev/null || abort
|
||||
sudo mkdir "$ROOT_MNT/sbin"
|
||||
sudo setfattr -n security.selinux -v "u:object_r:rootfs:s0" "$ROOT_MNT/sbin" || abort
|
||||
sudo chown root:root "$ROOT_MNT/sbin"
|
||||
sudo chmod 0700 "$ROOT_MNT/sbin"
|
||||
sudo cp "$WORK_DIR/magisk/magisk/"* "$ROOT_MNT/sbin/"
|
||||
sudo cp "$MAGISK_PATH" "$ROOT_MNT/sbin/magisk.apk" || abort
|
||||
sudo tee -a "$ROOT_MNT/sbin/loadpolicy.sh" <<EOF >/dev/null || abort
|
||||
#!/system/bin/sh
|
||||
mkdir -p /data/adb/magisk
|
||||
cp /sbin/* /data/adb/magisk/
|
||||
|
@ -671,18 +670,18 @@ for module in \$(ls /data/adb/modules); do
|
|||
done
|
||||
EOF
|
||||
|
||||
$SUDO find "$ROOT_MNT/sbin" -type f -exec chmod 0755 {} \;
|
||||
$SUDO find "$ROOT_MNT/sbin" -type f -exec chown root:root {} \;
|
||||
$SUDO find "$ROOT_MNT/sbin" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
sudo find "$ROOT_MNT/sbin" -type f -exec chmod 0755 {} \;
|
||||
sudo find "$ROOT_MNT/sbin" -type f -exec chown root:root {} \;
|
||||
sudo find "$ROOT_MNT/sbin" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
|
||||
MAGISK_TMP_PATH=$(Gen_Rand_Str 14)
|
||||
echo "/dev/$MAGISK_TMP_PATH(/.*)? u:object_r:magisk_file:s0" | $SUDO tee -a "$VENDOR_MNT/etc/selinux/vendor_file_contexts"
|
||||
echo '/data/adb/magisk(/.*)? u:object_r:magisk_file:s0' | $SUDO tee -a "$VENDOR_MNT/etc/selinux/vendor_file_contexts"
|
||||
$SUDO LD_LIBRARY_PATH="../linker/$HOST_ARCH" "$WORK_DIR/magisk/magiskpolicy" --load "$VENDOR_MNT/etc/selinux/precompiled_sepolicy" --save "$VENDOR_MNT/etc/selinux/precompiled_sepolicy" --magisk || abort
|
||||
echo "/dev/$MAGISK_TMP_PATH(/.*)? u:object_r:magisk_file:s0" | sudo tee -a "$VENDOR_MNT/etc/selinux/vendor_file_contexts"
|
||||
echo '/data/adb/magisk(/.*)? u:object_r:magisk_file:s0' | sudo tee -a "$VENDOR_MNT/etc/selinux/vendor_file_contexts"
|
||||
sudo LD_LIBRARY_PATH="../linker/$HOST_ARCH" "$WORK_DIR/magisk/magiskpolicy" --load "$VENDOR_MNT/etc/selinux/precompiled_sepolicy" --save "$VENDOR_MNT/etc/selinux/precompiled_sepolicy" --magisk || abort
|
||||
LOAD_POLICY_SVC_NAME=$(Gen_Rand_Str 12)
|
||||
PFD_SVC_NAME=$(Gen_Rand_Str 12)
|
||||
LS_SVC_NAME=$(Gen_Rand_Str 12)
|
||||
$SUDO tee -a "$SYSTEM_MNT/etc/init/hw/init.rc" <<EOF >/dev/null
|
||||
sudo tee -a "$SYSTEM_MNT/etc/init/hw/init.rc" <<EOF >/dev/null
|
||||
on post-fs-data
|
||||
start adbd
|
||||
mkdir /dev/$MAGISK_TMP_PATH
|
||||
|
@ -748,65 +747,65 @@ elif [ "$ROOT_SOL" = "kernelsu" ]; then
|
|||
fi
|
||||
|
||||
echo "Add extra packages"
|
||||
$SUDO cp -r "../$ARCH/system/"* "$SYSTEM_MNT" || abort
|
||||
find "../$ARCH/system/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/priv-app/placeholder" -type d -exec chmod 0755 {} \;
|
||||
find "../$ARCH/system/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/priv-app/placeholder" -type f -exec chmod 0644 {} \;
|
||||
find "../$ARCH/system/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/priv-app/placeholder" -exec chown root:root {} \;
|
||||
find "../$ARCH/system/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/priv-app/placeholder" -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
sudo cp -r "../$ARCH/system/"* "$SYSTEM_MNT" || abort
|
||||
find "../$ARCH/system/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/priv-app/placeholder" -type d -exec chmod 0755 {} \;
|
||||
find "../$ARCH/system/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/priv-app/placeholder" -type f -exec chmod 0644 {} \;
|
||||
find "../$ARCH/system/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/priv-app/placeholder" -exec chown root:root {} \;
|
||||
find "../$ARCH/system/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/priv-app/placeholder" -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
echo -e "Add extra packages done\n"
|
||||
|
||||
if [ "$GAPPS_BRAND" != 'none' ]; then
|
||||
echo "Integrate $GAPPS_BRAND"
|
||||
find "$WORK_DIR/gapps/" -mindepth 1 -type d -exec "$SUDO" chmod 0755 {} \;
|
||||
find "$WORK_DIR/gapps/" -mindepth 1 -type d -exec "$SUDO" chown root:root {} \;
|
||||
find "$WORK_DIR/gapps/" -mindepth 1 -type d -exec sudo chmod 0755 {} \;
|
||||
find "$WORK_DIR/gapps/" -mindepth 1 -type d -exec sudo chown root:root {} \;
|
||||
file_list="$(find "$WORK_DIR/gapps/" -mindepth 1 -type f | cut -d/ -f5-)"
|
||||
for file in $file_list; do
|
||||
$SUDO chown root:root "$WORK_DIR/gapps/${file}"
|
||||
$SUDO chmod 0644 "$WORK_DIR/gapps/${file}"
|
||||
sudo chown root:root "$WORK_DIR/gapps/${file}"
|
||||
sudo chmod 0644 "$WORK_DIR/gapps/${file}"
|
||||
done
|
||||
|
||||
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
|
||||
find "$WORK_DIR/gapps/" -maxdepth 1 -mindepth 1 -type d -not -path '*product' -exec "$SUDO" cp --preserve=all -r {} "$SYSTEM_MNT" \; || abort
|
||||
find "$WORK_DIR/gapps/" -maxdepth 1 -mindepth 1 -type d -not -path '*product' -exec sudo cp --preserve=all -r {} "$SYSTEM_MNT" \; || abort
|
||||
elif [ "$GAPPS_BRAND" = "MindTheGapps" ]; then
|
||||
$SUDO cp --preserve=all -r "$WORK_DIR/gapps/system_ext/"* "$SYSTEM_EXT_MNT/" || abort
|
||||
sudo cp --preserve=all -r "$WORK_DIR/gapps/system_ext/"* "$SYSTEM_EXT_MNT/" || abort
|
||||
if [ -e "$SYSTEM_EXT_MNT/priv-app/SetupWizard" ]; then
|
||||
rm -rf "${SYSTEM_EXT_MNT:?}/priv-app/Provision"
|
||||
fi
|
||||
fi
|
||||
$SUDO cp --preserve=all -r "$WORK_DIR/gapps/product/"* "$PRODUCT_MNT" || abort
|
||||
sudo cp --preserve=all -r "$WORK_DIR/gapps/product/"* "$PRODUCT_MNT" || abort
|
||||
|
||||
find "$WORK_DIR/gapps/product/overlay" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$PRODUCT_MNT/overlay/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:vendor_overlay_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/overlay" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/overlay/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:vendor_overlay_file:s0" {} \; || abort
|
||||
|
||||
if [ "$GAPPS_BRAND" = "OpenGApps" ]; then
|
||||
find "$WORK_DIR/gapps/app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/framework/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/framework/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/priv-app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/framework/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/framework/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/priv-app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/etc/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_MNT/etc/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/framework/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/framework/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/priv-app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/framework/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/framework/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/priv-app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/etc/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_MNT/etc/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
else
|
||||
find "$WORK_DIR/gapps/product/app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$PRODUCT_MNT/app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$PRODUCT_MNT/etc/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$PRODUCT_MNT/priv-app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/framework/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$PRODUCT_MNT/framework/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/etc/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/priv-app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/framework/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/framework/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
|
||||
find "$WORK_DIR/gapps/product/app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$PRODUCT_MNT/app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$PRODUCT_MNT/etc/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$PRODUCT_MNT/priv-app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/framework/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$PRODUCT_MNT/framework/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/system_ext/etc/permissions/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_EXT_MNT/etc/permissions/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/etc/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/priv-app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/framework/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/framework/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/system_ext/etc/permissions/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_EXT_MNT/etc/permissions/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
|
||||
$SUDO setfattr -n security.selinux -v "u:object_r:system_lib_file:s0" "$PRODUCT_MNT/lib" || abort
|
||||
find "$WORK_DIR/gapps/product/lib/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$PRODUCT_MNT/lib/placeholder" -exec setfattr -n security.selinux -v "u:object_r:system_lib_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/lib64/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$PRODUCT_MNT/lib64/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_lib_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/system_ext/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_EXT_MNT/priv-app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/system_ext/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_EXT_MNT/etc/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/system_ext/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder "$SUDO" find "$SYSTEM_EXT_MNT/priv-app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
sudo setfattr -n security.selinux -v "u:object_r:system_lib_file:s0" "$PRODUCT_MNT/lib" || abort
|
||||
find "$WORK_DIR/gapps/product/lib/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/lib/placeholder" -exec setfattr -n security.selinux -v "u:object_r:system_lib_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/product/lib64/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$PRODUCT_MNT/lib64/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_lib_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/system_ext/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_EXT_MNT/priv-app/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/system_ext/etc/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_EXT_MNT/etc/placeholder" -type d -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
find "$WORK_DIR/gapps/system_ext/priv-app/" -maxdepth 1 -mindepth 1 -printf '%P\n' | xargs -I placeholder sudo find "$SYSTEM_EXT_MNT/priv-app/placeholder" -type f -exec setfattr -n security.selinux -v "u:object_r:system_file:s0" {} \; || abort
|
||||
fi
|
||||
|
||||
$SUDO LD_LIBRARY_PATH="../linker/$HOST_ARCH" "$WORK_DIR/magisk/magiskpolicy" --load "$VENDOR_MNT/etc/selinux/precompiled_sepolicy" --save "$VENDOR_MNT/etc/selinux/precompiled_sepolicy" "allow gmscore_app gmscore_app vsock_socket { create connect write read }" "allow gmscore_app device_config_runtime_native_boot_prop file read" "allow gmscore_app system_server_tmpfs dir search" "allow gmscore_app system_server_tmpfs file open" "allow gmscore_app system_server_tmpfs filesystem getattr" "allow gmscore_app gpu_device dir search" || abort
|
||||
sudo LD_LIBRARY_PATH="../linker/$HOST_ARCH" "$WORK_DIR/magisk/magiskpolicy" --load "$VENDOR_MNT/etc/selinux/precompiled_sepolicy" --save "$VENDOR_MNT/etc/selinux/precompiled_sepolicy" "allow gmscore_app gmscore_app vsock_socket { create connect write read }" "allow gmscore_app device_config_runtime_native_boot_prop file read" "allow gmscore_app system_server_tmpfs dir search" "allow gmscore_app system_server_tmpfs file open" "allow gmscore_app system_server_tmpfs filesystem getattr" "allow gmscore_app gpu_device dir search" || abort
|
||||
echo -e "Integrate $GAPPS_BRAND done\n"
|
||||
fi
|
||||
|
||||
|
@ -815,16 +814,16 @@ if [ "$GAPPS_BRAND" != 'none' ]; then
|
|||
echo -e "Skip fix $GAPPS_BRAND prop!\n$GAPPS_PROPS_MSG1\n$GAPPS_PROPS_MSG2\n$GAPPS_PROPS_MSG3\n"
|
||||
else
|
||||
echo "Fix $GAPPS_BRAND prop"
|
||||
$SUDO python3 fixGappsProp.py "$ROOT_MNT" || abort
|
||||
sudo python3 fixGappsProp.py "$ROOT_MNT" || abort
|
||||
echo -e "done\n"
|
||||
fi
|
||||
fi
|
||||
echo "Umount images"
|
||||
$SUDO find "$ROOT_MNT" -exec touch -ht 200901010000.00 {} \;
|
||||
$SUDO umount -v "$VENDOR_MNT"
|
||||
$SUDO umount -v "$PRODUCT_MNT"
|
||||
$SUDO umount -v "$SYSTEM_EXT_MNT"
|
||||
$SUDO umount -v "$ROOT_MNT"
|
||||
sudo find "$ROOT_MNT" -exec touch -ht 200901010000.00 {} \;
|
||||
sudo umount -v "$VENDOR_MNT"
|
||||
sudo umount -v "$PRODUCT_MNT"
|
||||
sudo umount -v "$SYSTEM_EXT_MNT"
|
||||
sudo umount -v "$ROOT_MNT"
|
||||
echo -e "done\n"
|
||||
|
||||
echo "Shrink images"
|
||||
|
@ -845,7 +844,7 @@ if [[ "$DOWN_WSA_MAIN_VERSION" -ge 2302 ]]; then
|
|||
fi
|
||||
|
||||
echo "Remove signature and add scripts"
|
||||
$SUDO rm -rf "${WORK_DIR:?}"/wsa/"$ARCH"/\[Content_Types\].xml "$WORK_DIR/wsa/$ARCH/AppxBlockMap.xml" "$WORK_DIR/wsa/$ARCH/AppxSignature.p7x" "$WORK_DIR/wsa/$ARCH/AppxMetadata" || abort
|
||||
sudo rm -rf "${WORK_DIR:?}"/wsa/"$ARCH"/\[Content_Types\].xml "$WORK_DIR/wsa/$ARCH/AppxBlockMap.xml" "$WORK_DIR/wsa/$ARCH/AppxSignature.p7x" "$WORK_DIR/wsa/$ARCH/AppxMetadata" || abort
|
||||
cp "$vclibs_PATH" "$xaml_PATH" "$WORK_DIR/wsa/$ARCH" || abort
|
||||
cp "$UWPVCLibs_PATH" "$xaml_PATH" "$WORK_DIR/wsa/$ARCH" || abort
|
||||
cp "../bin/$ARCH/makepri.exe" "$WORK_DIR/wsa/$ARCH" || abort
|
||||
|
@ -889,7 +888,7 @@ fi
|
|||
echo "$artifact_name"
|
||||
echo -e "\nFinishing building...."
|
||||
if [ -f "$OUTPUT_DIR" ]; then
|
||||
$SUDO rm -rf ${OUTPUT_DIR:?}
|
||||
sudo rm -rf ${OUTPUT_DIR:?}
|
||||
fi
|
||||
if [ ! -d "$OUTPUT_DIR" ]; then
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
@ -919,5 +918,5 @@ fi
|
|||
echo -e "done\n"
|
||||
|
||||
echo "Cleanup Work Directory"
|
||||
$SUDO rm -rf "${WORK_DIR:?}"
|
||||
sudo rm -rf "${WORK_DIR:?}"
|
||||
echo "done"
|
||||
|
|
|
@ -48,6 +48,7 @@ check_dependencies() {
|
|||
command -v setfattr >/dev/null 2>&1 || NEED_INSTALL+=("attr")
|
||||
command -v unzip >/dev/null 2>&1 || NEED_INSTALL+=("unzip")
|
||||
command -v qemu-img >/dev/null 2>&1 || NEED_INSTALL+=("qemu-utils")
|
||||
command -v sudo >/dev/null 2>&1 || NEED_INSTALL+=("sudo")
|
||||
}
|
||||
check_dependencies
|
||||
osrel=$(sed -n '/^ID_LIKE=/s/^.*=//p' /etc/os-release)
|
||||
|
|
Loading…
Add table
Reference in a new issue