diff --git a/install.sh b/install.sh index 9f0637f..4379a90 100644 --- a/install.sh +++ b/install.sh @@ -157,6 +157,7 @@ on_install() { unzip -o "$ZIPFILE" -d $TMPDIR >&2 cd $TMPDIR mv -f mm /data/media/0/ + mv language $MODPATH/language mv License* README* $MODPATH/ set +euxo pipefail diff --git a/language/Chinese b/language/Chinese new file mode 100644 index 0000000..f646e12 --- /dev/null +++ b/language/Chinese @@ -0,0 +1,21 @@ +#!/sbin/sh +string_info='[信息]' +string_warn='[警告]' +string_used_in_recovery_only='模块只能在Recovery中使用!' +string_no_magisk='未安装Magisk或不支持已安装的版本。' +string_list_installed_modules='列出已安装的模块' +string_toggle='切换' +string_core_only_mode='核心加载模式' +string_magic_mount='魔法挂载' +string_disable='禁用模块' +string_remove='卸载模块' +string_quit='退出' +string_installed_modules='已安装的模块' +string_press_enter='请按 键继续或者退出……' +string_goodbye='感谢使用!' +string_input_pattern='请输入模块名称 (例如., .表示所有模块, acc, or fbind|xpo|viper): ' +string_toggle_magic_mount='切换魔法挂载状态' +string_toggle_on_off='切换模块启用状态' +string_mark_for_removal='标记为移除' +string_core_only_mode_off='核心加载模式已禁用' +string_core_only_mode_on='核心加载模式已启用' \ No newline at end of file diff --git a/language/Origin b/language/Origin new file mode 100644 index 0000000..d696cc1 --- /dev/null +++ b/language/Origin @@ -0,0 +1,24 @@ +#!/sbin/sh +string_info='(i)' +string_warn='(!)' +string_info_mm='Magisk Manager for Recovery Mode (mm) 2019.4.4' +string_info_copyright='Copyright (C) 2017-2019, VR25 @ xda-developers' +string_info_license='License: GPLv3+' +string_used_in_recovery_only='This is meant to be used in recovery environment only!' +string_no_magisk='No Magisk installation found or installed version is not supported.' +string_list_installed_modules='List installed modules' +string_toggle='Toggle' +string_core_only_mode='Core only mode' +string_magic_mount='Magic mount' +string_disable='Disable' +string_remove='Remove' +string_quit='Quit' +string_installed_modules='Installed Modules' +string_press_enter='Press to continue or \"q \" to quit... ' +string_goodbye='Goodbye.' +string_input_pattern='Input pattern(s) (e.g., a dot for all, acc, or fbind|xpo|viper): ' +string_toggle_magic_mount='Toggle Magic Mount' +string_toggle_on_off='Toggle ON/OFF' +string_mark_for_removal='Mark for Removal' +string_core_only_mode_off='Core only mode [OFF]' +string_core_only_mode_on='Core only mode [ON]' \ No newline at end of file diff --git a/mm b/mm index 4dab44a..ba7690c 100644 --- a/mm +++ b/mm @@ -3,6 +3,22 @@ # Copyright (C) 2017-2019, VR25 @ xda-developers # License: GPLv3+ +languagePath=/data/adb/modules/mm +echo -n " +########################## +0) English +1) 简体中文 +########################## +" +read language_opt + +echo +source "$languagePath/language/Origin" +case $language_opt in +1) + source "$languagePath/language/Chinese" + ;; +esac main() { @@ -13,14 +29,14 @@ mountPath=/_magisk img=/data/adb/magisk.img [ -f $img ] || img=/data/adb/modules -echo -e "\nMagisk Manager for Recovery Mode (mm) 2019.4.4 -Copyright (C) 2017-2019, VR25 @ xda-developers -License: GPLv3+\n" +echo -e "\n$string_info_mm +$string_info_copyright +$string_info_license\n" trap 'exxit $?' EXIT if is_mounted /storage/emulated; then - echo -e "(!) This is meant to be used in recovery environment only!\n" + echo -e "$string_warn $string_used_in_recovery_only\n" exit 1 fi @@ -31,7 +47,7 @@ mount /data 2>/dev/null || : mount /cache 2>/dev/null || : if [ ! -d /data/adb/magisk ]; then - echo -e "(!) No Magisk installation found or installed version is not supported.\n" + echo -e "$string_warn $string_no_magisk\n" exit 1 fi @@ -52,15 +68,15 @@ options() { while :; do echo -n "########################## -l) List installed modules +l) $string_list_installed_modules ########################## -Toggle - c) Core only mode - m) Magic mount - d) Disable - r) Remove +$string_toggle + c) $string_core_only_mode + m) $string_magic_mount + d) $string_disable + r) $string_remove ########################## -q) Quit +q) $string_quit ########################## ?) " @@ -70,7 +86,7 @@ q) Quit case $opt in m) toggle_mnt;; d) toggle_disable;; - l) echo -e "Installed Modules\n"; ls_mods;; + l) echo -e "$string_installed_modules\n"; ls_mods;; r) toggle_remove;; q) exit 0;; c) toggle_com;; @@ -78,7 +94,7 @@ q) Quit break done - echo -en "\n(i) Press to continue or \"q \" to quit... " + echo -en "\n$string_info $string_press_enter" read opt [ -z "$opt" ] || exit 0 echo @@ -98,7 +114,7 @@ exxit() { rmdir $mountPath mount -o remount,ro / rm -rf $tmpDir - [ ${1:-0} -eq 0 ] && { echo -e "\nGoodbye.\n"; exit 0; } || exit $1 + [ ${1:-0} -eq 0 ] && { echo -e "\n$string_goodbye\n"; exit 0; } || exit $1 } 2>/dev/null @@ -110,7 +126,7 @@ toggle() { [ -f $mountPath/$mod/$file ] && echo "$present]" || echo "$absent]" done - echo -en "\nInput pattern(s) (e.g., a dot for all, acc, or fbind|xpo|viper): " + echo -en "\n$string_input_pattern" read input echo @@ -124,20 +140,20 @@ toggle() { toggle_mnt() { - echo -e "Toggle Magic Mount\n" + echo -e "$string_toggle_magic_mount\n" [ -f $img ] && { toggle auto_mount ON OFF || :; } \ || toggle skip_mount OFF ON } toggle_disable() { - echo -e "Toggle ON/OFF\n" + echo -e "$string_toggle_on_off\n" toggle disable OFF ON } toggle_remove() { - echo -e "Mark for Removal ([X])\n" + echo -e "$string_mark_for_removal ([X])\n" toggle remove X " " } @@ -145,10 +161,10 @@ toggle_remove() { toggle_com() { if [ -f /cache/.disable_magisk ] || [ -f /data/cache/.disable_magisk ]; then rm /data/cache/.disable_magisk /cache/.disable_magisk 2>/dev/null || : - echo "(i) Core only mode [OFF]" + echo "$string_info $string_core_only_mode_off" else touch /data/cache/.disable_magisk /cache/.disable_magisk 2>/dev/null || : - echo "(i) Core only mode [ON]" + echo "$string_info $string_core_only_mode_on" fi }