2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-11-11 13:11:24 +00:00

CommonInstaller: better ROM/device compat; drop nanodroid-font

This commit is contained in:
Christopher Roy Bratusek 2019-10-07 21:33:09 +02:00
parent c9b8090722
commit f9c1394bab
16 changed files with 36 additions and 264 deletions

View File

@ -175,13 +175,6 @@ backup_action () {
backup_file "${FILE}"
done
if test -h /system/fonts/Roboto-Regular.ttf; then
CUSTOM_FONT="$(basename $(readlink /system/fonts/Roboto-Regular.ttf) .ttf)"
ui_print " ++ ${MODID} addon.d: detected NanoDroid-Font (${CUSTOM_FONT})"
echo CUSTOM_FONT=${CUSTOM_FONT} > /tmp/nanodroid_font
fi
ui_print " ++ ${MODID} ${VERSION} addon.d: backup done"
}
@ -201,14 +194,6 @@ postrestore_action () {
set_ldlibrarypath
if [ -f /tmp/nanodroid_font ]; then
source /tmp/nanodroid_font
ui_print " ++ ${MODID} ${VERSION} addon.d: restoring NanoDroid-Font (${CUSTOM_FONT})"
${NANODROID_BINDIR}/nanodroid-font -s "${CUSTOM_FONT}"
rm /tmp/nanodroid_font
fi
ui_print " ++ ${MODID} ${VERSION} addon.d: GApps removal"
print_google_apps | while read app; do
${NANODROID_BINDIR}/nanodroid-overlay --add ${app}

View File

@ -228,44 +228,40 @@ error () {
# taken from Magisk, with minor modifications for NanoDroid
mount_partitions () {
SLOT=$(grep_cmdline androidboot.slot_suffix)
if [ -z ${SLOT} ]; then
SLOT=_$(grep_cmdline androidboot.slot)
[ "${SLOT}" = "_" ] && SLOT=
fi
DEVICE_AB=FALSE
VENDOR_COMPAT=FALSE
SYSTEM_AS_ROOT=FALSE
SYSTEM_AS_ROOT=$(getprop ro.build.system_root_image)
SYSTEM_BLOCK=/dev/block/bootdevice/by-name/system
if [ "${SYSTEM_AS_ROOT}" == "true" ]; then
SLOT=$(grep_cmdline androidboot.slot_suffix)
if [ -n "${SLOT}" ]; then
DEVICE_AB=TRUE
SYSTEM_BLOCK=/dev/block/bootdevice/by-name/system${SLOT}
fi
SYSTEM_MOUNT=/system_root
else
SYSTEM_MOUNT=/system
fi
is_mounted /data || mount /data || error "failed to mount /data!"
mount -o bind /dev/urandom /dev/random
! is_mounted /system && mount -o rw /system || mount -o rw,remount /system
if [ ! -f /system/build.prop ]; then
DEVICE_AB=TRUE
sys_tmp=$(find /dev/block -type l -iname system${SLOT} | head -n 1)
SYSTEMBLOCK=$(readlink -f ${sys_tmp})
mount -o rw ${SYSTEMBLOCK} /system
fi
! is_mounted ${SYSTEM_MOUNT} && mount -o rw ${SYSTEM_BLOCK} ${SYSTEM_MOUNT} || mount -o rw,remount ${SYSTEM_MOUNT}
if [ -f /system/init.rc ]; then
SYSTEM_AS_ROOT=TRUE
[ -L /system_root ] && rm -f /system_root
mkdir -p /system_root 2>/dev/null
mount --move /system /system_root
mount -o bind /system_root/system /system
else
grep ' / ' /proc/mounts | grep -qv 'rootfs' || \
grep -q ' /system_root ' /proc/mounts \
&& SYSTEM_AS_ROOT=TRUE || SYSTEM_ROOT=FALSE
fi
[ ! -f /system/build.prop ] && error "failed to mount /system (unsupported A/B device?)"
! is_mounted /vendor && mount /vendor
if [ -L /system/vendor ]; then
! is_mounted /vendor && mount /vendor
if ! is_mounted /vendor; then
vendor_tmp=$(find /dev/block -type l -iname vendor${SLOT} | head -n 1)
VENDORBLOCK=$(readlink -f ${vendor_tmp})
@ -329,13 +325,6 @@ detect_mode () {
;;
esac
if [ "${nanodroid_fonts}" -eq 1 ]; then
if test -h ${MODPATH}/system/fonts/Roboto-Regular.ttf; then
CUSTOM_FONT="$(basename $(readlink ${MODPATH}/system/fonts/Roboto-Regular.ttf) .ttf)"
ui_print " << Detected NanoDroid-Font (${CUSTOM_FONT})"
fi
fi
[ "${ROM_NO_XBIN}" -eq 1 ] && \
NANODROID_BINDIR="${MODPATH}/system/bin" || \
NANODROID_BINDIR="${MODPATH}/system/xbin"
@ -547,24 +536,28 @@ setup_busybox () {
# XXX Magisk recovery_actions() compat
export BBDIR="${INSTALLER}/busybox"
export PATH="${INSTALLER}/busybox:${PATH}"
export PATH="${BBDIR}:${PATH}"
}
# Taken from Magisk, used for System Mode installation
recovery_actions () {
mv /sbin /sbin_tmp
OLD_LD_LIB=$LD_LIBRARY_PATH
OLD_LD_PRE=$LD_PRELOAD
OLD_LD_LIB=${LD_LIBRARY_PATH}
OLD_LD_PRE=${LD_PRELOAD}
OLD_LD_CFG=${LD_CONFIG_FILE}
unset LD_LIBRARY_PATH
unset LD_PRELOAD
unset LD_CONFIG_FILE
export PATH=${BBDIR}:/system/bin:/vendor/bin
}
# Taken from Magisk, used for System Mode installation
recovery_cleanup () {
mv /sbin_tmp /sbin 2>/dev/null
[ -z $OLD_PATH ] || export PATH=$OLD_PATH
[ -z $OLD_LD_LIB ] || export LD_LIBRARY_PATH=$OLD_LD_LIB
[ -z $OLD_LD_PRE ] || export LD_PRELOAD=$OLD_LD_PRE
[ -n ${OLD_PATH} ] && export PATH=${OLD_PATH}
[ -n ${OLD_LD_LIB} ] && export LD_LIBRARY_PATH=${OLD_LD_LIB}
[ -n ${OLD_LD_PRE} ] && export LD_PRELOAD=${OLD_LD_PRE}
[ -n ${OLD_LD_CFG} ] && export LD_CONFIG_FILE=${OLD_LD_CFG}
}
##########################################################################################
@ -697,11 +690,6 @@ magisk_install_finish () {
;;
esac
if [ "${nanodroid_fonts}" -eq 1 -a ! -z ${CUSTOM_FONT} ]; then
ui_print " << Restore NanoDroid-Font (${CUSTOM_FONT})"
${NANODROID_BINDIR}/nanodroid-font -s "${CUSTOM_FONT}"
fi
recovery_cleanup
}
@ -1072,7 +1060,11 @@ install_zelda () {
# install Zelda Ringtones when requested
if [ "${nanodroid_zelda}" -eq 1 ]; then
ui_print " << with Zelda sounds"
nanodroid_install_dir media
if [ -d /system/media/audio ]; then
nanodroid_install_dir media
elif [ -d /system/product/media/audio ]; then
nanodroid_install_dir media /system/product/media
fi
else ui_print " << without Zelda sounds"
fi
}
@ -1112,17 +1104,6 @@ install_nanodroidscripts () {
fi
}
install_fonts () {
if [ "${nanodroid_fonts}" -eq 1 ]; then
ui_print " << with Nintendo Fonts"
nanodroid_install_file xbin/nanodroid-font bin
nanodroid_substitute xbin/nanodroid-font
nanodroid_install_file xbin/nfnt bin
nanodroid_install_dir fonts
fi
}
install_nano () {
if [ "${nanodroid_nano}" -eq 1 ]; then
ui_print " << with GNU Nano Terminal Editor"
@ -1268,7 +1249,7 @@ install_addond () {
nanodroid_install_dir () {
dir="${1}"
dest="/system/${dir}"
[ -n "${2}" ] && dest="${2}" || dest="/system/${dir}"
[ ! -d "${INSTALLER}/system/${dir}" ] && \
error "dir: ${dir} not found"
@ -1495,7 +1476,6 @@ MODPATH=${MODPATH}
SWIPE_LIBDIR=${SWIPE_LIBDIR}
MODE=${MODE}
MAGISK_VER_CODE=${MAGISK_VER_CODE}
CUSTOM_FONT=${CUSTOM_FONT}
ROM_NO_XBIN=${ROM_NO_XBIN}
NANODROID_UPGRADE=${NANODROID_UPGRADE}
NANODROID_BINDIR=${NANODROID_BINDIR}
@ -1662,11 +1642,13 @@ check_cfg_setup () {
[ -z "${nanodroid_bash}" ] && set_prop nanodroid_bash 1
[ -z "${nanodroid_nano}" ] && set_prop nanodroid_nano 1
[ -z "${nanodroid_utils}" ] && set_prop nanodroid_utils 1
[ -z "${nanodroid_fonts}" ] && set_prop nanodroid_fonts 1
# in NanoDroid 21.0.90 nanodroid_override was dropped
sed -e '/nanodroid_override/d' -i "${cfg_setup}"
# in NanoDroid 22.5 nanodroid_fonts was dropped
sed -e '/nanodroid_fonts/d' -i "${cfg_setup}"
source "${cfg_setup}"
}

View File

@ -56,7 +56,6 @@ install_swipe
install_bash
install_nano
install_shell_utils
install_fonts
set_progress 0.9
nanodroid_finalize

Binary file not shown.

View File

@ -1,130 +0,0 @@
#!/system/bin/sh
export NO_MAGISK=0
export MODPATH=@MODPATH@
if [ -z "${MODPATH}" ]; then
OVERLAY_PATH="/system/fonts"
NO_MAGISK=1
elif [ -d "${MODPATH}" ]; then
OVERLAY_PATH="${MODPATH}/system/fonts"
else
echo "couldn't find NanoDroid!"
exit 1
fi
FONTPATH=${MODPATH}/system/fonts
FONTFILES="Roboto-BlackItalic.ttf
Roboto-Black.ttf
Roboto-BoldItalic.ttf
Roboto-Bold.ttf
RobotoCondensed-BoldItalic.ttf
RobotoCondensed-Bold.ttf
RobotoCondensed-Italic.ttf
RobotoCondensed-LightItalic.ttf
RobotoCondensed-Light.ttf
RobotoCondensed-Regular.ttf
Roboto-Italic.ttf
Roboto-LightItalic.ttf
Roboto-Light.ttf
Roboto-MediumItalic.ttf
Roboto-Medium.ttf
Roboto-Regular.ttf
Roboto-ThinItalic.ttf
Roboto-Thin.ttf"
error () {
echo "!! ${@}"
exit 1
}
backup_font () {
if [ ! -d /system/fonts/Original ]; then
echo "Backup original Fonts"
mkdir -p /system/fonts/Original
for font in ${FONTFILES}; do
cp /system/fonts/${font} /system/fonts/Original/
done
fi
}
reset_font () {
echo "Restoring original Font"
if [ ${NO_MAGISK} -eq 0 ]; then
for font in ${FONTFILES}; do
rm -f ${FONTPATH}/${font}
done
else
for font in ${FONTFILES}; do
cp /system/fonts/Original/${font} /system/fonts/
done
rm -rf /system/fonts/Original
fi
}
set_font () {
echo "Setting Font ${1}"
if [ ${NO_MAGISK} -eq 0 ]; then
if [ -f ${OVERLAY_PATH}/NanoDroid/${1}.ttf ]; then
for font in ${FONTFILES}; do
ln -sf ${FONTPATH}/NanoDroid/${1}.ttf \
${OVERLAY_PATH}/${font} || \
error "Failed to apply Font ${1}"
done
else
error "Font ${1} does not exist"
fi
else
if [ -f /system/fonts/NanoDroid/${1}.ttf ]; then
backup_font
for font in ${FONTFILES}; do
ln -sf /system/fonts/NanoDroid/${1}.ttf \
/system/fonts/${font} || \
error "Failed to apply Font ${1}"
done
else
error "Font ${1} does not exist"
fi
fi
echo "Reboot to apply Font"
}
[[ $(whoami) != "root" ]] && error "not running as root"
case ${1} in
-s | --set )
set_font "${2}"
;;
-r | --reset )
reset_font
;;
* )
echo "nanodroid-font
Change System font
Usage: nanodroid-font [opt] [font]
where [opt] can be:
-s, --set [font] set Font
-r, --reset restore Original Font
where [font] can be:
FAST FAST RMX Game Font
NintendoLabo NintendoLabo Logo/Packaging Font
NintendoSwitch NintendoSwitch OS Font
Splatoon Splatoon Game Font
Splatoon2 Splatoon2 Game Font
SuperMario Super Mario (World) Game Font
SuperMarioMaker Super Mario Maker Game Font
SuperMarioOdyssey Super Mario Odyssey Game Font"
;;
esac

View File

@ -1,3 +0,0 @@
#!/system/bin/sh
nanodroid-font "${@}"

View File

@ -34,7 +34,6 @@ Table of Contents
* [NanoDroid-Prop](#nanodroid-prop)
* [NanoDroid-Perm](#nanodroid-perm)
* [NanoDroid-Util](#nanodroid-util)
* [NanoDroid-Font](#nanodroid-font)
* [init scripts](#init-scripts)
* [Shell Utilities](#shell-utilities)
* [GNU Bash and GNU Nano](#gnu-bash-and-gnu-nano)
@ -42,7 +41,6 @@ Table of Contents
* [F-Droid](#f-droid)
* [Applications](#applications)
* [The Legend of Zelda ringtones and sounds](#the-legend-of-zelda-ringtones-and-sounds)
* [Nintendo Fonts](#nintendo-fonts)
* [Installation](#installation)
* [Alter Installation](#alter-installation)
* [Installation Process](#installation-process)
@ -229,9 +227,7 @@ NanoDroid includes
* Addon.d support for System Mode installation
* restores NanoDroid after ROM update
* re-debloates GApps, if required
* restored NanoDroid-Font setup, if required
* The Legend of Zelda ringtones and sounds
* System UI fonts from several Nintendo games
## Packages
@ -375,12 +371,6 @@ The `nanodroid-util` script contains the following features
Full details on the NanoDroid-Util Script [> Details](doc/NanoDroidUtil.md)
#### NanoDroid-Font
The `nanodroid-font` script changes the Sytem UI font
Full details on the NanoDroid-Font Script [> Details](doc/NanoDroidFont.md)
#### init scripts
The following init scripts are bundled with NanoDroid
@ -498,12 +488,6 @@ NanoDroid includes **The Legend of Zelda** [> Nintendo](http://www.zelda.com/) r
Full [> Details](doc/ZeldaSounds.md)
### Nintendo Fonts
NanoDroid includes Nintendo Fonts.
Full [> Details](doc/NanoDroidFont.md)
## Installation
### Alter Installation
@ -763,8 +747,6 @@ Additional credits go to
* https://shadow53.com/android/no-gapps/
* ale5000 for GApps Removal list and native signature spoofing detection
* https://github.com/micro5k
* PaperYoshi for Nintendo Fonts
* http://downloads.paperyoshi.at/
* anestisb for vdexExtractor
* https://github.com/anestisb/vdexExtractor
* JesusFreke for smali/baksmali

View File

@ -32,7 +32,6 @@ nanodroid_nlpbackend=1000
nanodroid_bash=1
nanodroid_nano=1
nanodroid_utils=1
nanodroid_fonts=1
```
the **microG** package supports the following options (nanodroid_microg is always 1)
@ -143,7 +142,3 @@ whether to install GNU Nano Editor
`nanodroid_utils=[0|1]`
whether to install Shell Utils from util-linux and bsdmainutils
`nanodroid_fonts=[0|1]`
whether to install [NanoDroid-Font](NanoDroidFont.md) script and Nintendo Fonts

View File

@ -1,38 +0,0 @@
# NanoDroid-Font Script
## Purpose
The `nanodroid-font` Script, respectively it's shortcut `nfnt` is used to change the System UI font (reboot required to take effect)
## Invocation
From within a terminal on your device, for example `adb shell` or `Termux` invoke the script using either
`nanodroid-font [switch] [font]`
or
`nfnt [switch] [parameter]`
## Overview
`s`, `--set` [font]
set System UI font to [font], which is one of
* FAST FAST RMX Game Font
* NintendoLabo NintendoLabo Logo/Packaging Font
* NintendoSwitch NintendoSwitch OS Font
* Splatoon Splatoon Game Font
* Splatoon2 Splatoon2 Game Font
* SuperMario Super Mario (World) Game Font
* SuperMarioMaker Super Mario Maker Game Font
* SuperMarioOdyssey Super Mario Odyssey Game Font
`r`, `--reset`
reset to original font
## Credits
All fonts taken from http://downloads.paperyoshi.at/