Merge successfully before continuing to modify AppxManifest.xml

This commit is contained in:
Howard20181 2023-01-02 17:39:29 +08:00
parent c4d06eecd0
commit 6199cc938e
2 changed files with 8 additions and 6 deletions

View file

@ -322,8 +322,8 @@ if [ "$DEBUG" ]; then
fi
require_su() {
if test "$(whoami)" != "root"; then
if [ -z "$SUDO" ] || [ "$($SUDO whoami)" != "root" ]; then
if test "$(id -u)" != "0"; then
if [ -z "$SUDO" ] || [ "$($SUDO id -u)" != "0" ]; then
echo "ROOT/SUDO is required to run this script"
abort
fi
@ -651,10 +651,12 @@ EOF
../wine/"$HOST_ARCH"/makepri.exe new /pr "$(wslpath -w "$WORK_DIR"/wsa/pri)" /in MicrosoftCorporationII.WindowsSubsystemForAndroid /cf "$(wslpath -w "$WORK_DIR"/wsa/priconfig.xml)" /of "$(wslpath -w "$WORK_DIR"/wsa/"$ARCH"/resources.pri)" /o
elif which wine64 > /dev/null; then
wine64 ../wine/"$HOST_ARCH"/makepri.exe new /pr "$WORK_DIR"/wsa/pri /in MicrosoftCorporationII.WindowsSubsystemForAndroid /cf "$WORK_DIR"/wsa/priconfig.xml /of "$WORK_DIR"/wsa/"$ARCH"/resources.pri /o
else
res_merge_failed=1
fi
sed -i -zE "s/<Resources.*Resources>/<Resources>\n$(cat "$WORK_DIR"/wsa/xml/* | grep -Po '<Resource [^>]*/>' | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/\$/\\$/g' | sed 's/\//\\\//g')\n<\/Resources>/g" "$WORK_DIR"/wsa/"$ARCH"/AppxManifest.xml
[ -z "$res_merge_failed" ] || sed -i -zE "s/<Resources.*Resources>/<Resources>\n$(cat "$WORK_DIR"/wsa/xml/* | grep -Po '<Resource [^>]*/>' | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/\$/\\$/g' | sed 's/\//\\\//g')\n<\/Resources>/g" "$WORK_DIR"/wsa/"$ARCH"/AppxManifest.xml && \
echo -e "Merge Language Resources done\n"
} || echo -e "Merge Language Resources failed\n"
} && [ -z "$res_merge_failed" ] || echo -e "Merge Language Resources failed\n" && unset res_merge_failed
echo "Add extra packages"
$SUDO cp -r ../"$ARCH"/system/* "$MOUNT_DIR" || abort

View file

@ -32,8 +32,8 @@ abort() {
exit 1
}
require_su() {
if test "$(whoami)" != "root"; then
if [ -z "$SUDO" ] && [ "$($SUDO whoami)" != "root" ]; then
if test "$(id -u)" != "0"; then
if [ -z "$SUDO" ] && [ "$($SUDO id -u)" != "0" ]; then
echo "ROOT/SUDO is required to run this script"
abort
fi