├── .config ├── aria2.conf ├── dht.dat └── dht6.dat ├── .gitignore ├── .mirror ├── ariang.png ├── github.sh ├── icon.png └── move.sh ├── LICENSE ├── Licenses ├── LICENSE └── tmoe-linux │ └── LICENSE ├── README.en.md ├── README.md ├── debian.sh ├── install.sh ├── manager.sh ├── share ├── app │ ├── novnc │ ├── termux │ ├── tmoe │ └── vnc ├── completion │ ├── _tmoe │ └── version.txt ├── compression │ ├── backup │ └── restore ├── configuration │ ├── dns │ │ ├── ali │ │ ├── baidu │ │ ├── cfiec │ │ ├── cloudflare │ │ ├── google │ │ └── tuna │ ├── menu │ └── mirror-list │ │ ├── arch │ │ ├── aarch64 │ │ │ └── mirrorlist │ │ └── x86_64 │ │ │ └── mirrorlist │ │ ├── debian │ │ ├── mirror.list │ │ ├── sid.list │ │ ├── sources.list │ │ └── url.list │ │ └── ubuntu │ │ ├── amd64 │ │ └── sources.list │ │ └── url.list ├── container │ ├── chroot │ │ ├── notes │ │ └── startup │ ├── common │ ├── debian │ │ ├── debian │ │ ├── lnk-menu │ │ └── menu │ ├── install │ ├── list │ ├── menu │ ├── nspawn │ │ └── startup │ ├── proot │ │ ├── check_container_arch │ │ ├── management │ │ └── startup │ ├── qemu │ │ └── qemu-user │ └── remove ├── deprecated │ └── remove ├── environment │ ├── dependencies │ ├── locale │ └── manager_environment ├── frequently_asked_questions │ └── faq ├── removal │ ├── menu │ └── umount └── termux │ ├── backup │ ├── menu │ ├── mirror │ ├── restore │ ├── space_occupation │ ├── termux │ ├── update │ ├── video_tutorial │ └── xfce ├── tool.sh ├── tools ├── app │ ├── beta_features.sh │ ├── browser.sh │ ├── center.sh │ ├── education.sh │ ├── input-method.sh │ ├── lnk │ │ └── tmoe-linux.desktop │ ├── office │ └── terminal ├── code │ ├── bin │ │ └── codium │ ├── dev-menu │ ├── lnk │ │ ├── codium.desktop │ │ └── intellij-idea-ultimate-edition.desktop │ └── vscode.sh ├── downloader │ ├── aria2.sh │ ├── thunder │ ├── videos.sh │ └── work_crawler@kanasimi.sh ├── environment.sh ├── gui │ ├── config │ │ └── xfce4-panel.xml │ ├── faq.sh │ ├── gui.sh │ ├── launch_dbus_daemon │ ├── startvnc │ ├── startx11vnc │ ├── startxsdl │ ├── stopvnc │ ├── vncserver-config-defaults │ ├── wsl │ ├── wsl_pulse_audio │ └── x11vncpasswd ├── optimization │ └── compress_pictures ├── other │ └── frequently_asked_questions.sh ├── sources │ ├── deb-installer │ ├── debian-opt.sh │ ├── mirror.sh │ └── opt-bin │ │ ├── opt │ │ ├── Gridea │ │ │ └── gridea │ │ └── draw.io │ │ │ └── drawio │ │ └── usr │ │ └── bin │ │ ├── chord │ │ ├── cocomusic │ │ ├── electron-netease-cloud-music │ │ ├── iease-music │ │ ├── listen1 │ │ ├── lossless-cut │ │ ├── lx-music-desktop │ │ ├── marktext │ │ ├── netron │ │ ├── petal │ │ ├── picgo │ │ ├── simplenote │ │ └── zy-player ├── system │ ├── network.sh │ └── sys-menu.sh ├── virtualization │ ├── anbox.sh │ ├── docker.sh │ ├── iso.sh │ ├── qemu │ │ ├── startqemu │ │ └── tmoe-qemu │ ├── vbox.sh │ ├── virt-menu │ └── wine32.sh └── webserver │ ├── filebrowser.sh │ └── nginx-webdav.sh └── zsh.sh /.config/dht.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foundations/tmoe-linux/e1427cb68a69c6fb7f375c9c3738ec14cd5db10e/.config/dht.dat -------------------------------------------------------------------------------- /.config/dht6.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foundations/tmoe-linux/e1427cb68a69c6fb7f375c9c3738ec14cd5db10e/.config/dht6.dat -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/launch.json 2 | .vscode/ 3 | test.sh 4 | recycle_bin 5 | recycle_bin/新版已废弃的代码.sh 6 | tmoe_file.sh 7 | recycle_bin.sh 8 | 233.sh 9 | 233,sh 10 | test.xml 11 | LANG 12 | file.conf 13 | aria2.session 14 | .config/aria2_test.conf 15 | server_test.sh 16 | test/ 17 | test02.sh -------------------------------------------------------------------------------- /.mirror/ariang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foundations/tmoe-linux/e1427cb68a69c6fb7f375c9c3738ec14cd5db10e/.mirror/ariang.png -------------------------------------------------------------------------------- /.mirror/github.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | cd .. 4 | SHELL_FILE=$(find ./* | grep sh | tr '\n' ' ' | cut -d '%' -f 1) 5 | ALL_SHARE_FILE=$(find ./share/* | tr '\n' ' ' | cut -d '%' -f 1) 6 | unset ALL_SHELL_FILE 7 | for i in ${SHELL_FILE}; do 8 | if [ ! -d "${i}" ]; then 9 | ALL_SHELL_FILE="${ALL_SHELL_FILE} ${i}" 10 | fi 11 | done 12 | printf "%s\n" "$ALL_SHELL_FILE" 13 | unset SHARE_FILE 14 | for i in ${ALL_SHARE_FILE}; do 15 | if [ ! -d "${i}" ]; then 16 | SHARE_FILE="${SHARE_FILE} ${i}" 17 | fi 18 | done 19 | printf "%s\n" "$SHARE_FILE" 20 | 21 | #sed -i 's/zh_CN/en_US/g' ./*sh 22 | INSTALL_FILE=./share/container/install 23 | sed -i 's/zh_CN/en_US/g' ${ALL_SHELL_FILE} 24 | sed -i 's/zh_CN/en_US/g' ./tools/gui/start* 25 | sed -i 's/zh_CN/en_US/g' ${SHARE_FILE} 26 | sed -i 's/zh_CN/en_US/g' ${INSTALL_FILE} 27 | #sed -i 's@en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/@zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/@' ./*sh tools/*/* 28 | ######### 29 | #sed -i 's@en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/@zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/@' ${ALL_SHELL_FILE} 30 | #sed -i 's@a\\\en_US.UTF-8 UTF-8@a\\\zh_CN.UTF-8 UTF-8@' ${ALL_SHELL_FILE} 31 | ############ 32 | #sed -i 's@a\\\en_US.UTF-8 UTF-8@a\\\zh_CN.UTF-8 UTF-8@' tool.sh tools/*/* 33 | 34 | #gentoo_lang 35 | sed -i 's@en_US en_US@en_US zh_CN@g' ${INSTALL_FILE} 36 | #sed -i 's@translation-update-en_US@translation-update-zh_CN@' ${INSTALL_FILE} 37 | #sed -i 's@\^en_US@\^zh_CN@' tool.sh tools/*/* 38 | #sed -i 's@\^en_US@\^zh_CN@' ${ALL_SHELL_FILE} 39 | 40 | #sed -i 's@locale-gen en_US@locale-gen zh_CN@g' ./*sh tools/*/* 41 | 42 | sed -i 's/114.114.114.114/1.0.0.1/' ${INSTALL_FILE} 43 | sed -i 's/240c::6666/2606:4700:4700::1111/' ${INSTALL_FILE} 44 | sed -i 's@gitee.com/mo2/fzf-tab@github.com/Aloxaf/fzf-tab@g' zsh.sh 45 | sed -i 's@gitee.com/mirrors/neofetch/raw/master/neofetch@raw.githubusercontent.com/dylanaraps/neofetch/master/neofetch@g' ${INSTALL_FILE} zsh.sh 46 | sed -i 's@gitee.com/mirrors/oh-my-zsh/raw/master/templates/zshrc.zsh-template@raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/templates/zshrc.zsh-template@g' ${INSTALL_FILE} zsh.sh 47 | sed -i 's@gitee.com/mirrors/oh-my-zsh.git@github.com/ohmyzsh/ohmyzsh.git@g' ${INSTALL_FILE} zsh.sh 48 | #sed -i 's@gitee.com/mo2/zsh/raw/master/@raw.githubusercontent.com/2moe/tmoe-zsh/master/@g' ./*sh 49 | sed -i 's@gitee.com/mo2/zsh/raw/master/@raw.githubusercontent.com/2moe/tmoe-zsh/master/@g' ${ALL_SHELL_FILE} 50 | sed -i 's@gitee.com/mo2/zsh/raw/master/@raw.githubusercontent.com/2moe/tmoe-zsh/master/@g' ${SHARE_FILE} 51 | 52 | sed -i 's@gitee.com/mo2/linux/raw/master/@raw.githubusercontent.com/2moe/tmoe-linux/master/@g' ${ALL_SHELL_FILE} 53 | sed -i 's@gitee.com/mo2/linux/raw/master/@raw.githubusercontent.com/2moe/tmoe-linux/master/@g' ${SHARE_FILE} 54 | 55 | sed -i 's@gitee.com/mo2/linux.git@github.com/2moe/tmoe-linux.git@g' ${SHARE_FILE} 56 | sed -i 's@gitee.com/mo2/linux.git@github.com/2moe/tmoe-linux.git@g' ${ALL_SHELL_FILE} 57 | 58 | sed -i '/正在配置中文环境/d' ${INSTALL_FILE} 59 | sed -i 's@###tmoe-github@@' ${INSTALL_FILE} zsh.sh 60 | #sed -i 's@gitee.com/mo2/linux/raw/master/@raw.githubusercontent.com/2moe/tmoe-linux/master/@g' ./*sh ./tool/*sh tools/*/* tools/environment.sh 61 | 62 | sed -i 's@gitee.com/mo2/linux\"@github.com/2moe/tmoe-linux\"@' ${ALL_SHELL_FILE} 63 | sed -i 's@gitee.com/mo2/linux\"@github.com/2moe/tmoe-linux\"@' ${SHARE_FILE} 64 | sed -i 's@https://gitee.com/mo2/linux/issues@https://github.com/2moe/tmoe-linux/issues@g' manager.sh 65 | sed -i 's@gitee.com/romkatv/powerlevel10k@github.com/romkatv/powerlevel10k@g' ${INSTALL_FILE} zsh.sh 66 | sed -i 's@gitee.com/mo2/zsh-syntax-highlighting@github.com/zsh-users/zsh-syntax-highlighting@g' ${INSTALL_FILE} zsh.sh 67 | sed -i 's@gitee.com/mo2/zsh-autosuggestions@github.com/zsh-users/zsh-autosuggestions@g' ${INSTALL_FILE} zsh.sh 68 | #sed -i 's@gitee.com/mo2/linux@github.com/2moe/tmoe-linux@g' ./*sh ./tool/*sh tools/*/* 69 | -------------------------------------------------------------------------------- /.mirror/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foundations/tmoe-linux/e1427cb68a69c6fb7f375c9c3738ec14cd5db10e/.mirror/icon.png -------------------------------------------------------------------------------- /.mirror/move.sh: -------------------------------------------------------------------------------- 1 | cd ~/gitee/linux 2 | COUNT=$(curl -L https://gitee.com/mo2/linux | grep 次提交 | awk '{print $1}') 3 | case ${COUNT} in 4 | "") ;; 5 | *) 6 | COMMIT_COUNT=$((${COUNT} + 1)) 7 | sed -i -E "s@(tmoe linux manager) v1.*?,@\1 v1.${COMMIT_COUNT},@g" manager.sh 8 | sed -i -E "s@(tmoe linux tool) v1.*?,@\1 v1.${COMMIT_COUNT},@g" tool.sh 9 | ;; 10 | esac 11 | cp -r .gitignore debian.sh install.sh tool.sh zsh.sh manager.sh Licenses share .mirror tools .config ~/github/github-linux 12 | cd ~/github/github-linux/.mirror 13 | ./github.sh 14 | #printf '%s\n' 'git commit -am ' 15 | code ~/github/github-linux 16 | -------------------------------------------------------------------------------- /Licenses/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /Licenses/tmoe-linux/LICENSE: -------------------------------------------------------------------------------- 1 | End-user license agreement 2 | Tmoe-linux Tool(以下简称“本工具”)尊重并保护所有使用服务的用户的个人隐私权。 3 | 本工具遵循GNU General Public License v2.0 (开源许可协议),旨在追求开放和自由。 4 | 由于恢复包未存储于git仓库,而存储于第三方网盘,故您必须承担并知悉其中的风险。 5 | 强烈建议您选择更为安全的安装方式,即从软件源镜像站下载容器镜像,再自行选择安装内容。 6 | 本工具的开发者郑重承诺:恢复包内的系统不会使用和披露您的个人信息,也不存在任何侵害您个人隐私的行为。 7 | 本工具会不时更新本协议,您在同意本工具服务使用协议之时,即视为您已经同意本协议全部内容。本协议属于本工具服务使用协议不可分割的一部分。 8 | This tool will update this agreement from time to time. When you agree to this tool service use agreement, you are deemed to have agreed to the entire contents of this agreement. This agreement is an integral part of the tool service agreement. 9 | 10 | 1.禁止条例 11 | (a)禁止将本工具安装的GNU/Linux用于违法行为,例如:网络渗透、社会工程、域名未备案私自设立商用web服务等。 12 | Do not use GNU/Linux installed by this tool for illegal behavior! 13 | 14 | 2. 适用范围 15 | (a)在您使用本工具时,通过第三方网盘下载的恢复包系统; 16 | (b)在您使用本工具时,通过清华镜像站安装的基础系统。 17 | 您了解并同意,以下信息不适用本许可协议: 18 | (a)您在本工具的相关网站发布的有关信息数据,包括但不限于参与活动、点赞信息及评价详情; 19 | (b)违反法律规定或违反本工具规则行为及本工具已对您采取的措施。 20 | 21 | 3. 信息使用 22 | (a)本工具不会收集或向任何无关第三方提供、出售、出租、分享或交易您的个人信息。 23 | This tool will not collect or provide, sell, rent, share or trade your personal information to an unrelated third party. 24 | (b)本工具亦不允许任何第三方以任何手段收集、编辑、出售或者无偿传播您的个人信息。 25 | 26 | 4.下载说明 27 | (a)第三方网盘内的文件有可能由于网站被黑、文件失效、文件被替换、网站服务器出错等原因而导致下载出错或下载内容被劫持,故本工具在解压前会自动校验文件的sha256哈希值。 28 | (b)强烈建议您选择更为安全的安装方式,即从软件源镜像站下载容器镜像,再自行选择安装内容。 29 | 30 | 5. 关于美化和配置功能 31 | (a)本工具会为您提供个性化服务,您可以安装、配置软件和主题美化。 32 | (b)本工具为部分第三方软件提供安装、配置和管理功能,并尽量保持此类软件的纯净性。 33 | (c)本工具同时提供了一些原创的内容,开发者不对您使用本工具所进行的任何行为负责。 34 | (d)请您自行承担使用第三方软件的后果,开发者不对这些软件造成的后果负责,也不对您使用这些软件进行的违法行为负责。 35 | 36 | 6. 恢复包的使用 37 | (a)在您未拒绝接受恢复包的情况下,本工具会将恢复包下载至内置存储设备,并将其解压出来,以便您能快速安装并使用Debian GNU/Linux的图形桌面环境。 38 | (b)您有权选择接受或拒绝使用恢复包或本工具。 39 | 40 | 7. 信息安全 41 | (a)本工具安装的是原生GNU/Linux 系统,截至2020-03-12,默认没有开启安全保护和防火墙功能,请您妥善保管root密码及其它重要账号信息。 42 | 同时希望您能注意在信息网络上不存在“绝对完善的安全措施”。 43 | 44 | 8.卸载说明 45 | (a)您在移除容器前,必须先停止容器进程。 46 | (b)由于在测试chroot容器的过程中,出现了部分已挂载目录无法强制卸载的情况,故本工具在移除容器前会进行检测,并给出相关提示。 47 | 建议您在移除前进行备份,若因操作不当而导致数据丢失,开发者概不负责! 48 | 49 | 9.最终用户许可协议的更改 50 | (a)如果决定更改最终用户许可协议,我们会在本协议中、本工具网站中以及我们认为适当的位置发布这些更改,以便您了解如何保障我们双方的权益。 51 | (b)本工具开发者保留随时修改本协议的权利,因此建议您不定期查看。 52 | The developer of this tool reserves the right to modify this agreement at any time. -------------------------------------------------------------------------------- /README.en.md: -------------------------------------------------------------------------------- 1 | # 🍭Tmoe-linux 2 | 3 | ## Description 4 | 5 | 🍸 Support for installing GNU/Linux containers on termux and GNU/Linux. 6 | The following containers are now **supported**: 7 | 8 | - [x] **Debian stable+sid** 9 | - [x] **Ubuntu LTS+dev** 10 | - [x] **Kali rolling** 11 | - [x] **Arch** 12 | - [x] **Fedora** 13 | - [x] **CentOS** 14 | - [x] **Gentoo** 15 | - [x] **Funtoo** 16 | - [x] **Alpine edge** 17 | - [x] **OpenSUSE tumbleweed** 18 | - [x] **Void** 19 | - [x] **Raspios** 20 | - [x] **Mint** 21 | - [x] **Devuan** 22 | - [x] **Slackware** 23 | - [x] **Armbian** 24 | 25 | ## Installation 26 | 27 | If you are using Android, then you can go to Google Play to install the latest version of Termux and Termux: api. 28 | 29 | The script can automatically configure the Pulseaudio server for Android and Win10. Make everything very simple. 30 | 31 | > Tmoe-linux is installed by running one of the following commands in your terminal. You can install this via the command-line with either curl or wget. 32 | 33 | ### **via curl** 34 | 35 | ```shell 36 | apt install -y curl 37 | bash -c "$(curl -Lv 'https://git.io/linux.sh')" 38 | ``` 39 | 40 | ### **via wget** 41 | 42 | ```shell 43 | apt update 44 | apt install -y wget 45 | bash -c "$(wget -O- 'https://git.io/linux.sh')" 46 | ``` 47 | 48 | After installing the container, you can type `debian` to start any system. 49 | The developer did not do multi-system configuration, all system startup commands are `debian` 50 | Whether in the container or the original system,you can start the toolbox by typing `debian-i`. 51 | 52 | After installing the GUI, you can start vnc by typing `startvnc`,and you can start XServer by typing `startxsdl`. 53 | 54 | If you are using Android,it is recommended that you install a VNC client. 55 | [Google Play](https://play.google.com/store/apps/details?id=com.realvnc.viewer.android) 56 | 57 | If you are using WSL2,it is recommended that you use the X server. 58 | -------------------------------------------------------------------------------- /debian.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ -z ${TMPDIR} ]; then 3 | TMPDIR=/tmp 4 | mkdir -p ${TMPDIR} 5 | fi 6 | cd ${TMPDIR} 7 | ############# 8 | install_dependency() { 9 | INSTALL_COMMAND="apt install -y ${DEPENDENCY_01} || apk add ${DEPENDENCY_01} || xbps-install -S -y ${DEPENDENCY_01} || port install ${DEPENDENCY_01} || guix package -i ${DEPENDENCY_01} || pkg install ${DEPENDENCY_01} || pkg_add ${DEPENDENCY_01} || pkgutil -i ${DEPENDENCY_01} || pacman -S ${DEPENDENCY_01} || dnf install ${DEPENDENCY_01} || eopkg install ${DEPENDENCY_01} || opkg install wget libustream-openssl ca-bundle ca-certificates bash || zypper in ${DEPENDENCY_01}" 10 | if [ $(command -v sudo) ]; then 11 | sudo su -c "apt update 2>/dev/null || apk update 2>/dev/null || opkg update 2>/dev/null" 12 | sudo su -c "${INSTALL_COMMAND}" 13 | elif [ $(command -v su) ]; then 14 | su -c "apt update 2>/dev/null || apk update 2>/dev/null || opkg update 2>/dev/null" 15 | su -c "${INSTALL_COMMAND}" 16 | else 17 | apt update 2>/dev/null || apk update 2>/dev/null || opkg update 2>/dev/null 18 | apt install -y ${DEPENDENCY_01} || apk add ${DEPENDENCY_01} || xbps-install -S -y ${DEPENDENCY_01} || port install ${DEPENDENCY_01} || guix package -i ${DEPENDENCY_01} || pkg install ${DEPENDENCY_01} || pkg_add ${DEPENDENCY_01} || pkgutil -i ${DEPENDENCY_01} || pacman -S ${DEPENDENCY_01} || dnf install ${DEPENDENCY_01} || eopkg install ${DEPENDENCY_01} || opkg install wget libustream-openssl ca-bundle ca-certificates bash || zypper in ${DEPENDENCY_01} 19 | fi 20 | } 21 | ######### 22 | tuna_mirror() { 23 | if [ "${LANG}" = "$(printf '%s\n' 'emhfQ04uVVRGLTgK' | base64 -d)" ]; then 24 | #ALPINE_SOURCE_LIST=/etc/apk/repositories 25 | #cp ${ALPINE_SOURCE_LIST} ${ALPINE_SOURCE_LIST}.bak 2>/dev/null 26 | #sed -i "S@dl-cdn.alpinelinux.org@${CHINA_MIRROR}@g" ${ALPINE_SOURCE_LIST} 2>/dev/null 27 | CHINA_MIRROR='mirrors.huaweicloud.com' 28 | SOURCE_LIST=/etc/apt/sources.list 29 | if ! grep -q 'deb mirrors' ${SOURCE_LIST} 2>/dev/null; then 30 | cp ${SOURCE_LIST} ${SOURCE_LIST}.bak 2>/dev/null 31 | sed -i "s@deb.debian.org@${CHINA_MIRROR}@g" ${SOURCE_LIST} 2>/dev/null 32 | sed -i "s@archive.ubuntu.com@${CHINA_MIRROR}@g" ${SOURCE_LIST} 2>/dev/null 33 | sed -i "s@ports.ubuntu.com@${CHINA_MIRROR}@g" ${SOURCE_LIST} 2>/dev/null 34 | sed -i 's@^@#&@g' ${SOURCE_LIST}.bak 2>/dev/null 35 | sed -n p ${SOURCE_LIST}.bak >>${SOURCE_LIST} 2>/dev/null 36 | fi 37 | fi 38 | case ${TMOE_DOCKER} in 39 | true) 40 | if grep -q 'Gentoo' /etc/os-release 2>/dev/null; then 41 | emerge-webrsync 42 | elif grep -q 'openSUSE' /etc/os-release 2>/dev/null; then 43 | zypper in -y glibc-locale glibc-i18ndata 44 | fi 45 | ;; 46 | esac 47 | } 48 | ######### 49 | tmoe_locale_gen() { 50 | #if [ ! -z "${LANG}" ]; then 51 | TMOE_LANG_HALF=$(printf '%s\n' "${LANG}" | cut -d '.' -f 1) 52 | TMOE_LANG_QUATER=$(printf '%s\n' "${LANG}" | cut -d '.' -f 1 | cut -d '_' -f 1) 53 | if ! grep -qi "^${TMOE_LANG_HALF}" "/etc/locale.gen" 2>/dev/null; then 54 | if [ ! $(command -v locale-gen) ]; then 55 | apt update 2>/dev/null 56 | apt install -y locales 2>/dev/null 57 | fi 58 | apt install -y ^language-pack-${TMOE_LANG_QUATER} 2>/dev/null 59 | dnf install -y --skip-broken "glibc-langpack-${TMOE_LANG_QUATER}*" glibc-minimal-langpack 2>/dev/null || yum install -y --skip-broken "glibc-langpack-${TMOE_LANG_QUATER}*" glibc-minimal-langpack 2>/dev/null 60 | pacman -Sy glibc 2>/dev/null 61 | sed -i "s/^#.*${LANG} UTF-8/${LANG} UTF-8/" /etc/locale.gen 2>/dev/null 62 | locale-gen ${LANG} 63 | fi 64 | if ! grep -qi "^${TMOE_LANG_HALF}" "/etc/locale.gen" 2>/dev/null; then 65 | cd /etc 66 | printf "\n" >>locale.gen 67 | sed -i 's@^@#&@g' locale.gen 2>/dev/null 68 | sed -i 's@##@#@g' locale.gen 2>/dev/null 69 | sed -i "$ a ${LANG} UTF-8" locale.gen 70 | locale-gen ${LANG} 71 | cd ${TMPDIR} 72 | fi 73 | #fi 74 | } 75 | ############ 76 | if [ $(command -v curl) ]; then 77 | curl -Lvo .tmoe-linux.sh https://raw.githubusercontent.com/2moe/tmoe-linux/master/manager.sh 78 | elif [ $(command -v aria2c) ]; then 79 | aria2c --no-conf --allow-overwrite=true -o .tmoe-linux.sh https://raw.githubusercontent.com/2moe/tmoe-linux/master/manager.sh 80 | elif [ $(command -v wget) ]; then 81 | wget -O .tmoe-linux.sh https://raw.githubusercontent.com/2moe/tmoe-linux/master/manager.sh 82 | else 83 | #带三个#为docker容器专用 84 | ###tuna_mirror 85 | DEPENDENCY_01='wget' 86 | install_dependency 87 | wget -O .tmoe-linux.sh https://raw.githubusercontent.com/2moe/tmoe-linux/master/manager.sh 88 | fi 89 | #用于docker容器自动配置区域与语言环境。 90 | ###tmoe_locale_gen 91 | if [ $(command -v bash) ]; then 92 | bash .tmoe-linux.sh 93 | else 94 | DEPENDENCY_01="bash" 95 | install_dependency 96 | bash .tmoe-linux.sh 97 | fi 98 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #################### 3 | printf "\033[31m%s \033[0;35m%s\n" "You are using an old version." "Please update to the latest version" 4 | printf "\033[0;35m%s \033[31m%s\n" "请您更新至最新版!" "旧版已经无法再安装了!!!" 5 | -------------------------------------------------------------------------------- /share/app/novnc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ################# 3 | install_python_web_novnc() { 4 | case $(uname -o) in 5 | Android) 6 | if [ ! -e "${PREFIX}/bin/python" ]; then 7 | printf "%s\n" "Press enter to install python and numpy." 8 | press_enter_to_continue 9 | apt update 10 | apt install -y python 11 | python3 -m pip install -i https://mirrors.bfsu.edu.cn/pypi/web/simple --upgrade -vvv pip 12 | fi 13 | ;; 14 | esac 15 | case "${LINUX_DISTRO}" in 16 | debian) 17 | if [ ! -e "/usr/bin/python3" ]; then 18 | sudo apt install -y python3 || su -c 'apt install -y python3' 19 | sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1 || su -c "update-alternatives --install /usr/bin/python python /usr/bin/python3 1" 20 | fi 21 | 22 | if [ ! -e "/usr/bin/python" ]; then 23 | sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1 || su -c "update-alternatives --install /usr/bin/python python /usr/bin/python3 1" 24 | fi 25 | [[ $(command -v netstat) ]] || sudo apt install net-tools 26 | ;; 27 | *) 28 | [[ $(command -v python3) ]] || ${TMOE_INSTALLATION_COMMAND} python3 29 | [[ $(command -v netstat) ]] || ${TMOE_INSTALLATION_COMMAND} net-tools 30 | ;; 31 | esac 32 | 33 | if [[ ! $(pip3 list | grep numpy) ]]; then 34 | case $(uname -o) in 35 | Android) 36 | cd ${TMPDIR} 37 | curl -LO https://its-pointless.github.io/setup-pointless-repo.sh 38 | bash setup-pointless-repo.sh 39 | apt install -y numpy 40 | ;; 41 | *) 42 | python3 -m pip install --upgrade pip 43 | pip3 install -i https://mirrors.bfsu.edu.cn/pypi/web/simple -vvv numpy 44 | ;; 45 | esac 46 | fi 47 | 48 | if [ ! -e "${HOME}/.vnc/utils/launch.sh" ]; then 49 | [[ -e ${HOME}/.vnc ]] || mkdir -p ${HOME}/.vnc 50 | cd ${HOME}/.vnc 51 | DEB_REPO_URL='https://mirrors.bfsu.edu.cn/debian/pool/main/n/novnc/' 52 | THE_LATEST_FILE_VERSION=$(curl -L ${DEB_REPO_URL} | grep -v python | grep novnc | grep '\.deb' | grep all | awk -F '=' '{print $3}' | cut -d '"' -f 2 | tail -n 1) 53 | THE_LATEST_DEB_LINK="${DEB_REPO_URL}${THE_LATEST_FILE_VERSION}" 54 | aria2c --no-conf -x 3 -k 1M --split=5 --allow-overwrite=true -o 'novnc.deb' "${THE_LATEST_DEB_LINK}" 55 | if [ $(command -v dpkg-deb) ]; then 56 | dpkg-deb -X novnc.deb ./ || sudo dpkg-deb -X novnc.deb ./ 57 | else 58 | ar xv novnc.deb 59 | tar -Jxvf novnc.deb 60 | fi 61 | cp -prf ./usr/share/novnc/* ./ || sudo cp -prf ./usr/share/novnc/* ./ 62 | cp -rf ./usr/share/doc ./ || sudo cp -rf ./usr/share/doc ./ 63 | rm -rf ./usr || sudo rm -rf ./usr 64 | fi 65 | start_web_novnc 66 | } 67 | ####################### 68 | start_web_novnc() { 69 | cd ${HOME}/.vnc/utils/ 70 | if [ ! -d "websockify" ]; then 71 | git clone git://github.com/novnc/websockify.git --depth=1 ./websockify || sudo git clone git://github.com/novnc/websockify.git --depth=1 ./websockify 72 | #printf "%s\n" "克隆失败,请在退出脚本后,输sudo debian-i以root身份重新运行本脚本" 73 | fi 74 | cat <<-EOF 75 | vncserver的默认端口为5901,novnc 的默认端口为6080 76 | Before starting novnc, you must know the following: 1. NOVNC can connect without installing a client. 2. You can use the Bluetooth mouse to operate on the local browser, or you can use the browser of other devices to open the local novnc address. 77 | 在启动novnc之前,您必须知悉novnc无需安装客户端,您可以使用蓝牙鼠标在本机浏览器上进行操作,亦可使用其它设备的浏览器打开本机的novnc地址。 78 | 如需启动vnc app,而非web端,那么您下次可以输startvnc 79 | 若无声音,则请输stopvnc并重启终端。 80 | 正在为您启动novnc 81 | Starting novnc server,please be patient. 82 | EOF 83 | bash launch.sh --vnc localhost:5901 --listen 6080 & 84 | if [ "$(uname -o)" = 'Android' ]; then 85 | am start -a android.intent.action.VIEW -d "http://localhost:6080/vnc.html" 86 | elif [ "${WINDOWS_DISTRO}" = "WSL" ]; then 87 | /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe "start http://localhost:6080/vnc.html" 88 | else 89 | su "${CURRENT_USER_NAME}" -c "xdg-open http://localhost:6080/vnc.html 2>/dev/null" 90 | fi 91 | TMOE_IP_ADDR=$(ip -4 -br -c a | awk '{print $NF}' | cut -d '/' -f 1 | grep -v '127\.0\.0\.1' | sed "s@\$@:6080/vnc.html@") 92 | cat <<-EOF 93 | 本机默认novnc地址${YELLOW}http://localhost:6080/vnc.html${RESET} 94 | The LAN VNC address 局域网地址${TMOE_IP_ADDR} 95 | 注意:novnc地址和vnc地址是${YELLOW}不同${RESET}的,请在${YELLOW}浏览器${RESET}中输入novnc地址。 96 | Do not forget /vnc.html after the port number. 97 | 非本机(如局域网内的pc)需要输局域网novnc地址,不要忘记端口号后的/vnc.html 98 | EOF 99 | if [ -d "${DEBIAN_CHROOT}" ]; then 100 | ${TMOE_PREFIX} touch ${DEBIAN_CHROOT}/root/.vnc/startvnc 101 | ${PREFIX}/bin/debian 102 | else 103 | startvnc 104 | fi 105 | #注:必须要先启动novnc后,才能接着启动VNC。 106 | #否则将导致安卓proot容器提前启动。 107 | } 108 | ################# 109 | install_python_web_novnc $@ 110 | -------------------------------------------------------------------------------- /share/app/termux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | aria2_download_termux() { 4 | cd /sdcard/Download 5 | if [ -f "com.termux_Fdroid.apk" ]; then 6 | if (whiptail --title "检测到文件已下载,请选择您需要执行的操作!" --yes-button 'install(* ̄▽ ̄*)o' --no-button 'Upgrade(っ °Д °)' --yesno "Detected that the file has been downloaded, do you want to install it, or download it again?" 7 60); then 7 | install_termux_apk 8 | else 9 | download_termux_apk_again 10 | fi 11 | else 12 | download_termux_apk_again 13 | fi 14 | return 0 15 | } 16 | ####################################### 17 | download_termux_apk_again() { 18 | printf "%s\n" "${YELLOW}按回车键开始下载${RESET}" 19 | do_you_want_to_continue 20 | printf '%s\n' 'Downloading termux apk...' 21 | printf '%s\n' '正在为您下载至/sdcard/Download目录...' 22 | printf '%s\n' '下载完成后,需要您手动安装。' 23 | aria2c --no-conf -x 16 -k 1M --split=16 --allow-overwrite=true -o "com.termux_Fdroid.apk" 'https://apk.tmoe.me/termux' || aria2c --no-conf -x 16 -k 1M --split=16 --allow-overwrite=true -o "com.termux_Fdroid.apk" 'https://apk.tmoe.me/termux' 24 | install_termux_apk 25 | } 26 | install_termux_apk() { 27 | printf "%s\n" "${YELLOW}下载完成,请进入下载目录手动安装。${RESET}" 28 | am start -n com.android.documentsui/com.android.documentsui.ViewDownloadsActivity 29 | cd ${CURRENT_DIR} 30 | } 31 | ################################## 32 | aria2_download_termux $@ 33 | -------------------------------------------------------------------------------- /share/app/tmoe: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ############################################# 3 | tmoe_main() { 4 | case "$1" in 5 | p* | proot) 6 | source_tmoe_env 7 | TMOE_CHROOT='false' 8 | ;; 9 | c* | chroot) 10 | source_tmoe_env 11 | TMOE_CHROOT='true' 12 | ;; 13 | systemd | sd | systemctl | ns | nspawn) 14 | source_tmoe_env 15 | SYSTEMD_NSPAWN='true' 16 | TMOE_CHROOT='true' 17 | ;; 18 | zsh) 19 | zsh-i 20 | exit 0 21 | ;; 22 | theme) 23 | zshtheme 24 | exit 0 25 | ;; 26 | aria2) 27 | aria2-i 28 | exit 0 29 | ;; 30 | i | -i) 31 | debian-i 32 | exit 0 33 | ;; 34 | m | manager | "") 35 | check_manager_dir 36 | bash ${MANAGER_DIR}/manager.sh 37 | exit 0 38 | ;; 39 | t | tool) 40 | check_manager_dir 41 | bash ${MANAGER_DIR}/tool.sh 42 | exit 0 43 | ;; 44 | -h* | --h* | *) 45 | cat <<-EOF 46 | m --tmoe manager 47 | t --tmoe tool 48 | p --proot 49 | c --chroot 50 | aria2 --aria2 manager 51 | theme --zshtheme 52 | zsh --zsh manager 53 | EOF 54 | printf "%s\n" "请前往git仓库获取帮助信息" 55 | exit 0 56 | ;; 57 | esac 58 | case "$2" in 59 | a | arch) DISTRO_NAME='arch' ;; 60 | al | ap | alpine) DISTRO_NAME='alpine' ;; 61 | arm | armbian) DISTRO_NAME='armbian' ;; 62 | c | ce | cent | centos) DISTRO_NAME='centos' ;; 63 | d | deb | debian) DISTRO_NAME='debian' ;; 64 | dde | deepin) DISTRO_NAME='deepin' ;; 65 | devuan) DISTRO_NAME='devuan' ;; 66 | f | fe | fedora) DISTRO_NAME='fedora' ;; 67 | ft | funtoo) DISTRO_NAME='funtoo' ;; 68 | g | gt | gentoo) DISTRO_NAME='gentoo' ;; 69 | k | kali) DISTRO_NAME='kali' ;; 70 | mi | mint) DISTRO_NAME='mint' ;; 71 | m | mj | mjr | manjaro) DISTRO_NAME='manjaro' ;; 72 | o | suse | opensuse) DISTRO_NAME='opensuse' ;; 73 | ow | wrt | openwrt) DISTRO_NAME='openwrt' ;; 74 | r | rasp | raspios) DISTRO_NAME='raspios' ;; 75 | raspbian) DISTRO_NAME='raspios' ;; 76 | s | sl | slackware) DISTRO_NAME='slackware' ;; 77 | u | ub* | ubuntu) DISTRO_NAME='ubuntu' ;; 78 | v | void) DISTRO_NAME='void' ;; 79 | vnc) EXEC_PROGRAM='startvnc' ;; 80 | xs | xsdl | xserver) EXEC_PROGRAM='startxsdl' ;; 81 | x11 | x11vnc) EXEC_PROGRAM='startx11vnc' ;; 82 | *) DISTRO_NAME="$2" ;; 83 | esac 84 | case "$3" in 85 | 20.10) DISTRO_CODE='groovy' ;; 86 | 21.04) DISTRO_CODE='hirsute' ;; 87 | 20.04) DISTRO_CODE='focal' ;; 88 | 18.04) DISTRO_CODE='bionic' ;; 89 | ro) DISTRO_CODE='rolling' ;; 90 | s) DISTRO_CODE='sid' ;; 91 | r) DISTRO_CODE='rolling' ;; 92 | n | none) DISTRO_CODE='' ;; 93 | x | amd64 | x64) ARCH_TYPE='amd64' ;; 94 | a | aarch64 | arm64) ARCH_TYPE='arm64' ;; 95 | h | arm | armhf) ARCH_TYPE='armhf' ;; 96 | armel) ARCH_TYPE='armel' ;; 97 | i | i386 | x86 | x32) ARCH_TYPE='i386' ;; 98 | p | ppc) ARCH_TYPE='ppc64el' ;; 99 | s390x) ARCH_TYPE='s390x' ;; 100 | m | mips | mipsel) ARCH_TYPE='mipsel' ;; 101 | m64 | mips64 | mips64el) ARCH_TYPE='mips64el' ;; 102 | risc*) ARCH_TYPE='riscv64' ;; 103 | v | vnc) EXEC_PROGRAM='tigervnc' ;; 104 | xs | xsdl | xserver) EXEC_PROGRAM='xserver' ;; 105 | x11 | x11vnc) EXEC_PROGRAM='x11vnc' ;; 106 | bash) TMOE_SHELL='/bin/bash' ;; 107 | zsh) TMOE_SHELL='/bin/zsh' ;; 108 | ash) TMOE_SHELL='/bin/ash' ;; 109 | *) DISTRO_CODE="$3" ;; 110 | esac 111 | 112 | case "$4" in 113 | x | amd64 | x64) ARCH_TYPE='amd64' ;; 114 | a | aarch* | arm64) ARCH_TYPE='arm64' ;; 115 | h | arm | armhf) ARCH_TYPE='armhf' ;; 116 | armel) ARCH_TYPE='armel' ;; 117 | i | i386 | x86 | x32) ARCH_TYPE='i386' ;; 118 | p | ppc*) ARCH_TYPE='ppc64el' ;; 119 | s390*) ARCH_TYPE='s390x' ;; 120 | m | mips | mipsel) ARCH_TYPE='mipsel' ;; 121 | m64 | mips64 | mips64el) ARCH_TYPE='mips64el' ;; 122 | risc*) ARCH_TYPE='riscv64' ;; 123 | v*) EXEC_PROGRAM='startvnc' ;; 124 | xs | xsdl | xserver) EXEC_PROGRAM='startxsdl' ;; 125 | x11 | x11vnc) EXEC_PROGRAM='startx11vnc' ;; 126 | bash) TMOE_SHELL='/bin/bash' ;; 127 | zsh) TMOE_SHELL='/bin/zsh' ;; 128 | ash) TMOE_SHELL='/bin/ash' ;; 129 | esac 130 | case "$5" in 131 | v*) EXEC_PROGRAM='startvnc' ;; 132 | x | xs | xsdl | xserver) EXEC_PROGRAM='startxsdl' ;; 133 | x11 | x11vnc) EXEC_PROGRAM='startx11vnc' ;; 134 | bash) TMOE_SHELL='/bin/bash' ;; 135 | zsh) TMOE_SHELL='/bin/zsh' ;; 136 | ash) TMOE_SHELL='/bin/ash' ;; 137 | esac 138 | TMOE_PARAMETERS="$*" 139 | start_tmoe_container 140 | } 141 | ############# 142 | check_manager_dir() { 143 | MANAGER_DIR_01="${HOME}/.local/share/tmoe-linux/git" 144 | MANAGER_DIR_02="/usr/local/etc/tmoe-linux/git" 145 | if [ -e "${MANAGER_DIR_01}" ]; then 146 | MANAGER_DIR=${MANAGER_DIR_01} 147 | else 148 | MANAGER_DIR=${MANAGER_DIR_02} 149 | fi 150 | } 151 | source_tmoe_env() { 152 | TMOE_CONTAINER_FORTUNE=true 153 | TMOE_CONTAINER_HITOKOTO=true 154 | CONFIG_FOLDER=${HOME}/.config/tmoe-linux 155 | source ${CONFIG_FOLDER}/hitokoto.conf 2>/dev/null 156 | case ${TMOE_CONTAINER_FORTUNE} in 157 | true) 158 | if [ $(command -v fortune) ]; then 159 | fortune 2>/dev/null 160 | elif [ -e /usr/games/fortune ]; then 161 | /usr/games/fortune 2>/dev/null 162 | fi 163 | ;; 164 | esac 165 | case $(uname -o) in 166 | Android) 167 | TMOE_LINUX_DIR="${HOME}/.local/share/tmoe-linux" 168 | [[ ! $(command -v termux-wake-lock) ]] || termux-wake-lock 169 | ;; 170 | *) TMOE_LINUX_DIR="/usr/local/etc/tmoe-linux" ;; 171 | esac 172 | TMOE_GIT_DIR="${TMOE_LINUX_DIR}/git" 173 | TMOE_SHARE_DIR="${TMOE_GIT_DIR}/share" 174 | TMOE_CONTAINER_DIR="${TMOE_LINUX_DIR}/containers" 175 | ENV_FILE="${TMOE_SHARE_DIR}/environment/manager_environment" 176 | source ${ENV_FILE} 177 | check_arch 178 | ACROSS_ARCH_FILE="${CONFIG_FOLDER}/across_architecture_container.txt" 179 | [[ ! -s "${ACROSS_ARCH_FILE}" ]] || ARCH_TYPE="$(head -n 1 ${ACROSS_ARCH_FILE})" 180 | } 181 | ######## 182 | start_tmoe_container() { 183 | DEFAULT_SHELL_CONF=${CONFIG_FOLDER}/default_shell.conf 184 | case ${TMOE_SHELL} in 185 | "") rm -f ${DEFAULT_SHELL_CONF} 2>/dev/null ;; 186 | *) printf "%s\n" "TMOE_SHELL=${TMOE_SHELL}" >${DEFAULT_SHELL_CONF} ;; 187 | esac 188 | pulseaudio --start &>/dev/null 189 | case "${DISTRO_NAME}" in 190 | "") ;; 191 | *) 192 | case ${DISTRO_CODE} in 193 | "") DEBIAN_FOLDER=${DISTRO_NAME}_${ARCH_TYPE} ;; 194 | *) DEBIAN_FOLDER=${DISTRO_NAME}-${DISTRO_CODE}_${ARCH_TYPE} ;; 195 | esac 196 | ;; 197 | esac 198 | tmoe_env_02 #source DEBIAN_CHROOT以及其它变量 199 | if [ -e ${DEBIAN_CHROOT}/etc/os-release ]; then 200 | sed -n p ${DEBIAN_CHROOT}/etc/os-release 2>/dev/null | grep PRETTY_NAME | awk -F '"' '{print $2}' 201 | else 202 | sed -n p ${DEBIAN_CHROOT}/etc/issue 2>/dev/null 203 | fi 204 | case ${TMOE_CONTAINER_HITOKOTO} in 205 | true) [[ ! ${TMOE_LANG} =~ zh_.*UTF-8 ]] || get_hitokito_cn ;; 206 | esac 207 | if [[ -n ${EXEC_PROGRAM} ]]; then 208 | case ${EXEC_PROGRAM} in 209 | startx11vnc | startvnc) [[ ! $(command -v am) ]] || am start -n com.realvnc.viewer.android/com.realvnc.viewer.android.app.ConnectionChooserActivity 2>/dev/null ;; 210 | startxsdl) 211 | [[ ! $(command -v am) ]] || am start -n x.org.server/x.org.server.MainActivity 2>/dev/null 212 | printf "%s\n" "Please wait 9s." 213 | #sleep 9 214 | #此处不要sleep 215 | ;; 216 | esac 217 | ${TMOE_PREFIX} touch ${TMOE_GNU_LINUX_CONTAINER_ROOT_VNC_DIR}/${EXEC_PROGRAM} 218 | fi 219 | case ${SYSTEMD_NSPAWN} in 220 | true) 221 | case $(uname -o) in 222 | Android) 223 | printf "%s\n" "Sorry,this feature does not support ${PURPLE}Android${RESET} system." 224 | printf "${YELLOW}%s\n" "如需运行systemd容器,请换用${BLUE}GNU/Linux${RESET}系统。" 225 | exit 1 226 | ;; 227 | esac 228 | case $(id -u) in 229 | 0) 230 | source ${TMOE_SHARE_DIR}/removal/umount 231 | source ${TMOE_SHARE_DIR}/container/nspawn/startup 232 | ;; 233 | *) 234 | sudo -E tmoe ${TMOE_PARAMETERS} 235 | exit 1 236 | ;; 237 | esac 238 | ;; 239 | *) ${TMOE_PREFIX} bash ${TMOE_GNU_LINUX_CONTAINER_STARTUP_FILE} ;; 240 | esac 241 | } 242 | ########## 243 | tmoe_main "$@" 244 | -------------------------------------------------------------------------------- /share/app/vnc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | download_vnc_apk_menu() { 4 | cd /sdcard/Download || mkdir -p /sdcard/Download && cd /sdcard/Download 5 | RETURN_TO_WHERE='download_vnc_apk_menu' 6 | #15 60 4 7 | OPTION=$(whiptail --title "remote desktop apk" --menu "Which remote desktop software do you want to install?" 0 50 0 \ 8 | "1" "vnc/xsdl" \ 9 | "2" "xwayland" \ 10 | "0" "🌚 Back to the main menu 返回主菜单" \ 11 | 3>&1 1>&2 2>&3) 12 | ########################## 13 | case "${OPTION}" in 14 | 0 | "") ${RETURN_TO_MENU} ;; 15 | 1) download_vnc_or_xsdl_apk ;; 16 | 2) xwayland_warning ;; 17 | esac 18 | ########### 19 | press_enter_to_return 20 | ${RETURN_TO_WHERE} 21 | } 22 | ######################################### 23 | download_vnc_or_xsdl_apk() { 24 | for i in /sdcard/Download ~/sd/Download /media/sd/Download; do 25 | [[ ! -e ${i} ]] || cd ${i} 26 | done 27 | unset i 28 | 29 | if (whiptail --title "您想要下载哪个软件?" --yes-button 'VNC Viewer' --no-button 'XServer XSDL' --yesno "vnc操作体验更好,当前版本已经可以通过pulse server来传输音频。xsdl对某些软件的兼容性更高,但操作体验没有vnc好。VNC has a better operating experience and is also smoother.XSDL is more compatible with some software, but the experience is not as good as VNC in every way.\n若VNC启动后仍无声音,则请前往Play商店或Fdroid更新termux至最新版本,再安装termux:api.apk" 16 50); then 30 | printf "%s\n" "${YELLOW}按回车键开始下载${RESET}" 31 | do_you_want_to_continue 32 | printf '%s\n' 'Downloading vnc viewer...' 33 | #rm -f 'VNCViewer_com-realvnc-viewer-android-3-6-1-42089.tar.xz' 2>/dev/null 34 | printf '%s\n' '正在为您下载至/sdcard/Download目录...' 35 | printf '%s\n' 'Download size ≈11MB' 36 | if [ -d "/sdcard/Download/.GITCLONEVNCCLIENT" ]; then 37 | rm -rf /sdcard/Download/.GITCLONEVNCCLIENT 38 | fi 39 | 40 | git clone -b vnc --depth=1 https://gitee.com/mo2/VncClient.git .GITCLONEVNCCLIENT 41 | mv -f /sdcard/Download/.GITCLONEVNCCLIENT/vnc/vnc36142089.tar.xz ./ 42 | printf '%s\n' '正在解压...' 43 | tar -Jxvf vnc36142089.tar.xz 44 | #tar -Jxvf 'VNCViewer_com-realvnc-viewer-android-3-6-1-42089.tar.xz' 45 | rm -rf /sdcard/Download/.GITCLONEVNCCLIENT 46 | rm -f /sdcard/Download/vnc36142089.tar.xz 47 | printf '%s\n' '正在删除压缩包...' 48 | printf '%s\n' 'Deleting ...' 49 | #rm -f 'VNCViewer_com-realvnc-viewer-android-3-6-1-42089.tar.xz' 50 | am start -n com.android.documentsui/com.android.documentsui.ViewDownloadsActivity 51 | printf "%s\n" "${YELLOW}解压成功,请进入下载目录手动安装。${RESET}" 52 | printf '%s\n' '文件名称 VNC Viewer_com,realvnc,viewer,android_3,6,1,42089.apk' 53 | cd ${CURRENT_DIR} 54 | else 55 | printf '%s\n' '按回车键开始下载' 56 | do_you_want_to_continue 57 | printf '%s\n' 'Downloading xsdl...' 58 | #rm -f 'XServerXSDL-X-org-server_1-20-41.tar.xz' 2>/dev/null 59 | printf '%s\n' '正在为您下载至/sdcard/Download目录...' 60 | printf '%s\n' 'Download size ≈29MB' 61 | if [ -d "/sdcard/Download/.GITCLONEVNCCLIENT" ]; then 62 | rm -rf /sdcard/Download/.GITCLONEVNCCLIENT 63 | fi 64 | 65 | git clone -b xsdl --depth=1 https://gitee.com/ak2/xsdl.git .GITCLONEVNCCLIENT 66 | mv -f /sdcard/Download/.GITCLONEVNCCLIENT/xsdl/XSDL.tar.xz ./ 67 | printf '%s\n' '正在解压...' 68 | tar -Jxvf XSDL.tar.xz 69 | #tar -Jxvf 'XServerXSDL-X-org-server_1-20-41.tar.xz' 70 | rm -rf /sdcard/Download/.GITCLONEVNCCLIENT 71 | rm -f /sdcard/Download/XSDL.tar.xz 72 | printf '%s\n' '正在删除压缩包...' 73 | printf '%s\n' 'Deleting ...' 74 | #rm -f 'XServerXSDL-X-org-server_1-20-41.tar.xz' 75 | 76 | printf '%s\n' '解压成功,请进入下载目录手动安装。' 77 | printf '%s\n' '文件名称 XServer XSDL*.apk' 78 | am start -n com.android.documentsui/com.android.documentsui.ViewDownloadsActivity 79 | cd ${CURRENT_DIR} 80 | fi 81 | } 82 | ################### 83 | download_vnc_or_xsdl_apk 84 | -------------------------------------------------------------------------------- /share/completion/_tmoe: -------------------------------------------------------------------------------- 1 | #compdef tmoe 2 | 3 | #zstyle ':completion::complete:tmoe:*:descriptions' format '%B%d%b' 4 | zstyle ':completion::complete:tmoe:*:descriptions' format '[%d]' 5 | zstyle ':completion::complete:tmoe:*:container_type' group-name "container type" 6 | zstyle ':completion::complete:tmoe:*:distro_name' group-name "distro name" 7 | zstyle ':completion::complete:tmoe:*:distro_code' group-name distro_code 8 | zstyle ':completion::complete:tmoe:*:architecture' group-name "architecture" 9 | zstyle ':completion::complete:tmoe:*:execute_program' group-name "execute program" 10 | zstyle ':completion::complete:tmoe::' list-grouped 11 | ########### 12 | PURPLE=$(printf '\033[0;35m') 13 | RED=$(printf '\033[31m') 14 | GREEN=$(printf '\033[32m') 15 | YELLOW=$(printf '\033[33m') 16 | BLUE=$(printf '\033[34m') 17 | BOLD=$(printf '\033[1m') 18 | RESET=$(printf '\033[m') 19 | 20 | function _tmoe() { 21 | local RET=1 22 | local -a container_type 23 | local -a distro_name 24 | local -a distro_code 25 | local -a architecture 26 | local -a execute_program 27 | 28 | container_type=( 29 | "c:chroot:A chroot is an operation that changes the apparent root directory for the current running process and their children." 30 | "chroot:与宿主机共享相同的内核,硬件,进程空间和网络子系统" 31 | "p:proot - mount --bind and binfmt_misc without privilege/setupmount" 32 | "proot:能在用户空间内运行的程序,I/O性能弱于chroot" 33 | "ns:systemd-nspawn:It supports executing systemctl commands in the container." 34 | "nspawn:systemd容器,支持执行systemctl" 35 | ) 36 | 37 | distro_name=( 38 | "a:arch" 39 | "arch:simplicity,modernity,pragmatism,user centrality and versatility" 40 | "al:alpine" 41 | "ap:alpine" 42 | "alpine:Small. Simple. Secure. Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox" 43 | "arm:armbian" 44 | "armbian:香蕉派,香橙派,nanopi" 45 | "c:centos" 46 | "centos:CentOS is a community-driven free software effort focused on delivering a robust open source ecosystem around a Linux platform" 47 | "d:debian" 48 | "debian:Debian is a distro composed of free and open-source software" 49 | "dde:deepin" 50 | "deepin:aims to provide an elegant, user-friendly, and stable operating system." 51 | "devuan:Devuan is a fork of Debian that uses sysvinit or OpenRC instead of systemd" 52 | "f:fedora" 53 | "fedora:developed by the community-supported Fedora Project which is sponsored primarily by Red Hat" 54 | "ft:funtoo" 55 | "funtoo" 56 | "g:gentoo" 57 | "gentoo:追求极限配置和极高自由" 58 | "k:kali" 59 | "kali:Kali is a Debian-derived distro designed for digital forensics and penetration testing" 60 | "m:manjaro" 61 | "manjaro:Free fast and secure Linux based operating system for everyone" 62 | "mi:mint" 63 | "mint:Elegant, easy to use, up to date and comfortable GNU/Linux desktop distribution." 64 | "o:opensuse" 65 | "suse:opensuse" 66 | "opensuse" 67 | "ow:openwrt" 68 | "openwrt:OpenWRT is a Linux OS targeting embedded devices" 69 | "r:raspios" 70 | "raspios:Raspberry Pi OS" 71 | "s:slackware" 72 | "slackware:Slackware is a distro created by Patrick Volkerding in 1993" 73 | "u:ubuntu" 74 | "ub:ubuntu" 75 | "ubuntu:Ubuntu is the modern, open source OS." 76 | "v:void" 77 | "void:Void is a general purpose operating system, based on the monolithic Linux kernel" 78 | ) 79 | 80 | distro_code=( 81 | "20.10:ubuntu groovy" 82 | "20.04:ubuntu focal" 83 | "21.04:ubuntu hirsute" 84 | "apricot:deepin 20" 85 | "camel:deepin 15.5" 86 | "s:debian sid" 87 | "sid" 88 | "buster:debian 10" 89 | "bullseye:debian 11" 90 | "bookworm:debian 12" 91 | "trixie:debian13" 92 | "n:none(Rolling releases like archlinux do not have a version code)" 93 | "none:諸如arch之類的發行版無代號" 94 | "r:kali rolling" 95 | "18.04:ubuntu bionic" 96 | "31:fedora 31" 97 | "32:fedora 32" 98 | "33:fedora 33" 99 | "34:fedora 34" 100 | "3.12:alpine 3.12" 101 | "3.13:alpine 3.13" 102 | "edge:alpine edge" 103 | "8-Stream:CentOS 8-Stream" 104 | "tumbleweed:OpenSUSE tumbleweed" 105 | ) 106 | 107 | architecture=( 108 | "x:x64/amd64" 109 | "amd64:It defines a 64-bit virtual address format, of which the low-order 48 bits are used in current implementations.It defines a 64-bit virtual address format, of which the low-order 48 bits are used in current implementations." 110 | "a:aarch64/arm64" 111 | "arm64:64-bit extension of the ARM architecture" 112 | "h:armhf/arm" 113 | "armhf:32-bit arm hard float" 114 | "armel:32-bit arm soft float" 115 | "i:i386/x86/x32" 116 | "i386:x86 is a family of instruction set architectures initially developed by Intel based on the Intel 8086 microprocessor and its 8088 variant" 117 | "p:ppc64el" 118 | "ppc64el:a pure little-endian mode that has been introduced with the POWER8 as the prime target" 119 | "s390x:Linux on IBM Z is not generally appropriate on premises for small businesses that would have fewer than about 10 distributed Linux servers" 120 | "m:mipsel:Microprocessor without Interlocked Pipelined Stages little-endian" 121 | "m64:mips64el" 122 | "riscv64:RISC-V is an open standard instruction set architecture (ISA) based on established reduced instruction set computer (RISC) principlesRISC-V is an open standard instruction set architecture (ISA) based on established reduced instruction set computer (RISC) principles" 123 | ) 124 | execute_program=( 125 | "v:vnc(startvnc)" 126 | "vnc:tight/tiger vnc server" 127 | "x11:x11 vnc server" 128 | "xs:xserver" 129 | "xsdl:xserver" 130 | "bash:GNU Bourne-Again SHell" 131 | "zsh:z shell(Default)" 132 | "ash:command interpreter (shell)" 133 | ) 134 | 135 | _arguments -C \ 136 | '1: :->first_arg' \ 137 | '2: :->second_arg' \ 138 | '3: :->third_arg' \ 139 | '4: :->fourth_arg' \ 140 | '5: :->fifth_arg' \ 141 | '6: :->sixth_arg' && RET=0 142 | 143 | local target=$words[3] 144 | 145 | case $state in 146 | first_arg) _describe -t container_type "container type" container_type && RET=0 ;; 147 | second_arg) _describe -t distro_name "distro name" distro_name && RET=0 ;; 148 | third_arg) 149 | _describe -t distro_code "distro_code" distro_code && RET=0 150 | _describe -t distro_name "architecture" architecture && RET=0 151 | ;; 152 | fourth_arg) 153 | _describe -t architecture "architecture" architecture && RET=0 154 | _describe -t execute_program "execute program" execute_program && RET=0 155 | ;; 156 | fifth_arg) _describe -t execute_program "execute program" execute_program && RET=0 ;; 157 | sixth_arg) 158 | case $target in 159 | *) 160 | _message "Press ${BOLD}${YELLOW}enter${RESET}${RESET} to start ${BLUE}${target}${RESET}." 161 | _message "按${BOLD}${YELLOW}回车键${RESET}${RESET}启动${BLUE}${target}${RESET}容器。" && RET=0 162 | ;; 163 | esac 164 | ;; 165 | esac 166 | return $RET 167 | } 168 | 169 | _tmoe "$@" 170 | -------------------------------------------------------------------------------- /share/completion/version.txt: -------------------------------------------------------------------------------- 1 | 14 -------------------------------------------------------------------------------- /share/compression/restore: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | restore_main() { 4 | case "$1" in 5 | --menu | *) restore_gnu_linux_container ;; 6 | esac 7 | } 8 | ############### 9 | uncompress_other_format_file() { 10 | pwd 11 | printf "%s\n" "即将为您解压..." 12 | if [ ! "$(command -v pv)" ] || [ "${COMPATIBILITY_MODE}" = 'true' ] || [ "${TMOE_CHROOT}" = 'true' ]; then 13 | printf "%s\n" "${GREEN} tar -Ppxvf ${RESTORE} ${RESET}" 14 | ${TMOE_PREFIX} tar -Ppxvf ${RESTORE} 15 | else 16 | printf "%s\n" "${GREEN} pv ${RESTORE} | tar -Ppx ${RESET}" 17 | pv ${RESTORE} | tar -Ppx 18 | fi 19 | } 20 | ############## 21 | uncompress_tar_xz_file() { 22 | pwd 23 | printf '%s\n' 'tar.xz' 24 | printf "%s\n" "即将为您解压..." 25 | if [ ! "$(command -v pv)" ] || [ "${COMPATIBILITY_MODE}" = 'true' ] || [ "${TMOE_CHROOT}" = 'true' ]; then 26 | printf "%s\n" "${GREEN} tar -PpJxvf ${RESTORE} ${RESET}" 27 | ${TMOE_PREFIX} tar -PpJxvf ${RESTORE} 28 | else 29 | printf "%s\n" "${GREEN} pv ${RESTORE} | tar -PpJx ${RESET}" 30 | pv ${RESTORE} | tar -PpJx 31 | fi 32 | } 33 | ###################### 34 | uncompress_tar_gz_file() { 35 | pwd 36 | printf '%s\n' 'tar.gz' 37 | printf "%s\n" "即将为您解压..." 38 | if [ ! "$(command -v pv)" ] || [ "${COMPATIBILITY_MODE}" = 'true' ] || [ "${TMOE_CHROOT}" = 'true' ]; then 39 | printf "%s\n" "${GREEN} tar -Ppzxvf ${RESTORE} ${RESET}" 40 | ${TMOE_PREFIX} tar -Ppzxvf ${RESTORE} 41 | else 42 | printf "%s\n" "${GREEN} pv ${RESTORE} | tar -Ppzx ${RESET}" 43 | pv ${RESTORE} | tar -Ppzx 44 | fi 45 | } 46 | ##################### 47 | uncompress_tar_file() { 48 | if [ ! -e "${DEBIAN_CHROOT}" ]; then 49 | if [ -e "${CONFIG_FOLDER}/chroot_container" ]; then 50 | rm -fv ${CONFIG_FOLDER}/chroot_container 51 | fi 52 | fi 53 | 54 | case ${RESTORE} in 55 | *chroot-rootfs_bak.*) 56 | TMOE_CHROOT='true' 57 | check_sudo 58 | ;; 59 | *) TMOE_PREFIX='' ;; 60 | esac 61 | case "${RESTORE:0-6:6}" in 62 | tar.xz) 63 | uncompress_tar_xz_file 64 | ;; 65 | tar.gz) 66 | uncompress_tar_gz_file 67 | ;; 68 | *) 69 | uncompress_other_format_file 70 | ;; 71 | esac 72 | case ${TMOE_CHROOT} in 73 | true) ;; 74 | *) [[ ! -e "${PREFIX}/bin/tmoe" ]] || check_proot_proc_permissions ;; 75 | esac 76 | check_tmoe_container_chroot 77 | } 78 | ####################### 79 | select_file_manually() { 80 | count=0 81 | printf '%s\n' '您可以在此列表中选择需要恢复的压缩包' 82 | for restore_file in ${START_DIR}/${BACKUP_FILE_NAME}; do 83 | restore_file_name[count]=$(printf '%s\n' "${restore_file}" | awk -F'/' '{print $NF}') 84 | echo -e "($count) ${restore_file_name[count]}" 85 | count=$(($count + 1)) 86 | done 87 | count=$(($count - 1)) 88 | 89 | while true; do 90 | read -p '请输入选项数字,并按回车键。Please type the option number and press Enter:' number 91 | if [[ -z "$number" ]]; then 92 | break 93 | elif ! [[ $number =~ ^[0-9]+$ ]]; then 94 | printf "%s\n" "Please enter the right number!" 95 | printf '%s\n' '请输入正确的数字编号!' 96 | elif (($number >= 0 && $number <= $count)); then 97 | eval RESTORE=${restore_file_name[number]} 98 | # cp -fr "${START_DIR}/$choice" "$DIR/restore_file.properties" 99 | RETURN_TO_WHERE='restore_gnu_linux_container' 100 | do_you_want_to_continue 101 | uncompress_tar_file 102 | break 103 | else 104 | printf "%s\n" "Please enter the right number!" 105 | printf '%s\n' '请输入正确的数字编号!' 106 | fi 107 | done 108 | } 109 | ################ 110 | restore_the_latest_backup_file() { 111 | #printf '%s\n' '目前仅支持还原最新的备份,如需还原旧版,请手动输以下命令' 112 | #printf '%s\n' 'cd /sdcard/Download/backup ;ls ; tar -JPxvf 文件名.tar.xz 或 tar -Pzxvf 文件名.tar.gz' 113 | #printf '%s\n' '请注意大小写,并把文件名改成具体名称' 114 | if [ -z "${RESTORE}" ]; then 115 | printf "%s\n" "${RED}未检测${RESTORE}到${BLUE}备份文件${RESTORE},请${GREEN}手动选择${RESTORE}" 116 | press_enter_to_continue 117 | BACKUP_FILE_NAME=* 118 | manually_select_the_file_directory 119 | select_file_manually 120 | # tmoe_file_manager 121 | else 122 | ls -lh ${RESTORE} 123 | RETURN_TO_WHERE='restore_gnu_linux_container' 124 | do_you_want_to_continue 125 | uncompress_tar_file 126 | fi 127 | } 128 | ######################### 129 | file_directory_selection() { 130 | # if (whiptail --title "FILE PATH" --yes-button '自动auto' --no-button '手动manually' --yesno "您想要手动指定文件目录还是自动选择?\nDo you want to automatically select the file d# select_file_manually 131 | manually_select_the_file_directory 132 | select_file_manually 133 | } 134 | ################### 135 | manually_select_the_file_directory() { 136 | TARGET_BACKUP_FILE_PATH=$(whiptail --inputbox "请输入文件路径(精确到目录名称),默认为${CONTAINER_BACKUP_PATH}\nPlease type the file path." 10 50 --title "FILEPATH" 3>&1 1>&2 2>&3) 137 | START_DIR="$(printf '%s\n' "${TARGET_BACKUP_FILE_PATH}" | head -n 1 | cut -d ' ' -f 1)" 138 | printf "%s\n" "${START_DIR}" 139 | if [ -z ${START_DIR} ]; then 140 | printf "%s\n" "文件目录不能为空" 141 | printf "%s\n" "The file path is empty." 142 | press_enter_to_return 143 | restore_gnu_linux_container 144 | else 145 | cd ${START_DIR} 146 | fi 147 | } 148 | ############### 149 | normally_restore_tmoe_container() { 150 | if (whiptail --title "RESTORE FILE" --yes-button '最新latest' --no-button 'select manually' --yesno "您是想要还原最新文件,还是手动选择备份文件\nDo you want to restore the latest file or select the file manually?" 9 50); then 151 | #RESTORE=$(ls -lth ./*debian*tar* | grep ^- | head -n 1 | cut -d '/' -f 2) 152 | RESTORE=$(ls -lth ./*-rootfs_bak.tar* | grep ^- | head -n 1 | awk -F ' ' '$0=$NF') 153 | restore_the_latest_backup_file 154 | else 155 | BACKUP_FILE_NAME="*-rootfs_bak.tar*" 156 | select_file_manually 157 | fi 158 | } 159 | ######### 160 | restore_gnu_linux_container() { 161 | #source ${TMOE_SHARE_DIR}/removal/umount 162 | COMPATIBILITY_MODE='fasle' 163 | RETURN_TO_WHERE='restore_gnu_linux_container' 164 | check_container_external_backup_path 165 | START_DIR=${CONTAINER_BACKUP_PATH} 166 | #13 55 5 167 | TMOE_OPTION=$(whiptail --title "Restore ${CONTAINER_TYPE} container" --menu "你想要恢复哪个小可爱到之前的备份状态\nDo you want to restore the container?" 0 0 0 \ 168 | "1" "Normal mode 常规模式" \ 169 | "2" "Restore from sd/tf 从外置tf中恢复" \ 170 | "3" "Select path manually手动选择路径" \ 171 | "4" "Restore from /sdcard/Download/backup" \ 172 | "5" "Compatibility mode 兼容模式" \ 173 | "0" "🌚 Back to the main menu 返回主菜单" \ 174 | 3>&1 1>&2 2>&3) 175 | ########################################################################### 176 | case ${TMOE_OPTION} in 177 | 1) 178 | check_container_backup_path 179 | START_DIR=${CONTAINER_BACKUP_PATH} 180 | cd ${CONTAINER_BACKUP_PATH} 181 | normally_restore_tmoe_container 182 | ;; 183 | 2) 184 | cd ${CONTAINER_BACKUP_PATH} 185 | normally_restore_tmoe_container 186 | ;; 187 | 3) 188 | BACKUP_FILE_NAME="*tar*" 189 | file_directory_selection 190 | ;; 191 | 4) 192 | BACKUP_FILE_NAME="*tar*" 193 | BACKUP_PATH="/sdcard/Download/backup" 194 | START_DIR=${BACKUP_PATH} 195 | cd ${BACKUP_PATH} 196 | select_file_manually 197 | ;; 198 | 5) 199 | check_container_backup_path 200 | cd ${CONTAINER_BACKUP_PATH} 201 | BACKUP_FILE_NAME="*tar*" 202 | COMPATIBILITY_MODE='true' 203 | #file_directory_selection 204 | select_file_manually 205 | ;; 206 | 0 | "") 207 | tmoe_manager_main_menu 208 | ;; 209 | esac 210 | ########################## 211 | press_enter_to_return 212 | restore_gnu_linux_container 213 | #tmoe_manager_main_menu 214 | } 215 | ############################ 216 | restore_main 217 | -------------------------------------------------------------------------------- /share/configuration/dns/ali: -------------------------------------------------------------------------------- 1 | nameserver 223.5.5.5 2 | nameserver 223.6.6.6 3 | nameserver 2400:3200::1 4 | nameserver 2400:3200:baba::1 -------------------------------------------------------------------------------- /share/configuration/dns/baidu: -------------------------------------------------------------------------------- 1 | nameserver 180.76.76.76 2 | nameserver 2400:da00::6666 -------------------------------------------------------------------------------- /share/configuration/dns/cfiec: -------------------------------------------------------------------------------- 1 | nameserver 114.114.114.114 2 | nameserver 114.114.115.115 3 | nameserver 240c::6666 4 | nameserver 240c::6644 -------------------------------------------------------------------------------- /share/configuration/dns/cloudflare: -------------------------------------------------------------------------------- 1 | nameserver 1.1.1.1 2 | nameserver 1.0.0.1 3 | nameserver 2606:4700:4700::1111 4 | nameserver 2606:4700:4700::1001 -------------------------------------------------------------------------------- /share/configuration/dns/google: -------------------------------------------------------------------------------- 1 | nameserver 8.8.8.8 2 | nameserver 8.8.4.4 3 | nameserver 2001:4860:4860::8888 4 | nameserver 2001:4860:4860::8844 -------------------------------------------------------------------------------- /share/configuration/dns/tuna: -------------------------------------------------------------------------------- 1 | nameserver 101.6.6.6 2 | nameserver 2001:da8::666 3 | nameserver 2001:da8:ff:305:20c:29ff:fe1f:a92a -------------------------------------------------------------------------------- /share/configuration/menu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ############################## 3 | configure_tmoe_container_main() { 4 | case $1 in 5 | dns) tmoe_container_dns ;; 6 | -menu | *) configure_tmoe_container ;; 7 | esac 8 | } 9 | ############# 10 | configure_tmoe_container() { 11 | RETURN_TO_WHERE='configure_tmoe_container' 12 | RETURN_TO_MENU='configure_tmoe_container' 13 | TMOE_OPTION=$(whiptail --title "CONF AND MANUAL" --menu "You can view the manual or modify the container configuration here." 0 50 0 \ 14 | "1" "DNS 域名解析系统" \ 15 | "2" "hitokoto 一言" \ 16 | "3" "man mount" \ 17 | "4" "man umount" \ 18 | "5" "man x11vnc" \ 19 | "0" "🌚 Back 返回" \ 20 | 3>&1 1>&2 2>&3) 21 | ############################## 22 | case "${TMOE_OPTION}" in 23 | 0 | "") proot_container_menu ;; 24 | 1) tmoe_container_dns ;; 25 | 2) do_you_want_to_enable_hitokoto ;; 26 | 3) man_mount ;; 27 | 4) man_umount ;; 28 | 5) man_x11vnc ;; 29 | esac 30 | #################### 31 | press_enter_to_return 32 | configure_tmoe_container 33 | } 34 | ########## 35 | check_man_db() { 36 | [[ $(command -v man) ]] || ${TMOE_INSTALLATION_COMMAND} man 37 | [[ $(command -v man) ]] || ${TMOE_INSTALLATION_COMMAND} man-db 38 | [[ ! $(command -v man) ]] || check_x11vnc_git_manual 39 | } 40 | ######### 41 | check_x11vnc_git_manual() { 42 | if [[ ! -e ${TMOE_LINUX_DIR}/docs/.git ]]; then 43 | mkdir -p ${TMOE_LINUX_DIR} 44 | git clone --depth=1 -b main https://gitee.com/ak2/manual ${TMOE_LINUX_DIR}/docs 45 | fi 46 | } 47 | ####### 48 | man_mount() { 49 | check_man_db 50 | man ${TMOE_LINUX_DIR}/docs/mount.8 51 | } 52 | man_umount() { 53 | check_man_db 54 | man ${TMOE_LINUX_DIR}/docs/umount.8 55 | } 56 | man_x11vnc() { 57 | check_man_db 58 | man ${TMOE_LINUX_DIR}/docs/x11vnc.1 59 | } 60 | how_to_customize_dns() { 61 | printf "%s\n %s\n" "When you enter the container, you can type ${GREEN}editor /etc/resolv.conf${RESET}" "or ${GREEN}nano /etc/resolv.conf${RESET} to modify the DNS configuration file." 62 | printf "%s\n" "本功能仅适用于容器初始化配置,如需手动修改,则请在容器内部输入${GREEN}nano /etc/resolv.conf${RESET}" 63 | } 64 | ######### 65 | tmoe_container_dns() { 66 | RETURN_TO_WHERE='tmoe_container_dns' 67 | DNS_NAME='' 68 | TMOE_OPTION=$(whiptail --title "Please choose DNS" --menu "默认为第一项\nYou can choose cloudflare dns." 0 50 0 \ 69 | "1" "[240c::6666](CFIEC)" \ 70 | "2" "[2606:4700:4700::1111](CloudFlare)" \ 71 | "3" "[2001:4860:4860::8888](Google)" \ 72 | "4" "[2400:3200::1](Ali)" \ 73 | "5" "[2400:da00::6666](Baidu)" \ 74 | "6" "[2001:da8::666](Tsinghua-Tuna)" \ 75 | "7" "How to customize dns?" \ 76 | "0" "🌚 Back 返回" \ 77 | 3>&1 1>&2 2>&3) 78 | ############################## 79 | case "${TMOE_OPTION}" in 80 | 0 | "") 81 | case ${RETURN_TO_MENU} in 82 | "") configure_tmoe_container ;; 83 | *) ${RETURN_TO_MENU} ;; 84 | esac 85 | ;; 86 | 1) DNS_NAME='cfiec' ;; 87 | 2) DNS_NAME='cloudflare' ;; 88 | 3) DNS_NAME='google' ;; 89 | 4) DNS_NAME='ali' ;; 90 | 5) DNS_NAME='baidu' ;; 91 | 6) DNS_NAME='tuna' ;; 92 | 7) how_to_customize_dns ;; 93 | esac 94 | [[ -z ${DNS_NAME} ]] || cp -vf ${TMOE_SHARE_DIR}/configuration/dns/${DNS_NAME} ${CONFIG_FOLDER}/default-dns.conf 95 | #################### 96 | press_enter_to_return 97 | case ${RETURN_TO_MENU} in 98 | "") tmoe_container_dns ;; 99 | *) ${RETURN_TO_MENU} ;; 100 | esac 101 | } 102 | ############## 103 | install_fortunes() { 104 | if [[ ! $(command -v fortune) ]] && [ ! -e /usr/games/fortune ]; then 105 | printf "${GREEN}%s ${PURPLE}%s${RESET}\n" "${TMOE_INSTALLATION_COMMAND}" "fortune" 106 | ${TMOE_INSTALLATION_COMMAND} fortunes 2>/dev/null 107 | ${TMOE_INSTALLATION_COMMAND} fortune-mod 2>/dev/null 108 | ${TMOE_INSTALLATION_COMMAND} fortune 2>/dev/null 109 | case ${TMOE_LANG} in 110 | zh_*UTF-8) 111 | ${TMOE_INSTALLATION_COMMAND} fortunes-zh 2>/dev/null 112 | install_fortunes_cn 113 | ;; 114 | esac 115 | fi 116 | printf "${YELLOW}%s${RESET}\n" "Enable complete" 117 | } 118 | install_fortunes_cn() { 119 | case ${LINUX_DISTRO} in 120 | Android) 121 | THE_LATEST_DEB_REPO='https://mirrors.bfsu.edu.cn/debian/pool/main/f/fortune-zh/' 122 | THE_LATEST_DEB_VERSION="$(curl -L ${THE_LATEST_DEB_REPO} | egrep -v '\.dsc|\.tar\.xz' | grep 'deb' | tail -n 1 | awk -F '=' '{print $3}' | cut -d '"' -f 2)" 123 | THE_LATEST_ISO_LINK="${THE_LATEST_DEB_REPO}${THE_LATEST_DEB_VERSION}" 124 | TEMP_FOLDER=${TMPDIR}/.FORTUNES_TMP 125 | mkdir -p ${TEMP_FOLDER} 126 | cd ${TEMP_FOLDER} 127 | aria2c --no-conf --allow-overwrite=true -o ${THE_LATEST_DEB_VERSION} "${THE_LATEST_ISO_LINK}" 128 | dpkg-deb -X ${THE_LATEST_DEB_VERSION} ./ 129 | cd usr/share/games/fortunes 130 | for i in $(readlink ./*); do 131 | cp -vf ${i} ${PREFIX}/share/games/fortunes 132 | done 133 | cd ${CURRENT_DIR} || cd ${HOME} 134 | rm -rv ${TEMP_FOLDER} 135 | ;; 136 | esac 137 | } 138 | ############## 139 | do_you_want_to_enable_hitokoto() { 140 | if (whiptail --title "HITOKOTO AND FORTUNE" --yes-button "YES" --no-button "NO" --yesno "DO YOU WANT TO ENABLE HITOKOTO?\n是否需要启用一言?♪(^∇^*) " 9 50); then 141 | cat >${CONFIG_FOLDER}/hitokoto.conf <<-EOF 142 | TMOE_CONTAINER_FORTUNE=true 143 | TMOE_CONTAINER_HITOKOTO=true 144 | EOF 145 | install_fortunes 146 | else 147 | cat >${CONFIG_FOLDER}/hitokoto.conf <<-EOF 148 | TMOE_CONTAINER_FORTUNE=false 149 | TMOE_CONTAINER_HITOKOTO=false 150 | EOF 151 | if [[ $(command -v fortune) ]] || [ -e /usr/games/fortune ]; then 152 | ${TMOE_REMOVAL_COMMAND} fortune 153 | ${TMOE_REMOVAL_COMMAND} fortunes 154 | ${TMOE_REMOVAL_COMMAND} fortunes-zh 155 | fi 156 | fi 157 | } 158 | ########### 159 | #不包含$@ 160 | -------------------------------------------------------------------------------- /share/configuration/mirror-list/arch/aarch64/mirrorlist: -------------------------------------------------------------------------------- 1 | ## Arch Linux ARM repository mirrorlist 2 | ##https://archlinuxarm.org/about/mirrors 3 | ## 4 | 5 | ## Worldwide 6 | #Server = https://mirror.archlinuxarm.org/$arch/$repo 7 | # 8 | #Australia Sydney 9 | #Server = http://au.mirror.archlinuxarm.org/$arch/$repo 10 | 11 | #Brazil Sao Paulo 12 | #Server = http://br.mirror.archlinuxarm.org/$arch/$repo 13 | 14 | #China 15 | #Server = https://mirrors.163.com/archlinuxarm/$arch/$repo 16 | #Server = https://mirrors.bfsu.edu.cn/archlinuxarm/$arch/$repo 17 | 18 | #Denmark Aalborg 19 | #Server = http://dk.mirror.archlinuxarm.org/$arch/$repo 20 | 21 | #Germany Aachen 22 | #Server = http://de3.mirror.archlinuxarm.org/$arch/$repo 23 | #Germany Berlin 24 | #Server = http://de.mirror.archlinuxarm.org/$arch/$repo 25 | #Germany Coburg 26 | #Server = http://de4.mirror.archlinuxarm.org/$arch/$repo 27 | #Germany Falkenstein 28 | #Server = http://eu.mirror.archlinuxarm.org/$arch/$repo 29 | #Server = http://de5.mirror.archlinuxarm.org/$arch/$repo 30 | 31 | #Greece Athens 32 | #Server = http://gr.mirror.archlinuxarm.org/$arch/$repo 33 | 34 | #Hungary Budapest 35 | #Server = http://hu.mirror.archlinuxarm.org/$arch/$repo 36 | 37 | #Portugal Aveiro 38 | #Server = http://pt.mirror.archlinuxarm.org/$arch/$repo 39 | 40 | #Singapore Singapore 41 | #Server = http://sg.mirror.archlinuxarm.org/$arch/$repo 42 | 43 | #South Africa Johannesburg 44 | #Server = http://za.mirror.archlinuxarm.org/$arch/$repo 45 | 46 | #Taiwan New Taipei City 47 | #Server = http://tw.mirror.archlinuxarm.org/$arch/$repo 48 | 49 | #USA Chicago, IL 50 | #Server = http://il.us.mirror.archlinuxarm.org/$arch/$repo 51 | #USA Los Angeles, CA 52 | #Server = http://ca.us.mirror.archlinuxarm.org/$arch/$repo 53 | #USA Matawan, NJ 54 | #Server = http://nj.us.mirror.archlinuxarm.org/$arch/$repo 55 | #USA Miami, FL 56 | #Server = http://fl.us.mirror.archlinuxarm.org/$arch/$repo -------------------------------------------------------------------------------- /share/container/chroot/notes: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | check_root_permissions() { 4 | case ${LINUX_DISTRO} in 5 | Android) 6 | su -c "ls ${HOME} >/dev/null" 7 | case "$?" in 8 | 0) 9 | if [ ! "$(command -v sudo)" ] && [ ! "$(command -v tsu)" ]; then 10 | printf "%s\n" "${GREEN}apt install -y${RESET} ${BLUE}tsu${RESET}" 11 | printf "%s\n" "You can type ${RED}apt purge${RESET} ${BLUE}tsu${RESET} to remove it." 12 | apt update 13 | apt install -y tsu 14 | fi 15 | ;; 16 | *) 17 | printf "%s\n" "Android :${ANDROID_VERSION}" 18 | printf "%s\n" "$(getprop ro.product.model)" 2>/dev/null 19 | printf "%s\n" '检测到root权限授予失败,您无法安装chroot容器' 20 | press_enter_to_return 21 | tmoe_manager_main_menu 22 | ;; 23 | esac 24 | ;; 25 | esac 26 | } 27 | ################# 28 | notes_of_chroot() { 29 | printf "%s\n %s\n" "If you find that some directories cannot be unmounted forcibly before removing the container,then please restart your device." "移除容器前若发现部分已挂载目录无法强制卸载,请重启设备再卸载chroot容器,防止已挂载目录被误删!" >${CONFIG_FOLDER}/chroot-prompt 30 | sed -n p ${CONFIG_FOLDER}/chroot-prompt 31 | case ${LINUX_DISTRO} in 32 | Android) ;; 33 | *) 34 | printf "%s\n" "由于在测试chroot容器的过程中出现了部分已挂载的目录${RED}无法强制卸载${RESET}的情况,故建议您换用${BLUE}docker${RESET}容器。" 35 | printf "%s\n" "We recommend that you run ${BLUE}docker${RESET} containers on GNU/Linux system instead of ${RED}chroot${RESET} containers." 36 | ;; 37 | esac 38 | } 39 | ############# 40 | #此处不要加$@ 41 | -------------------------------------------------------------------------------- /share/container/chroot/startup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ${TMOE_CHROOT_PREFIX} mkdir -p ${TMOE_STARTUP_DIR} 3 | TMP_FILE="${TMPDIR}/.TMOE_CHROOT_STARTUP" 4 | cat >${TMP_FILE} <<-ENDOFTMOECHROOT 5 | #!/usr/bin/env bash 6 | get_tmoe_linux_help_info() { 7 | cat <<-'ENDOFHELP' 8 | -i --启动tmoe-linux manager 9 | -m --更换为tuna镜像源(仅debian,ubuntu,kali,alpine和arch) 10 | -vnc --启动VNC 11 | -n --启动novnc 12 | -x --启动x11 13 | -h --get help info 14 | ENDOFHELP 15 | } 16 | ############ 17 | main() { 18 | case "\$1" in 19 | i* | -i* | -I*) 20 | debian-i 21 | exit 0 22 | ;; 23 | -h* | --h*) 24 | get_tmoe_linux_help_info 25 | ;; 26 | -m* | m*) 27 | debian-i -m 28 | ;; 29 | -vnc* | vnc*) 30 | startx11vnc 31 | ;; 32 | -n* | novnc*) 33 | debian-i novnc 34 | ;; 35 | -x) 36 | startxsdl 37 | ;; 38 | *) start_tmoe_gnu_linux_chroot_container ;; 39 | esac 40 | } 41 | ############## 42 | start_tmoe_gnu_linux_chroot_container() { 43 | case \$(uname -o) in 44 | Android) ;; 45 | *) 46 | case \$(id -u) in 47 | 0) ;; 48 | *) 49 | if [ \$(command -v sudo) ]; then 50 | sudo su -c "bash ${DEBIAN_CHROOT}/usr/local/etc/tmoe-linux/container/tmoe-linux-container" 51 | else 52 | su -c "bash ${DEBIAN_CHROOT}/usr/local/etc/tmoe-linux/container/tmoe-linux-container" 53 | fi 54 | exit 1 55 | ;; 56 | esac 57 | ;; 58 | esac 59 | ######## 60 | TMOE_LOCALE_FILE="${CONFIG_FOLDER}/locale.txt" 61 | DEFAULT_SHELL_CONF=${CONFIG_FOLDER}/default_shell.conf 62 | PROC_FD_PATH="/proc/self/fd" 63 | ######### 64 | detect_mount() { 65 | MOUNT_DIR="\$1" 66 | if \$(grep -q " \${MOUNT_DIR%/} " /proc/mounts); then 67 | return 0 68 | else 69 | return 1 70 | fi 71 | } 72 | ########## 73 | #arch-linux挂载自身 74 | if ! detect_mount "${DEBIAN_CHROOT}/"; then 75 | su -c "mount --rbind ${DEBIAN_CHROOT} ${DEBIAN_CHROOT}/ &>/dev/null" 76 | su -c "mount -o remount,exec,suid,dev ${DEBIAN_CHROOT}" 77 | fi 78 | ######### 79 | [[ ! -s \${DEFAULT_SHELL_CONF} ]] || source \${DEFAULT_SHELL_CONF} 80 | if [[ -z \${TMOE_SHELL} ]]; then 81 | for i in su ash bash zsh; do 82 | [[ ! -f ${DEBIAN_CHROOT}/bin/\${i} ]] || TMOE_SHELL="/bin/\${i}" 83 | done 84 | [[ ! -f ${DEBIAN_CHROOT}/usr/bin/zsh ]] || TMOE_SHELL="/usr/bin/zsh" 85 | fi 86 | if [[ -z \${TMOE_SHELL} ]]; then 87 | #ALPINE ash shell is a link. 88 | for i in su ash bash zsh; do 89 | [[ ! -L ${DEBIAN_CHROOT}/bin/\${i} ]] || TMOE_SHELL="/bin/\${i}" 90 | done 91 | fi 92 | set -- "\${TMOE_SHELL}" "-l" "\$@" 93 | if [ -e "\${TMOE_LOCALE_FILE}" ]; then 94 | set -- "LANG=\$(cat \${TMOE_LOCALE_FILE} | head -n 1)" "\$@" 95 | else 96 | set -- "LANG=en_US.UTF-8" "\$@" 97 | fi 98 | ############ 99 | mount_01() { 100 | su -c "mount -o bind /\${i} ${DEBIAN_CHROOT}/\${i}" 101 | } 102 | ######### 103 | mkdir_01() { 104 | [[ -e "/\${i}" ]] || su -c "mkdir -p /\${i}" 105 | } 106 | ######## 107 | #PS1='\u:\w$ ' 108 | set -- "/usr/bin/env" "-i" "PULSE_SERVER=tcp:127.0.0.1:4713" "DISPLAY=:0.0" "HOME=/root" "PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games" "TMPDIR=/tmp" "TMOE_PROOT=false" "TMOE_CHROOT=true" "TERM=xterm-256color" "\$@" 109 | for i in dev proc sys dev/pts dev/shm etc/gitstatus; do 110 | if ! detect_mount "${DEBIAN_CHROOT}/\${i}"; then 111 | case \${i} in 112 | dev) mount_01 ;; 113 | proc) su -c "mount -t \${i} \${i} ${DEBIAN_CHROOT}/\${i}" ;; 114 | sys) su -c "mount -t \${i}fs \${i}fs ${DEBIAN_CHROOT}/\${i}" ;; 115 | dev/pts) 116 | if ! detect_mount "/\${i}"; then 117 | mkdir_01 118 | su -c "mount -o rw,nosuid,noexec,gid=5,mode=620,ptmxmode=000 -t devpts devpts /\${i}" 119 | fi 120 | su -c "mount -t devpts devpts ${DEBIAN_CHROOT}/\${i}" 121 | ;; 122 | dev/shm) 123 | if ! detect_mount "/\${i}"; then 124 | mkdir_01 125 | su -c "mount -o rw,nosuid,nodev,mode=1777 -t tmpfs tmpfs /\${i}" 126 | fi 127 | mount_01 128 | ;; 129 | etc/gitstatus) su -c "mount -o bind ${CONFIG_FOLDER}/gitstatus ${DEBIAN_CHROOT}/\${i}" ;; 130 | esac 131 | fi 132 | done 133 | unset i 134 | ######## 135 | for i in /dev/fd /dev/stdin /dev/stout /dev/sterr /dev/tty0; do 136 | if [ ! -e \${i} ] && [ ! -h \${i} ]; then 137 | case \${i} in 138 | /dev/fd) su -c "ln -s \${PROC_FD_PATH} \${i} &>/dev/null" ;; 139 | /dev/stdin) su -c "ln -s \${PROC_FD}/0 \${i} &>/dev/null" ;; 140 | /dev/stdout) su -c "ln -s \${PROC_FD}/1 \${i} &>/dev/null" ;; 141 | /dev/stderr) su -c "ln -s \${PROC_FD}/2 \${i} &>/dev/null" ;; 142 | /dev/tty0) 143 | #if [ -e "/dev/ttyGS0" ]; then 144 | # su -c "ln -s /dev/ttyGS0 /\${i} &>/dev/null" 145 | #else 146 | su -c "ln -s /dev/null \${i} &>/dev/null" 147 | #fi 148 | ;; 149 | esac 150 | fi 151 | done 152 | unset i 153 | ############### 154 | mount_read_only_sd() { 155 | ANDROID_EMULATED_0_DIR='/storage/emulated/0' 156 | if [ -e "\${ANDROID_EMULATED_0_DIR}" ]; then 157 | [[ -e "${DEBIAN_CHROOT}\${ANDROID_EMULATED_0_DIR}" ]] || mkdir -p "${DEBIAN_CHROOT}\${ANDROID_EMULATED_0_DIR}" 158 | su -c "mount -o ro /storage/emulated/0 ${DEBIAN_CHROOT}\${ANDROID_EMULATED_0_DIR} &>/dev/null" 159 | fi 160 | } 161 | ############ 162 | for i in tf termux sd; do 163 | if ! detect_mount "${DEBIAN_CHROOT}/media/\${i}"; then 164 | case \${i} in 165 | tf) 166 | TF_CARD_LINK="${HOME}/storage/external-1" 167 | if [ -h "\${TF_CARD_LINK}" ]; then 168 | TF_CARD_FOLDER=\$(readlink \${TF_CARD_LINK} | awk -F '/' '{print \$3}') 169 | if [ "\$(su -c "ls /mnt/media_rw/\${TF_CARD_FOLDER}")" ]; then 170 | su -c "mount -o bind /mnt/media_rw/\${TF_CARD_FOLDER} ${DEBIAN_CHROOT}/media/\${i} &>/dev/null" 171 | else 172 | su -c "mount -o bind \${TF_CARD_LINK} ${DEBIAN_CHROOT}/media/\${i} &>/dev/null" 173 | fi 174 | fi 175 | ;; 176 | ####### 177 | termux) 178 | [[ ! -d "/data/data/com.termux/files/home" ]] || su -c "mount -o bind /data/data/com.termux/files/home ${DEBIAN_CHROOT}/media/\${i} &>/dev/null" 179 | ;; 180 | ########### 181 | sd) 182 | if [ "\$(su -c "ls /data/media/0" 2>/dev/null)" ]; then 183 | su -c "mount -o bind /data/media/0 ${DEBIAN_CHROOT}/media/\${i} &>/dev/null" 184 | elif [ -e "/storage/self/primary" ]; then 185 | su -c "mount -o bind /storage/self/primary ${DEBIAN_CHROOT}/media/\${i} &>/dev/null" 186 | elif [ -e "/sdcard" ] || [ -h "/sdcard" ]; then 187 | su -c "mount -o bind /sdcard ${DEBIAN_CHROOT}/media/\${i} &>/dev/null" 188 | elif [ -e "${HOME}/Download" ]; then 189 | su -c "mount -o bind ${HOME}/Download ${DEBIAN_CHROOT}/media/\${i} &>/dev/null" 190 | else 191 | mount_read_only_sd 192 | fi 193 | ;; 194 | esac 195 | fi 196 | done 197 | unset i 198 | ########### 199 | set -- "${DEBIAN_CHROOT}" "\$@" 200 | set -- "chroot" "\$@" 201 | unset LD_PRELOAD 202 | TMOE_CHROOT_EXEC="exec \$@" 203 | su -c "\${TMOE_CHROOT_EXEC}" 204 | } 205 | main "\$@" 206 | ENDOFTMOECHROOT 207 | case $(uname -o) in 208 | Android) termux-fix-shebang ${TMP_FILE} ;; 209 | esac 210 | chmod a+x ${TMP_FILE} 211 | ${TMOE_CHROOT_PREFIX} mv -f ${TMP_FILE} ${TMOE_STARTUP_SCRIPT} 212 | #${TMOE_CHROOT_PREFIX} chmod a+x ${TMOE_STARTUP_SCRIPT} 213 | ln -sf ${TMOE_SHARE_DIR}/container/debian/debian ${PREFIX}/bin 214 | -------------------------------------------------------------------------------- /share/container/common: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ########################## 3 | startvnc_or_enter_the_container() { 4 | if [ -e "${DEBIAN_CHROOT}/usr/local/bin/startvnc" ]; then 5 | cat <<-EOFVNC 6 | You can type ${GREEN}startvnc${RESET} to start ${BLUE}tight/tigervnc server${RESET},type ${RED}stopvnc${RESET} to stop it. 7 | You can also type ${GREEN}debian-i${RESET} to start ${BLUE}Tmoe-linux tool.${RESET} 8 | EOFVNC 9 | [[ "${LINUX_DISTRO}" != 'Android' ]] || printf "%s\n" "在Android宿主机的Termux原系统下输${GREEN}startvnc${RESET}将同时启动Android版Realvnc viewer和${DEBIAN_FOLDER}容器内的tight或tiger vnc服务,输${GREEN}debian${RESET}仅支持进入${BLUE}${DEBIAN_FOLDER}容器${RESET}。" 10 | startx11vnc 11 | else 12 | cat <<-EOFDEB 13 | You can type ${GREEN}debian${RESET} to enter the ${BLUE}${DEBIAN_FOLDER} container${RESET}. 14 | You can also type ${GREEN}debian-i${RESET} to start ${BLUE}Tmoe-linux tool${RESET}. 15 | EOFDEB 16 | debian 17 | fi 18 | } 19 | ####################### 20 | install_gnu_linux_container() { 21 | #此处不能用变量debian_chroot 22 | source ${TMOE_SHARE_DIR}/deprecated/remove 23 | if [ -d ${HOME}/${DEBIAN_FOLDER} ] && [ ! -e ${TMOE_CONTAINER_DIR} ]; then 24 | if (whiptail --title "检测到您已安装${ROOTFS_NAME}容器,请选择您需要执行的操作!" --yes-button 'Start启动o(* ̄▽ ̄*)o' --no-button 'Reinstall重装(っ °Д °)' --yesno "${ROOTFS_NAME} has been installed, please choose what you need to do" 0 0); then 25 | #debian 26 | startvnc_or_enter_the_container 27 | else 28 | printf "%s\n" "${YELLOW}检测到您已安装${ROOTFS_NAME}容器,是否重新安装?[Y/n]${RESET} " 29 | printf "%s\n" "${YELLOW}您可以无需输"y",直接按回车键确认。${RESET} " 30 | printf "%s\n" "Detected that you have ${ROOTFS_NAME} container installed, do you want to reinstall it?${PURPLE}[Y/n]${RESET}" 31 | read opt 32 | case $opt in 33 | y* | Y* | "") 34 | remove_old_version_gnu_linux_container 35 | if [ "$?" != '0' ]; then 36 | printf "%s\n" "${ROOTFS_NAME}容器没有被移除" 37 | press_enter_to_return 38 | tmoe_manager_main_menu 39 | else 40 | if [ -d "${HOME}/debian_arm64" ]; then 41 | printf '%s\n' '正在强制删除' 42 | remove_old_version_gnu_linux_container 43 | fi 44 | check_and_view_the_eula 45 | fi 46 | ;; 47 | n* | N*) 48 | printf "%s\n" "skipped." 49 | press_enter_to_return 50 | tmoe_manager_main_menu 51 | ;; 52 | *) 53 | printf "%s\n" "Invalid choice. skipped." 54 | press_enter_to_return 55 | tmoe_manager_main_menu 56 | ;; 57 | esac 58 | fi 59 | 60 | else 61 | check_and_view_the_eula 62 | fi 63 | } 64 | ################################################ 65 | check_and_view_the_eula() { 66 | case ${TMOE_CHROOT} in 67 | false) rm -f ~/.Chroot-Container-Detection-File ${CONFIG_FOLDER}/chroot_container 2>/dev/null ;; 68 | true) touch ${CONFIG_FOLDER}/chroot_container ;; 69 | esac 70 | 71 | [[ -e "${CONFIG_FOLDER}/eula" ]] || tmoe_linux_container_eula 72 | source ${TMOE_SHARE_DIR}/container/menu 73 | } 74 | ######################## 75 | tmoe_linux_container_eula() { 76 | if [ ! -d "${DEBIAN_CHROOT}" ]; then 77 | #less -meQ 78 | sed -n p ${TMOE_GIT_DIR}/Licenses/tmoe-linux/LICENSE || $(whereis cat 2>/dev/null | awk '{print $2}') ${TMOE_GIT_DIR}/Licenses/tmoe-linux/LICENSE 79 | cat <<-EOF 80 | You must agree to the EULA to use this tool. 81 | Press ${GREEN}Enter${RESET} to agree ${BLUE}the EULA${RESET}, otherwise press ${YELLOW}Ctrl + C${RESET} or ${RED}close${RESET} the terminal directly. 82 | 按${GREEN}回车键${RESET}同意${BLUE}《最终用户许可协议》${RESET} ,否则请按${YELLOW}Ctrl+C${RESET} 或直接${RED}关闭${RESET}终端。 83 | EOF 84 | read 85 | touch ${CONFIG_FOLDER}/eula 86 | fi 87 | } 88 | ############# 89 | install_gnu_linux_container 90 | -------------------------------------------------------------------------------- /share/container/debian/debian: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ############ 3 | debian_main() { 4 | case "$1" in 5 | i* | -i* | -I*) 6 | debian-i 7 | exit 0 8 | ;; 9 | -h* | --h*) 10 | printf "%s\n" "暂无帮助信息" 11 | ;; 12 | -m* | m*) 13 | debian-i -m 14 | ;; 15 | -vnc* | vnc*) 16 | startx11vnc 17 | ;; 18 | -n* | novnc*) 19 | debian-i novnc 20 | ;; 21 | -x) 22 | startxsdl 23 | ;; 24 | *) start_tmoe_gnu_linux_default_container ;; 25 | esac 26 | } 27 | ######### 28 | start_tmoe_gnu_linux_default_container() { 29 | CONFIG_FOLDER=${HOME}/.config/tmoe-linux 30 | [[ $(uname -o) = 'Android' ]] || PREFIX=/usr/local 31 | if [ -e "${CONFIG_FOLDER}/chroot_container" ]; then 32 | bash ${PREFIX}/bin/tmoe ch 33 | else 34 | bash ${PREFIX}/bin/tmoe pr 35 | fi 36 | } 37 | ########## 38 | debian_main "$@" 39 | -------------------------------------------------------------------------------- /share/container/debian/lnk-menu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ######################### 3 | main() { 4 | check_chroot_file 5 | source_env_file 6 | check_tmoe_container_chroot 7 | start_menu 8 | } 9 | ################ 10 | source_env_file() { 11 | case $(uname -o) in 12 | Android) TMOE_LINUX_DIR="${HOME}/.local/share/tmoe-linux" ;; 13 | *) 14 | TMOE_LINUX_DIR="/usr/local/etc/tmoe-linux" 15 | TMPDIR=/tmp 16 | ;; 17 | esac 18 | TMOE_GIT_DIR="${TMOE_LINUX_DIR}/git" 19 | TMOE_SHARE_DIR="${TMOE_GIT_DIR}/share" 20 | TMOE_CONTAINER_DIR="${TMOE_LINUX_DIR}/containers" 21 | ENV_FILE="${TMOE_SHARE_DIR}/environment/manager_environment" 22 | source ${ENV_FILE} 23 | } 24 | ########### 25 | check_chroot_file() { 26 | CONFIG_FOLDER=${HOME}/.config/tmoe-linux 27 | TMOE_CHROOT='false' 28 | [[ ! -e "${CONFIG_FOLDER}/chroot_container" ]] || TMOE_CHROOT='true' 29 | } 30 | ########### 31 | start_menu() { 32 | source ${TMOE_SHARE_DIR}/container/list 33 | check_proot_or_chroot 34 | RETURN_TO_WHERE_02='exit' 35 | list_installed_tmoe_containers 36 | } 37 | main "$@" 38 | -------------------------------------------------------------------------------- /share/container/menu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ############################## 3 | proot_container_main_menu() { 4 | case "$1" in 5 | restore | --restore) restore_tmoe_container ;; 6 | *) proot_container_menu ;; 7 | esac 8 | } 9 | ################################ 10 | list_tmoe_containers() { 11 | ARCH_TYPE=${TRUE_ARCH_TYPE} 12 | rm ~/.config/tmoe-linux/across_architecture_container.txt 2>/dev/null 13 | case ${ARCH_TYPE} in 14 | mips* | riscv64) 15 | source ${TMOE_SHARE_DIR}/container/qemu/qemu-user 16 | git_clone_debian_ports_distro 17 | ;; 18 | *) choose_which_gnu_linux_distro ;; 19 | esac 20 | } 21 | ############## 22 | across_architectures_container() { 23 | case ${TMOE_CHROOT} in 24 | true) 25 | case ${LINUX_DISTRO} in 26 | Android) 27 | getprop ro.product.model 2>/dev/null 28 | printf "%s %s\n" "部分Android系统无${BLUE}/proc/sys/fs/binfmt_misc${RESET}, 故本工具未对Android开放此功能。" "如需跨架构运行chroot容器,则请换用GNU/Linux系统,或自行加载${YELLOW}内核模块${RESET}。" 29 | printf "%s\n" "Sorry, you are using Android system, please modprobe binfmt_misc kernel module by yourself." 30 | press_enter_to_return 31 | list_tmoe_containers 32 | ;; 33 | esac 34 | ;; 35 | esac 36 | source ${TMOE_SHARE_DIR}/container/qemu/qemu-user 37 | tmoe_qemu_user_manager 38 | } 39 | ############# 40 | proot_container_menu_multi_langs() { 41 | proot_container_menu_en() { 42 | SELECTED_GNU_LINUX=$(whiptail --title "${CONTAINER_TYPE} CONTAINER" --menu "Your current architecture is ${TRUE_ARCH_TYPE}.\nDo you want to run on the same architecture or across architectures?" 0 50 0 \ 43 | "1" "💠 ${TRUE_ARCH_TYPE} distros list" \ 44 | "2" "📑 List installed" \ 45 | "3" "⚔️ Across architectures" \ 46 | "4" "🔯 Restore ${CONTAINER_TYPE} container" \ 47 | "5" "📕 Configuration & manual" \ 48 | "0" "🌚 Back to the main menu" \ 49 | 3>&1 1>&2 2>&3) 50 | } 51 | proot_container_menu_cn() { 52 | SELECTED_GNU_LINUX=$(whiptail --title "${CONTAINER_TYPE}容器" --menu "您是想要运行${TRUE_ARCH_TYPE}架构的容器,还是跨架构呢?\n除向下兼容外,跨架构运行的效率可能偏低" 0 50 0 \ 53 | "1" "💠 ${TRUE_ARCH_TYPE}发行版列表" \ 54 | "2" "📑 List installed 当前已安装容器列表" \ 55 | "3" "⚔️ Across architectures 跨CPU架构" \ 56 | "4" "🔯 Restore 恢复/还原${CONTAINER_TYPE}容器" \ 57 | "5" "📕 配置与手册" \ 58 | "0" "🌚 Back to the main menu 返回主菜单" \ 59 | 3>&1 1>&2 2>&3) 60 | } 61 | case ${TMOE_MENU_LANG} in 62 | zh_*UTF-8) proot_container_menu_cn ;; 63 | *) proot_container_menu_en ;; 64 | esac 65 | ############################## 66 | case "${SELECTED_GNU_LINUX}" in 67 | 0 | "") tmoe_manager_main_menu ;; 68 | 1) list_tmoe_containers ;; 69 | 2) list_installed_tmoe_containers ;; 70 | 3) across_architectures_container ;; 71 | 4) restore_tmoe_container ;; 72 | 5) configure_tmoe_container ;; 73 | esac 74 | #################### 75 | press_enter_to_return 76 | tmoe_manager_main_menu 77 | } 78 | ############ 79 | chroot_container_menu_multi_langs() { 80 | chroot_container_menu_en() { 81 | SELECTED_GNU_LINUX=$(whiptail --title "${CONTAINER_TYPE} CONTAINER" --menu "Your current architecture is ${TRUE_ARCH_TYPE}.\nDo you want to run on the same architecture or across architectures?" 0 50 0 \ 82 | "1" "💠 ${TRUE_ARCH_TYPE} distros list" \ 83 | "2" "📑 List installed" \ 84 | "3" "🥛 nspawn(systemd-container,supports systemctl)" \ 85 | "4" "⚔️ Across architectures" \ 86 | "5" "🔯 Restore ${CONTAINER_TYPE} container" \ 87 | "6" "📕 Configuration & manual" \ 88 | "0" "🌚 Back to the main menu" \ 89 | 3>&1 1>&2 2>&3) 90 | } 91 | chroot_container_menu_cn() { 92 | SELECTED_GNU_LINUX=$(whiptail --title "${CONTAINER_TYPE}容器" --menu "您是想要运行${TRUE_ARCH_TYPE}架构的容器,还是跨架构呢?\n除向下兼容外,跨架构运行的效率可能偏低" 0 50 0 \ 93 | "1" "💠 ${TRUE_ARCH_TYPE}发行版列表" \ 94 | "2" "📑 List installed 当前已安装容器列表" \ 95 | "3" "🥛 nspawn(systemd容器,支持systemctl)" \ 96 | "4" "⚔️ Across architectures 跨CPU架构" \ 97 | "5" "🔯 Restore 恢复/还原${CONTAINER_TYPE}容器" \ 98 | "6" "📕 配置与手册" \ 99 | "0" "🌚 Back to the main menu 返回主菜单" \ 100 | 3>&1 1>&2 2>&3) 101 | } 102 | case ${TMOE_MENU_LANG} in 103 | zh_*UTF-8) chroot_container_menu_cn ;; 104 | *) chroot_container_menu_en ;; 105 | esac 106 | ############################## 107 | case "${SELECTED_GNU_LINUX}" in 108 | 0 | "") tmoe_manager_main_menu ;; 109 | 1) list_tmoe_containers ;; 110 | 2) list_installed_tmoe_containers ;; 111 | 3) systemd_nspawn_env ;; 112 | 4) across_architectures_container ;; 113 | 5) restore_tmoe_container ;; 114 | 6) configure_tmoe_container ;; 115 | esac 116 | #################### 117 | press_enter_to_return 118 | tmoe_manager_main_menu 119 | } 120 | ############ 121 | proot_container_menu() { 122 | source ${TMOE_SHARE_DIR}/container/list 123 | check_proot_or_chroot 124 | SYSTEMD_NSPAWN='false' 125 | RETURN_TO_WHERE='proot_container_menu' 126 | RETURN_TO_WHERE_02=${RETURN_TO_WHERE} 127 | case ${TMOE_CHROOT} in 128 | true) chroot_container_menu_multi_langs ;; 129 | *) proot_container_menu_multi_langs ;; 130 | esac 131 | } 132 | ################## 133 | systemd_nspawn_env() { 134 | if [ ! $(command -v systemd-nspawn) ]; then 135 | printf "${YELLOW}%s${RESET}\n" "Do you want to install systemd-container?${PURPLE}[Y/n]" 136 | printf "${GREEN}%s ${BLUE}%s${RESET}\n" "${TMOE_INSTALLATION_COMMAND}" "systemd-container" 137 | do_you_want_to_continue 138 | case ${LINUX_DISTRO} in 139 | Android) 140 | printf "%s\n" "Sorry,this feature does not support ${PURPLE}Android${RESET} system." 141 | printf "%s\n" "请换用${GREEN}GNU/Linux${RESET}系统!!!" 142 | ;; 143 | *) ${TMOE_INSTALLATION_COMMAND} systemd-container ;; 144 | esac 145 | fi 146 | if [ ! $(command -v dbus-uuidgen) ]; then 147 | printf "${RED}%s${RESET}\n" "EORROR!YOU DID NOT INSTALL DBUS." 148 | printf "${GREEN}%s ${BLUE}%s${RESET}\n" "${TMOE_INSTALLATION_COMMAND}" "dbus" 149 | press_enter_to_return 150 | chroot_container_menu_multi_langs 151 | #${TMOE_INSTALLATION_COMMAND} dbus 152 | fi 153 | case ${LINUX_DISTRO} in 154 | Android) 155 | press_enter_to_return 156 | chroot_container_menu_multi_langs 157 | ;; 158 | esac 159 | SYSTEMD_NSPAWN='true' 160 | list_installed_tmoe_containers 161 | } 162 | ############### 163 | restore_tmoe_container() { 164 | source ${TMOE_SHARE_DIR}/compression/restore 165 | } 166 | configure_tmoe_container() { 167 | source ${TMOE_SHARE_DIR}/configuration/menu 168 | configure_tmoe_container 169 | } 170 | #################### 171 | proot_container_main_menu 172 | -------------------------------------------------------------------------------- /share/container/nspawn/startup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | MACHINE_NAME=$(printf "%s\n" ${DEBIAN_FOLDER} | sed 's@_@-@g') #此处并非重复操作 3 | unset TMOE_SD_DIR 4 | TMOE_DOCKER_DIR="/media/docker" 5 | if egrep -q '^root:(\*|\!):' ${DEBIAN_CHROOT}/etc/shadow; then 6 | sed -i -E 's@(^root):.:@\1::@g' ${DEBIAN_CHROOT}/etc/shadow 7 | fi 8 | case $(${TMOE_PREFIX} cat ${DEBIAN_CHROOT}/etc/hostname) in 9 | localhost | LXC_NAME | "") 10 | ${TMOE_PREFIX} printf "%s\n" "${MACHINE_NAME}" >${DEBIAN_CHROOT}/etc/hostname 11 | ${TMOE_PREFIX} printf "%s\n" "127.0.0.1 ${MACHINE_NAME}" >>${DEBIAN_CHROOT}/etc/hosts 12 | ;; 13 | esac 14 | if [ -s "${DEBIAN_CHROOT}/etc/machine-id" ]; then 15 | rm -f ${DEBIAN_CHROOT}/etc/machine-id 16 | fi 17 | set -- "${@}" "--boot" 18 | set -- "${@}" "--directory" "${DEBIAN_CHROOT}" 19 | set -- "${@}" "--uuid" "$(dbus-uuidgen)" 20 | #arch不要设置将其设置为pick 21 | set -- "${@}" "--private-users=no" 22 | set -- "${@}" "--machine" "${MACHINE_NAME}" 23 | set -- "${@}" "--link-journal" "auto" 24 | set -- "${@}" "--resolv-conf" "auto" 25 | set -- "${@}" "--timezone" "auto" 26 | set -- "${@}" "--setenv" "TMOE_CHROOT=true" 27 | set -- "${@}" "--setenv" "TMOE_PROOT=false" 28 | set -- "${@}" "--setenv" "TMOE_DOCKER=false" 29 | #set -- "${@}" "--setenv" '"PULSE_SERVER=unix:/usr/lib/systemd/user/pulseaudio.socket"' 30 | set -- "${@}" "--setenv" "PULSE_SERVER=tcp:127.0.0.1:4713" 31 | set -- "${@}" "--setenv" "DISPLAY=:0.0" 32 | set -- "${@}" "--setenv" "CONTAINER_SYSTEMD=true" 33 | set -- "${@}" "--register" "yes" 34 | set -- "${@}" "--notify-ready" "yes" 35 | for i in ${HOME}/Download /root/sd /sdcard /media/sd; do 36 | [[ ! -d "${i}" ]] || TMOE_SD_DIR=${i} 37 | done 38 | [[ -z ${TMOE_SD_DIR} ]] || set -- "${@}" "--bind" "${TMOE_SD_DIR}:/media/sd" 39 | [[ ! -e "${TMOE_DOCKER_DIR}" ]] || set -- "${@}" "--bind" "${TMOE_DOCKER_DIR}" 40 | set -- "systemd-nspawn" "${@}" 41 | unset LD_PRELOAD 42 | TMOE_NSPAWN_EXEC="exec ${@}" 43 | su -c "${TMOE_NSPAWN_EXEC}" 44 | #exit 0 45 | -------------------------------------------------------------------------------- /share/container/proot/check_container_arch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ############################################ 3 | case $(uname -m) in 4 | armv7* | armv8l) 5 | TRUE_ARCH_TYPE="armhf" 6 | ;; 7 | armv6* | armv5*) 8 | TRUE_ARCH_TYPE="armel" 9 | ;; 10 | aarch64 | armv8* | arm64) 11 | TRUE_ARCH_TYPE="arm64" 12 | ;; 13 | x86_64 | amd64) 14 | TRUE_ARCH_TYPE="amd64" 15 | ;; 16 | i*86 | x86) 17 | TRUE_ARCH_TYPE="i386" 18 | ;; 19 | s390*) 20 | TRUE_ARCH_TYPE="s390x" 21 | ;; 22 | ppc*) 23 | TRUE_ARCH_TYPE="ppc64el" 24 | ;; 25 | mips64*) 26 | TRUE_ARCH_TYPE="mips64el" 27 | ;; 28 | mips*) 29 | TRUE_ARCH_TYPE="mipsel" 30 | ;; 31 | risc*) 32 | TRUE_ARCH_TYPE="riscv64" 33 | ;; 34 | esac 35 | ###################### 36 | TMOE_QEMU="true" 37 | case "${CONTAINER_ARCH}" in 38 | i386) 39 | NEW_TMOE_ARCH='i386' 40 | case ${TRUE_ARCH_TYPE} in 41 | amd64 | i386) TMOE_QEMU="false" ;; 42 | *) TMOE_QEMU_ARCH="${NEW_TMOE_ARCH}" ;; 43 | esac 44 | ;; 45 | amd64) 46 | NEW_TMOE_ARCH='amd64' 47 | TMOE_QEMU_ARCH="x86_64" 48 | ;; 49 | arm64) 50 | NEW_TMOE_ARCH='arm64' 51 | TMOE_QEMU_ARCH="aarch64" 52 | ;; 53 | armhf) 54 | NEW_TMOE_ARCH='armhf' 55 | case ${TRUE_ARCH_TYPE} in 56 | arm64 | armhf) TMOE_QEMU="false" ;; 57 | *) TMOE_QEMU_ARCH="arm" ;; 58 | esac 59 | ;; 60 | armel) 61 | NEW_TMOE_ARCH='armel' 62 | case ${TRUE_ARCH_TYPE} in 63 | arm64 | armhf | armel) TMOE_QEMU="false" ;; 64 | *) TMOE_QEMU_ARCH="armeb" ;; 65 | esac 66 | ;; 67 | ppc64el) 68 | NEW_TMOE_ARCH='ppc64el' 69 | TMOE_QEMU_ARCH="ppc64le" 70 | ;; 71 | s390x) 72 | NEW_TMOE_ARCH='s390x' 73 | TMOE_QEMU_ARCH="${NEW_TMOE_ARCH}" 74 | ;; 75 | mipsel) 76 | NEW_TMOE_ARCH='mipsel' 77 | TMOE_QEMU_ARCH="${NEW_TMOE_ARCH}" 78 | ;; 79 | mips64el) 80 | NEW_TMOE_ARCH='mips64el' 81 | TMOE_QEMU_ARCH="${NEW_TMOE_ARCH}" 82 | ;; 83 | riscv64) 84 | NEW_TMOE_ARCH='riscv64' 85 | TMOE_QEMU_ARCH="riscv64" 86 | ;; 87 | esac 88 | #检测两次 89 | case "${CONTAINER_ARCH}" in 90 | "${TRUE_ARCH_TYPE}") TMOE_QEMU="false" ;; 91 | esac 92 | -------------------------------------------------------------------------------- /share/container/remove: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | tips_of_umount_chroot_container_02() { 4 | cat <<-EOF 5 | ${YELLOW}Q:为什么卸载chroot容器需要如此谨慎?${RESET} 6 | A:此处引用umount的用户手册。 7 | ${GREEN}Note that a filesystem cannot be unmounted when it is 'busy' - for example, when there are open files on it, or when some process 8 | has its working directory there, or when a swap file on it is in use. The offending process could even be umount itself - it 9 | opens libc, and libc in its turn may open for example locale files. A lazy unmount avoids this problem, but it may introduce 10 | other issues.${RESET} 11 | 在上文中介绍到了${BLUE}--lazy${RESET}参数,然而这并不是重点。 12 | 重点是mount后的目录,在umount时可能会遇到一些问题。 13 | 当设备处于繁忙状态时,将无法卸载。即便使用强制卸载,也依旧(可能)存在一些问题。 14 | 这和windows的外置USB设备无法弹出时,手动拔出是不一样的。 15 | chroot挂载了系统底层的目录,为了保证系统不受损害,当检测到无法卸载时,您可通过手动重启设备来解决。 16 | 本工具提供了检测功能,当检测到挂载目录为空时将会出现${GREEN}total 0${RESET}。 17 | 在这种情况下,一般能正常卸载。 18 | 但也存在特例,当您使用套娃循环挂载,不断地挂载自身时,将有可能导致异常现象。 19 | 为防止异常状况,本工具提供了多次检测的功能。 20 | 当检测到mounted的目录不为空时,将无法继续执行操作。 21 | 因此在一般情况下,您都可以安心卸载容器。 22 | 欲了解更多关于mount和umount的内容,请阅览相关手册。 23 | In order to prevent accidental deletion of directories, tmoe-linux manager have done additional detection steps. 24 | So you can safely remove the ${BLUE}${DEBIAN_FOLDER}${RESET} container under normal circumstances. 25 | If you find that some directories cannot be unmounted, you can solve it by restarting the device. 26 | EOF 27 | } 28 | ############## 29 | tips_of_umount_chroot_container_01() { 30 | cat <<-EOF 31 | 移除容器前,请先确保您unmounted了容器mounted目录。 32 | 建议您在移除前进行备份,若因操作不当而导致数据丢失,开发者${RED}概不负责${RESET}!!! 33 | Before removing the container, make sure you have unmounted ${BLUE}dev dev/shm dev/pts proc sys root/sd media/sd media/tf${RESET} and other directories. 34 | It is recommended that you backup the entire system before removal. 35 | If the data is lost due to improper operation, the developer is not responsible! 36 | EOF 37 | } 38 | ########### 39 | remove_gnu_linux_container() { 40 | case ${TMOE_CHROOT} in 41 | true) 42 | tips_of_umount_chroot_container_01 43 | #source ${TMOE_SHARE_DIR}/removal/umount &>/dev/null 44 | tips_of_umount_chroot_container_02 45 | ;; 46 | esac 47 | if [ "$(ls ${DEBIAN_CHROOT}/proc 2>/dev/null)" ]; then 48 | printf "%s\n" "检测到proc目录不为空,无法继续卸载" 49 | printf "%s\n" "Please restart the device to unmount the ${DEBIAN_CHROOT}/${i} directory." 50 | printf "为防止目录被清空,请退出!!!" 51 | press_enter_to_return 52 | exit 1 53 | fi 54 | 55 | cd ${HOME} 56 | for i in dev/shm dev/pts proc sys storage/emulated/0/* media/sd media/tf; do 57 | if [ -e "${DEBIAN_CHROOT}/${i}" ]; then 58 | ls -lAh "${DEBIAN_CHROOT}/${i}" 2>/dev/null 59 | fi 60 | done 61 | unset i 62 | check_rootfs_dir 63 | sed -n p /proc/mounts | grep ${DEBIAN_CHROOT} 64 | pkill -9 proot 2>/dev/null 65 | pkill -9 chroot 2>/dev/null 66 | ps -e | grep proot 67 | ps -e | grep startvnc 68 | printf "%s\n" "移除容器前,本工具将${RED}自动停止${RESET}${BLUE}${DEBIAN_FOLDER}${RESET}容器所运行的${GREEN}所有进程${RESET}。" 69 | printf "%s\n" "Tmoe-linux manager will ${RED}automatically stop${RESET} ${GREEN}all processes${RESET} running in the ${BLUE}${DEBIAN_FOLDER}${RESET} container, and unmount the container directory." 70 | pgrep proot &>/dev/null 71 | if [ "$?" = "0" ]; then 72 | printf '%s\n' '检测到proot容器正在运行,请先输stopvnc或手动强制停止容器运行' 73 | #printf "%s\n" "若${ROOTFS_NAME}容器未停止运行,则建议你先手动在容器中执行stopvnc,再进行移除操作。" 74 | fi 75 | ls -l ${DEBIAN_CHROOT}/root/termux/* 2>/dev/null 76 | if [ "$?" = "0" ]; then 77 | printf '%s\n' 'WARNING!检测到/root/termux无法强制卸载,您当前使用的可能是chroot容器' 78 | printf "%s\n" "若为误报,则请先停止容器进程,再手动移除${DEBIAN_CHROOT}/root/sd" 79 | printf '%s\n' '建议您在移除前进行备份,若因操作不当而导致数据丢失,开发者概不负责!!!' 80 | fi 81 | printf "%s\n" "Detecting container size... 正在检测${ROOTFS_NAME}容器占用空间大小" 82 | ${TMOE_PREFIX} du -sh ${DEBIAN_CHROOT} --exclude=${DEBIAN_CHROOT}/root/tf --exclude=${DEBIAN_CHROOT}/root/sd --exclude=${DEBIAN_CHROOT}/root/termux 2>/dev/null 83 | if [ ! -d ${DEBIAN_CHROOT} ]; then 84 | printf "%s\n" "${YELLOW}It is detected that you do not currently have GNU/Linux container installed. 检测到您当前未安装容器${RESET}" 85 | fi 86 | printf "%s\n" "Press ${GREEN}enter${RESET} to ${RED}remove${RESET}." 87 | printf "%s\n" "按${GREEN}回车键${RESET}确认${RED}移除${RESET}" 88 | printf "%s\n" "Do you want to remove it?${PURPLE}[Y/n]${RESET}" 89 | read opt 90 | case $opt in 91 | y* | Y* | "") 92 | chmod 777 -R ${DEBIAN_CHROOT} || sudo chmod 777 -R ${DEBIAN_CHROOT} 93 | #non-rm "${CONFIG_FOLDER}/chroot_container" 94 | rm -rfv "${DEBIAN_CHROOT}" ${PREFIX}/bin/debian-rm ${PREFIX}/bin/code ~/.config/tmoe-linux/across_architecture_container.txt 2>/dev/null || sudo rm -rfv "${DEBIAN_CHROOT}" ${PREFIX}/bin/debian-rm ${PREFIX}/bin/code ~/.config/tmoe-linux/across_architecture_container.txt 2>/dev/null 95 | printf "%s\n" "如需删除(通用的)启动脚本,则请手动输${RED}rm -f${RESET} ${BLUE}${PREFIX}/bin/debian ${PREFIX}/bin/startvnc ${PREFIX}/bin/startx11vnc ${PREFIX}/bin/stopvnc ${PREFIX}/bin/startxsdl${RESET}" 96 | sed -i '/alias debian=/d ; /alias debian-rm=/d' ${PREFIX}/etc/profile 2>/dev/null 97 | source profile >/dev/null 2>&1 98 | printf '%s\n' 'The container has been removed. If you want to uninstall aria2, enter "apt remove aria2" or "apt purge aria2"' 99 | printf '%s\n' '移除完成,如需卸载aria2,请手动输apt remove aria2' 100 | printf "%s\n" "Deleted已删除" 101 | ;; 102 | n* | N*) printf "%s\n" "skipped." ;; 103 | *) printf "%s\n" "Invalid choice. skipped." ;; 104 | esac 105 | printf "%s\n" "若需删除tmoe-linux管理器,则请输rm -f ${PREFIX}/bin/debian-i" 106 | printf '%s\n' 'If you want to reinstall, it is not recommended to remove the image file.' 107 | printf "%s\n" "${YELLOW}若您需要重装容器,则不建议删除镜像文件。${RESET} " 108 | cd ${ROOTFS_DIR} 109 | ls -lh ${ROOTFS_NAME}*-rootfs.tar.* 2>/dev/null 110 | printf "%s\n" "${YELLOW}请问您是否需要删除容器镜像文件?[Y/n]${RESET} " 111 | printf "%s\n" "${RED}rm -fv ${ROOTFS_DIR}/${ROOTFS_NAME}*-rootfs.tar.*${RESET}" 112 | printf "%s\n" "Do you need to delete the image file (${ROOTFS_NAME}*-rootfs.tar.*)?${PURPLE}[Y/n]${RESET}" 113 | read opt 114 | case $opt in 115 | y* | Y* | "") 116 | #rm -fv ${DEBIAN_CHROOT}*-rootfs.tar.* 117 | #此处应删除ROOTFS_NAME而非DEBIAN_FOLDER开头的rootfs文件 118 | rm -fv ${ROOTFS_DIR}/${ROOTFS_NAME}*-rootfs.tar.* 119 | printf "%s\n" "Deleted已删除" 120 | ;; 121 | n* | N*) printf "%s\n" "${YELLOW}Skipped,已跳过,按回车键返回。${RESET} " ;; 122 | *) printf "%s\n" "${YELLOW}Invalid choice,skipped.已跳过,按回车键返回。${RESET} " ;; 123 | esac 124 | #tmoe_manager_main_menu 125 | } 126 | ################### 127 | remove_gnu_linux_container 128 | -------------------------------------------------------------------------------- /share/deprecated/remove: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | remove_old_version_gnu_linux_container() { 4 | cd ${HOME} 5 | DEBIAN_CHROOT=${HOME}/${DEBIAN_FOLDER} 6 | #旧版存储于HOME 7 | source ${TMOE_SHARE_DIR}/removal/umount 8 | for i in dev dev/shm dev/pts proc sys storage/emulated/0/* media/sd media/tf; do 9 | if [ -e "${DEBIAN_CHROOT}/${i}" ]; then 10 | ls -lAh "${DEBIAN_CHROOT}/${i}" 2>/dev/null 11 | fi 12 | done 13 | unset i 14 | cat <<-EOF 15 | 移除系统前,请先确保您已卸载容器挂载目录。 16 | 建议您在移除前进行备份,若因操作不当而导致数据丢失,开发者${RED}概不负责${RESET}!!! 17 | Before removing the system, make sure you have unmounted ${BLUE}dev dev/shm dev/pts proc sys root/sd media/sd media/tf${RESET} and other directories. 18 | It is recommended that you backup the entire system before removal. 19 | If the data is lost due to improper operation, the developer is not responsible! 20 | EOF 21 | #case ${TMOE_CHROOT} in 22 | #true) 23 | # for i in dev proc sys root/sd tmp root/termux root/tf; do 24 | # if [ -e "${DEBIAN_CHROOT}/${i}" ]; then 25 | # su -c "chattr -i ${i}" 26 | # fi 27 | # done 28 | # unset i 29 | # ;; 30 | #esac 31 | sed -n p /proc/mounts | grep ${DEBIAN_FOLDER} 32 | ps -e | grep proot 33 | ps -e | grep startvnc 34 | printf "%s\n" "移除系统前,请先确保您已停止GNU/Linux容器。" 35 | pkill -9 proot 2>/dev/null 36 | pgrep proot &>/dev/null 37 | if [ "$?" = "0" ]; then 38 | printf '%s\n' '检测到proot容器正在运行,请先输stopvnc或手动强制停止容器运行' 39 | fi 40 | ls -l ${DEBIAN_CHROOT}/root/termux/* 2>/dev/null 41 | if [ "$?" = "0" ]; then 42 | printf '%s\n' 'WARNING!检测到/root/termux无法强制卸载,您当前使用的可能是chroot容器' 43 | printf "%s\n" "若为误报,则请先停止容器进程,再手动移除${DEBIAN_CHROOT}/root/sd" 44 | printf '%s\n' '建议您在移除前进行备份,若因操作不当而导致数据丢失,开发者概不负责!!!' 45 | #printf '%s\n' '为防止数据丢失,建议您重启设备后再重试。' 46 | #printf "%s\n" "Press ${GREEN}enter${RESET} to ${BLUE}return.${RESET}" 47 | #printf "%s\n" "按${GREEN}回车键${RESET}${BLUE}返回${RESET}" 48 | #read 49 | #tmoe_manager_main_menu 50 | fi 51 | printf "%s\n" "若${ROOTFS_NAME}容器未停止运行,则建议你先手动在termux原系统中执行stopvnc,再进行移除操作。" 52 | printf "%s\n" "Detecting container size... 正在检测${ROOTFS_NAME}容器占用空间大小" 53 | ${TMOE_PREFIX} du -sh ./${DEBIAN_FOLDER} --exclude=./${DEBIAN_FOLDER}/root/tf --exclude=./${DEBIAN_FOLDER}/root/sd --exclude=./${DEBIAN_FOLDER}/root/termux 54 | if [ ! -d ${DEBIAN_CHROOT} ]; then 55 | printf "%s\n" "${YELLOW}It is detected that you do not currently have GNU/Linux container installed. 检测到您当前未安装容器${RESET}" 56 | fi 57 | printf "%s\n" "Do you want to remove it?${PURPLE}[Y/n]${RESET}" 58 | printf "%s\n" "${YELLOW}按回车键确认移除 Press enter to remove.${RESET} " 59 | read opt 60 | case $opt in 61 | y* | Y* | "") 62 | chmod 777 -R ${DEBIAN_FOLDER} || sudo chmod 777 -R ${DEBIAN_FOLDER} 63 | rm -rfv "${DEBIAN_FOLDER}" ${PREFIX}/bin/debian ${PREFIX}/bin/startvnc ${PREFIX}/bin/startx11vnc ${PREFIX}/bin/stopvnc ${PREFIX}/bin/startxsdl ${PREFIX}/bin/debian-rm ${PREFIX}/bin/code ~/.config/tmoe-linux/across_architecture_container.txt ${PREFIX}/bin/startx11vnc "${CONFIG_FOLDER}/chroot_container" 2>/dev/null || sudo rm -rfv "${DEBIAN_FOLDER}" ${PREFIX}/bin/debian ${PREFIX}/bin/startvnc ${PREFIX}/bin/startx11vnc ${PREFIX}/bin/stopvnc ${PREFIX}/bin/startxsdl ${PREFIX}/bin/debian-rm ${PREFIX}/bin/code ~/.config/tmoe-linux/across_architecture_container.txt ${PREFIX}/bin/startx11vnc "${CONFIG_FOLDER}/chroot_container" 2>/dev/null 64 | if [ -d "${HOME}/debian_arm64" ]; then 65 | printf "%s\n" "检测到残留文件夹,正在移除..." 66 | chmod 777 -R "${HOME}/debian_arm64" 67 | rm -rf "${HOME}/debian_arm64" 2>/dev/null || sudo rm -rfv "${HOME}/debian_arm64" 68 | fi 69 | sed -i '/alias debian=/d' ${PREFIX}/etc/profile 2>/dev/null 70 | sed -i '/alias debian-rm=/d' ${PREFIX}/etc/profile 2>/dev/null 71 | source profile >/dev/null 2>&1 72 | printf '%s\n' 'The container has been removed. If you want to uninstall aria2, enter "apt remove aria2" or "apt purge aria2"' 73 | printf '%s\n' '移除完成,如需卸载aria2,请手动输apt remove aria2' 74 | printf "%s\n" "Deleted已删除" 75 | ;; 76 | n* | N*) printf "%s\n" "skipped." ;; 77 | *) printf "%s\n" "Invalid choice. skipped." ;; 78 | esac 79 | printf "%s\n" "若需删除tmoe-linux管理器,则请输rm -f ${PREFIX}/bin/debian-i" 80 | printf '%s\n' 'If you want to reinstall, it is not recommended to remove the image file.' 81 | printf "%s\n" "${YELLOW}若您需要重装容器,则不建议删除镜像文件。${RESET} " 82 | cd ${HOME} 83 | ls -lh ${ROOTFS_NAME}*-rootfs.tar.* 2>/dev/null 84 | printf "%s\n" "${YELLOW}请问您是否需要删除容器镜像文件?[Y/n]${RESET} " 85 | printf "%s\n" "${RED}rm -fv ~/${ROOTFS_NAME}*-rootfs.tar.*${RESET}" 86 | printf "%s\n" "Do you need to delete the image file (${ROOTFS_NAME}*-rootfs.tar.*)?${PURPLE}[Y/n]${RESET}" 87 | read opt 88 | case $opt in 89 | y* | Y* | "") 90 | #rm -fv ${DEBIAN_CHROOT}*-rootfs.tar.* 91 | #此处应删除ROOTFS_NAME而非DEBIAN_FOLDER开头的rootfs文件 92 | rm -fv ~/${ROOTFS_NAME}*-rootfs.tar.* 93 | printf "%s\n" "Deleted已删除" 94 | ;; 95 | n* | N*) printf "%s\n" "${YELLOW}Skipped,已跳过,按回车键返回。${RESET} " ;; 96 | *) printf "%s\n" "${YELLOW}Invalid choice,skipped.已跳过,按回车键返回。${RESET} " ;; 97 | esac 98 | #tmoe_manager_main_menu 99 | } 100 | ################### 101 | -------------------------------------------------------------------------------- /share/environment/dependencies: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | gnu_linux_manager_dependencies() { 3 | DEPENDENCIES='' 4 | if [ ! $(command -v aria2c) ]; then 5 | case "${LINUX_DISTRO}" in 6 | gentoo) DEPENDENCIES="${DEPENDENCIES} net-misc/aria2" ;; 7 | *) DEPENDENCIES="${DEPENDENCIES} aria2" ;; 8 | esac 9 | fi 10 | 11 | if [ ! $(command -v curl) ]; then 12 | case "${LINUX_DISTRO}" in 13 | gentoo) DEPENDENCIES="${DEPENDENCIES} net-misc/curl" ;; 14 | *) DEPENDENCIES="${DEPENDENCIES} curl" ;; 15 | esac 16 | fi 17 | 18 | if [ ! $(command -v git) ]; then 19 | case "${LINUX_DISTRO}" in 20 | openwrt) DEPENDENCIES="${DEPENDENCIES} git git-http" ;; 21 | gentoo) DEPENDENCIES="${DEPENDENCIES} dev-vcs/git" ;; 22 | *) DEPENDENCIES="${DEPENDENCIES} git" ;; 23 | esac 24 | fi 25 | 26 | if [ ! $(command -v grep) ]; then 27 | case "${LINUX_DISTRO}" in 28 | gentoo) DEPENDENCIES="${DEPENDENCIES} sys-apps/grep" ;; 29 | *) DEPENDENCIES="${DEPENDENCIES} grep" ;; 30 | esac 31 | fi 32 | 33 | if [ ! $(command -v pv) ]; then 34 | case "${LINUX_DISTRO}" in 35 | gentoo) DEPENDENCIES="${DEPENDENCIES} sys-apps/pv" ;; 36 | redhat) 37 | case "${REDHAT_DISTRO}" in 38 | fedora) DEPENDENCIES="${DEPENDENCIES} pv" ;; 39 | esac 40 | ;; 41 | *) DEPENDENCIES="${DEPENDENCIES} pv" ;; 42 | esac 43 | fi 44 | 45 | if [ ! $(command -v proot) ]; then 46 | case "${LINUX_DISTRO}" in 47 | "debian") DEPENDENCIES="${DEPENDENCIES} proot" ;; 48 | esac 49 | fi 50 | ##################### 51 | if [ ! $(command -v xz) ]; then 52 | case "${LINUX_DISTRO}" in 53 | "debian") DEPENDENCIES="${DEPENDENCIES} xz-utils" ;; 54 | "gentoo") DEPENDENCIES="${DEPENDENCIES} app-arch/xz-utils" ;; 55 | *) DEPENDENCIES="${DEPENDENCIES} xz" ;; 56 | esac 57 | fi 58 | 59 | if [ ! $(command -v pkill) ]; then 60 | case "${LINUX_DISTRO}" in 61 | "gentoo") DEPENDENCIES="${DEPENDENCIES} sys-process/procps" ;; 62 | "openwrt") ;; 63 | *) DEPENDENCIES="${DEPENDENCIES} procps" ;; 64 | esac 65 | fi 66 | ##################### 67 | if [ ! $(command -v tar) ]; then 68 | case "${LINUX_DISTRO}" in 69 | gentoo) DEPENDENCIES="${DEPENDENCIES} app-arch/tar" ;; 70 | *) DEPENDENCIES="${DEPENDENCIES} tar" ;; 71 | esac 72 | fi 73 | [[ -z ${DEPENDENCIES} ]] || install_gnu_linux_manager_dependencies_02 74 | } 75 | ###################### 76 | install_gnu_linux_manager_dependencies_02() { 77 | notes_of_tmoe_package_installation 78 | case "${LINUX_DISTRO}" in 79 | debian) 80 | case ${DEBIAN_DISTRO} in 81 | deepin) ;; 82 | *) 83 | if ! grep -q '^deb.*mirrors' "/etc/apt/sources.list"; then 84 | MIRROR_LIST='false' 85 | fi 86 | ;; 87 | esac 88 | ${TMOE_UPDATE_COMMAND} 89 | ${TMOE_INSTALLATION_COMMAND} ${DEPENDENCIES} || ${TMOE_INSTALLATION_COMMAND} git wget curl whiptail aria2 xz-utils nano sudo less procps 90 | ;; 91 | alpine | openwrt | slackware) 92 | ${TMOE_UPDATE_COMMAND} 93 | ${TMOE_INSTALLATION_COMMAND} ${DEPENDENCIES} 94 | ;; 95 | arch | gentoo | suse | void) ${TMOE_INSTALLATION_COMMAND} ${DEPENDENCIES} ;; 96 | redhat) 97 | if [ $(command -v dnf) ]; then 98 | ${TMOE_INSTALLATION_COMMAND} ${DEPENDENCIES} 99 | else 100 | yum install -y --skip-broken ${DEPENDENCIES} 101 | fi 102 | ;; 103 | *) 104 | apt update 105 | ${TMOE_INSTALLATION_COMMAND} ${DEPENDENCIES} 106 | apt install -y ${DEPENDENCIES} || port install ${DEPENDENCIES} || guix package -i ${DEPENDENCIES} || pkg install ${DEPENDENCIES} || pkg_add ${DEPENDENCIES} || pkgutil -i ${DEPENDENCIES} || pacman -Syu ${DEPENDENCIES} 107 | ;; 108 | esac 109 | } 110 | ################# 111 | gnu_linux_manager_dependencies 112 | -------------------------------------------------------------------------------- /share/frequently_asked_questions/faq: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | vnc_can_not_call_pulse_audio() { 4 | printf "%s\n" "若您启动VNC后,发现无音频。首先请确保您的termux为最新版本,并安装了termux:api" 5 | printf "%s\n" "若您的宿主机为Android系统,且发现音频服务无法启动,请在启动完成后,新建一个termux session会话窗口,然后手动在termux原系统里输${GREEN}pulseaudio -D${RESET}来启动音频服务后台进程" 6 | printf "%s\n" "您亦可输${GREEN}pulseaudio --start${RESET}" 7 | printf "%s\n" "若您无法记住该命令,则只需输${GREEN}debian${RESET}" 8 | printf "%s\n" "按回车键自动启动音频服务" 9 | do_you_want_to_continue 10 | pulseaudio --start 11 | } 12 | ############### 13 | creat_start_linux_deploy_sh() { 14 | cd $PREFIX/bin 15 | printf "%s\n" "${CUT_TARGET}" 16 | cat >"${CUT_TARGET}" <<-'EndofFile' 17 | #!/usr/bin/env bash 18 | pulseaudio --start &>/dev/null 19 | printf "%s\n" "pulseaudio服务启动完成,将为您自动打开LinuxDeploy,请点击“启动”。" 20 | am start -n ru.meefik.linuxdeploy/ru.meefik.linuxdeploy.Launcher 21 | sleep 6 22 | am start -n com.realvnc.viewer.android/com.realvnc.viewer.android.app.ConnectionChooserActivity 23 | EndofFile 24 | } 25 | ############## 26 | linux_deploy_pulse_server() { 27 | printf "%s\n" "若您需要在Linux Deploy上配置VNC的音频转发功能,请使用本工具(Tmoe-linux tool)覆盖安装桌面环境" 28 | printf "%s\n" "您在安装Linux deploy的chroot容器前,可以将安装类型修改为目录,安装路径修改为/data/data/ru.meefik.linuxdeploy/linux" 29 | printf "%s\n" "脚本用法:ssh连接后,输入apt install -y curl;bash -c \"(curl -L ${TMOE_GIT_URL}/raw/2/2)\"" 30 | #printf "%s\n" "覆盖安装之后,您需要通过本工具进行VNC和音频服务的配置" 31 | printf "%s\n" "接下来您需要设定一个您独有的启动命令,例如startl" 32 | printf "%s\n" "您之后可以在termux里输入此命令来启动Linux Deploy以及音频服务" 33 | do_you_want_to_continue 34 | TARGET=$(whiptail --inputbox "请自定义启动命令名称\n Please enter the command name." 12 50 --title "COMMAND" 3>&1 1>&2 2>&3) 35 | CUT_TARGET="$(printf '%s\n' "${TARGET}" | head -n 1 | cut -d ' ' -f 1)" 36 | if [ -z "${CUT_TARGET}" ]; then 37 | printf "%s\n" "命令名称不能为空!!!" 38 | else 39 | creat_start_linux_deploy_sh 40 | fi 41 | if [ ! -z ${CUT_TARGET} ]; then 42 | chmod +x ${CUT_TARGET} 43 | ls -lh ${PREFIX}/bin/${CUT_TARGET} 44 | printf "%s\n" "Congratulations!配置成功,您之后可以输${CUT_TARGET}来启动" 45 | else 46 | printf "%s\n" "检测到您取消了操作" 47 | fi 48 | } 49 | ########################## 50 | manager_frequently_asked_questions() { 51 | RETURN_TO_WHERE=manager_frequently_asked_questions 52 | # 15 60 5 53 | TMOE_FAQ=$(whiptail --title "FAQ(よくある質問)" --menu \ 54 | "您有哪些疑问?\nWhat questions do you have?" 0 50 0 \ 55 | "1" "About auto conf(关于自动配置)" \ 56 | "2" "VNC无法调用音频" \ 57 | "3" "给Linux Deploy配置VNC音频" \ 58 | "0" "🌚 Back to the main menu 返回主菜单" \ 59 | 3>&1 1>&2 2>&3) 60 | ############################## 61 | case "${TMOE_FAQ}" in 62 | 0 | "") tmoe_manager_main_menu ;; 63 | 1) questions_about_tmoe_automatic_configuration ;; 64 | 2) vnc_can_not_call_pulse_audio ;; 65 | 3) linux_deploy_pulse_server ;; 66 | esac 67 | ############# 68 | press_enter_to_return 69 | manager_frequently_asked_questions 70 | } 71 | ########################### 72 | questions_about_tmoe_automatic_configuration() { 73 | cat <<-ENDOFFAQ 74 | Q:${YELLOW}为什么会自动修改termux的配色、字体和小键盘布局${RESET} 75 | Why the color, font and keyboard layout of termux will be automatically modified during installation. 76 | 77 | A:只有当${HOME}/.termux目录下的colors.properties、font.ttf和termux.properties${RED}不存在时${RESET}才会自动配置哦! 78 | Only when the relevant file in the ~/.termux directory does not exist will it be automatically configured. 79 | 80 | 早期会强制更换字体,并自动备份,现在只有当字体不存在时才会自动配置。 81 | 有人跟我反馈说字体显示异常。 82 | 这是因为仅部分字体支持zsh的powerlevel 10k主题的特殊字符。 83 | 84 | 而配色和键盘一直以来都是只有当文件不存在时,才会自动配置。 85 | 86 | 由于本工具严重依赖方向键和回车键,因此修改默认布局稍微有点必要呢! 87 | 您只需要执行${GREEN}rm ${HOME}/.termux/termux.properties${RESET}即可删除配置并还原回默认布局。 88 | You can type ${GREEN}rm ~/.termux/termux.properties${RESET} to delete it and restore to default. 89 | ----------------------- 90 | Q:${YELLOW}为什么每次会自动加载EULA?${RESET} 91 | 92 | A:添加许可协议是为了避免不必要的麻烦。 93 | 作为一个开源项目,您可以随时审查其中的代码,而不必过多担心恶意代码。 94 | ----------------------- 95 | Q:${YELLOW}为什么安装时会自动显示git仓库的链接?${RESET} 96 | 97 | A:因为开源项目花了开发者很长的时间,希望大家能尊重原开发者。 98 | 换位思考一下:假如你辛辛苦苦录制的视频被别人盗了,没有人知道那个视频真正的原作者是谁,而你的努力最终只能付诸于东流。 99 | 听说尊重他人的劳动成果,会让世界变得更加美好呢!φ(≧ω≦*)♪ 100 | 注:若您需要演示tmoe-linux或分享相关教程,则无需注明git链接。 101 | ----------------------- 102 | ENDOFFAQ 103 | } 104 | ########################### 105 | manager_frequently_asked_questions $@ 106 | -------------------------------------------------------------------------------- /share/removal/menu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ############### 3 | remove_termux_linux_manager() { 4 | cd ${PREFIX}/bin 5 | DEPENDENCIES='git aria2 pv wget xz newt whiptail dialog' 6 | cat <<-EOF 7 | ${RED}rm -rv ${PREFIX}/bin/debian-i ${HOME}/.config/tmoe-linux${RESET} 8 | ${RED}WARNING!${RESET}删除${HOME}/.config/tmoe-linux文件夹将导致chroot容器无法正常移除,建议您在移除完容器后再来删除配置文件目录。 9 | ${TMOE_CONTAINER_DIR}为容器数据路径,您需要在容器管理菜单中进行单独卸载。 10 | ${RED}${TMOE_REMOVAL_COMMAND} ${DEPENDENCIES}${RESET} 11 | EOF 12 | do_you_want_to_continue 13 | rm -rv debian-i 14 | ${TMOE_REMOVAL_COMMAND} ${DEPENDENCIES} 15 | exit 1 16 | } 17 | ############ 18 | tmoe_linux_remove_menu() { 19 | RETURN_TO_WHERE='tmoe_linux_remove_menu' 20 | tmoe_linux_remove_menu_en() { 21 | OPTION=$(whiptail --title "Removable items" --menu "Which item do you want to remove?" 0 50 0 \ 22 | "0" "🌚 Back to the main menu" \ 23 | "1" "Container (old version before v1.10 beta)" \ 24 | "2" "Tmoe-linux manager" \ 25 | 3>&1 1>&2 2>&3) 26 | } 27 | tmoe_linux_remove_menu_zh() { 28 | OPTION=$(whiptail --title "Removable items" --menu "您想要移除哪个项目?\nWhich item do you want to remove?" 0 50 0 \ 29 | "0" "🌚 Back to the main menu 返回主菜单" \ 30 | "1" "Container (仅限v1.10 beta之前的旧版)容器" \ 31 | "2" "Tmoe-linux manager" \ 32 | 3>&1 1>&2 2>&3) 33 | } 34 | case ${TMOE_MENU_LANG} in 35 | zh_*UTF-8) tmoe_linux_remove_menu_zh ;; 36 | *) tmoe_linux_remove_menu_en ;; 37 | esac 38 | ############################## 39 | case "${OPTION}" in 40 | 0 | "") tmoe_manager_main_menu ;; 41 | 1) 42 | check_tmoe_container_chroot 43 | source ${TMOE_SHARE_DIR}/deprecated/remove 44 | remove_old_version_gnu_linux_container 45 | ;; 46 | 2) remove_termux_linux_manager ;; 47 | esac 48 | ########## 49 | press_enter_to_return 50 | tmoe_linux_remove_menu 51 | } 52 | ########## 53 | tmoe_linux_remove_menu $@ 54 | -------------------------------------------------------------------------------- /share/removal/umount: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | unmount_chroot_proc_dev() { 4 | #case ${TMOE_CHROOT} in 5 | #true) 6 | if [ $(command -v su) ]; then 7 | for i in proc sys dev/pts dev/shm etc/gitstatus dev/fd dev/stdin dev/stout dev/sterr dev/tty0 dev media/tf media/termux media/sd; do 8 | #su -c "umount -lvf ${DEBIAN_CHROOT}/${i} 2>/dev/null" 9 | if [[ $(su -c "ls ${DEBIAN_CHROOT}/${i} 2>/dev/null") ]]; then 10 | printf "${PURPLE}%s ${BLUE}%s${RESET} %s\n" "Unmounting" "${i}" "..." 11 | printf "${GREEN}%s${RESET}\n" "umount -lvf ${DEBIAN_CHROOT}/${i}" 12 | fi 13 | su -c "umount -lvf ${DEBIAN_CHROOT}/${i} 2>/dev/null" 14 | done 15 | #su -c "umount -lvf ${DEBIAN_CHROOT}/* 2>/dev/null" 16 | #su -c "umount -lvf ${DEBIAN_CHROOT}/*/* 2>/dev/null" 17 | printf "${PURPLE}%s ${BLUE}%s${RESET} %s\n" "Unmounting" "${DEBIAN_FOLDER}" "..." 18 | if grep -q "${DEBIAN_CHROOT}" /proc/mounts; then 19 | #[[ ! -e ${TMPDIR}/.umount-tmoe-container ]] || rm -vf ${TMPDIR}/.umount-tmoe-container 20 | # sed 's@^@su -c "umount -lvf @g;s@$@"@g' 21 | UMOUNT_EXTRA_DIR=$(${TMOE_PREFIX} sed -n p /proc/mounts | grep ${DEBIAN_CHROOT} | awk '{print $2}' | sed 's@^@umount -lvf @g') 22 | printf "${GREEN}${UMOUNT_EXTRA_DIR}${RESET}\n" 23 | su -c "${UMOUNT_EXTRA_DIR}" 24 | fi 25 | su -c "umount -lvf ${DEBIAN_CHROOT} 2>/dev/null" 26 | printf "${BOLD}%s\n" "${YELLOW}CONGRATULATIONS!${BLUE}TMOE-LINUX-MANAGER${RESET}已经${PURPLE}UNMOUNTED${RESET}掉所有的挂载点" 27 | su -c "ls -lAh ${DEBIAN_CHROOT}/media/sd 2>/dev/null" 28 | fi 29 | # ;; 30 | #esac 31 | #/dev内自带null 32 | for i in media/sd media/tf proc sys; do 33 | if [[ $(su -c "ls ${DEBIAN_CHROOT}/${i} 2>/dev/null") ]]; then 34 | printf "%s\n" "检测到${DEBIAN_CHROOT}/${i}目录不为空,为防止该目录被清空,无法继续执行操作!" 35 | press_enter_to_return 36 | #${RETURN_TO_WHERE} 37 | #回到主菜单,而不是返回之前的菜单 38 | tmoe_manager_main_menu 39 | fi 40 | done 41 | unset i 42 | 43 | if [ "$(ls ${DEBIAN_CHROOT}/proc 2>/dev/null)" ]; then 44 | printf "%s\n" "Please restart the device to unmount the ${DEBIAN_CHROOT}/${i} directory." 45 | press_enter_to_return 46 | #${RETURN_TO_WHERE} 47 | #回到主菜单,而不是返回之前的菜单 48 | tmoe_manager_main_menu 49 | fi 50 | } 51 | ########################## 52 | unmount_chroot_proc_dev 53 | -------------------------------------------------------------------------------- /share/termux/backup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | backup_filename() { 4 | TARGET_BACKUP_FILE_NAME=$(whiptail --inputbox "请自定义备份的文件名称\nPlease type the filename." 9 50 --title "FILENAME" 3>&1 1>&2 2>&3) 5 | TARGET_BACKUP_FILE_NAME=$(printf "%s\n" "${TARGET_BACKUP_FILE_NAME}" | head -n 1 | cut -d ' ' -f 1) 6 | printf '%s\n' "${TARGET_BACKUP_FILE_NAME}" 7 | if [ -z ${TARGET_BACKUP_FILE_NAME} ]; then 8 | printf "%s\n" "文件名称不能为空!" 9 | press_enter_to_return 10 | backup_termux_system 11 | fi 12 | } 13 | ###################### 14 | backup_termux_system() { 15 | source ${TMOE_SHARE_DIR}/removal/umount 16 | RETURN_TO_WHERE='backup_termux_system' 17 | OPTION=$(whiptail --title "Backup System" --menu "Choose your option" 0 50 0 \ 18 | "0" "🌚 Back 返回" \ 19 | "1" "备份Termux" \ 20 | "2" "使用Timeshift备份宿主机系统" \ 21 | 3>&1 1>&2 2>&3) 22 | ######################################### 23 | case "${OPTION}" in 24 | 0 | "") android_termux_tmoe_menu ;; 25 | 1) backup_termux ;; 26 | 2) install_timeshift ;; 27 | esac 28 | #################### 29 | press_enter_to_return 30 | backup_termux_system 31 | } 32 | #################### 33 | install_timeshift() { 34 | if [ "${LINUX_DISTRO}" = "Android" ]; then 35 | printf "%s\n" 'Sorry,本功能不支持Android系统' 36 | press_enter_to_return 37 | tmoe_manager_main_menu 38 | fi 39 | if [ ! -e "/usr/bin/timeshift" ]; then 40 | case "${LINUX_DISTRO}" in 41 | "debian") 42 | apt update 43 | apt install -y timeshift 44 | ;; 45 | "arch") pacman -Syu --noconfirm timeshift ;; 46 | "redhat") dnf install timeshift ;; 47 | *) ${TMOE_INSTALLATION_COMMAND} timeshift ;; 48 | esac 49 | fi 50 | 51 | if [ -e "/usr/bin/timeshift" ]; then 52 | timeshift-launcher & 53 | printf "%s\n" "安装完成,如需卸载,请手动输${TMOE_REMOVAL_COMMAND} timeshift" 54 | fi 55 | } 56 | ###################### 57 | termux_backup_pre() { 58 | if [ ! -d /sdcard/Download/backup ]; then 59 | mkdir -p /sdcard/Download/backup 60 | fi 61 | cd /sdcard/Download/backup 62 | backup_filename 63 | BACKUP_TIME=$(date +%Y-%m-%d_%H-%M) 64 | } 65 | #################### 66 | backup_termux() { 67 | #15 60 4 68 | backup_termux_menu_en() { 69 | TERMUX_BACKUP=$(whiptail --title "multiple choices" --checklist \ 70 | "Which directory do you want to backup? \nPress space key to select and press Enter to confirm." 0 0 0 \ 71 | "home" "Termux Home dir, mainly used to save user files" ON \ 72 | "usr" "Save software,commands,and other things" OFF \ 73 | 3>&1 1>&2 2>&3) 74 | } 75 | backup_termux_menu_cn() { 76 | TERMUX_BACKUP=$(whiptail --title "多项选择题" --checklist \ 77 | "您想要备份哪个目录?按空格键选择,*为选中状态,回车键确认。" 0 0 0 \ 78 | "home" "Termux主目录,主要用来保存用户文件" ON \ 79 | "usr" "保存软件、命令和其它东西" OFF \ 80 | 3>&1 1>&2 2>&3) 81 | } 82 | case ${TMOE_MENU_LANG} in 83 | zh_*UTF-8) backup_termux_menu_cn ;; 84 | *) backup_termux_menu_en ;; 85 | esac 86 | case ${TERMUX_BACKUP} in 87 | "") backup_termux_system ;; 88 | home) TERMUX_BACKUP_DIR="${HOME}" ;; 89 | usr) TERMUX_BACKUP_DIR="${PREFIX}" ;; 90 | *) TERMUX_BACKUP_DIR="${HOME} ${PREFIX}" ;; 91 | esac 92 | printf "%s\n" "${TERMUX_BACKUP}" 93 | ######################## 94 | termux_backup_pre 95 | TERMUX_TAR_FILE_NAME="${TARGET_BACKUP_FILE_NAME}_${BACKUP_TIME}-termux_bak" 96 | if (whiptail --title "Select compression type 选择压缩类型 " --yes-button "tar.xz" --no-button "tar.gz" --yesno "Which do yo like better? \n tar.xz压缩率高,但速度慢。tar.xz has a higher compression ration, but is slower.\n tar.gz速度快,但压缩率低。tar.gz compresses faster, but with a lower compression ratio.\n 压缩过程中,进度条倒着跑是正常现象。" 10 60); then 97 | cat <<-EOF 98 | 您选择了tar.gz,即将为您备份至/sdcard/Download/backup/${TERMUX_TAR_FILE_NAME}.tar.gz 99 | 以下目录将被备份: 100 | ${BLUE}${TERMUX_BACKUP_DIR} 101 | ${YELLOW}按回车键开始备份,press Enter to start the backup.${RESET} 102 | EOF 103 | do_you_want_to_continue 104 | tar -PJpvcf ${TERMUX_TAR_FILE_NAME}.tar.xz --exclude=${TMOE_SHARE_DIR}/containers ${TERMUX_BACKUP_DIR} 105 | #xz -z -T0 -e -9 -v ${TERMUX_TAR_FILE_NAME}.tar 106 | #${DEBIAN_CHROOT}/root/sd --exclude=${DEBIAN_CHROOT}/root/termux --exclude=${DEBIAN_CHROOT}/root/tf 107 | printf "%s\n" "Don't worry too much, it is normal for some directories to backup without permission." 108 | printf "%s\n" "部分目录无权限备份是正常现象。" 109 | pwd 110 | ls -lth ./*termux_home*tar* | grep ^- | head -n 1 111 | printf "%s ${GREEN}%s${RESET}\n" Backup complete. 112 | else 113 | cat <<-EOF 114 | 您选择了tar.gz,即将为您备份至/sdcard/Download/backup/${TERMUX_TAR_FILE_NAME}.tar.gz 115 | 以下目录将被备份: 116 | ${BLUE}${TERMUX_BACKUP_DIR} 117 | ${YELLOW}按回车键开始备份,press Enter to start the backup.${RESET} 118 | EOF 119 | do_you_want_to_continue 120 | 121 | tar -Ppvczf ${TERMUX_TAR_FILE_NAME}.tar.gz --exclude=${TMOE_SHARE_DIR}/containers ${TERMUX_BACKUP_DIR} 122 | 123 | printf "%s\n" "Don't worry too much, it is normal for some directories to backup without permission." 124 | printf "%s\n" "部分目录无权限备份是正常现象。" 125 | pwd 126 | ls -lth ./*termux_bak*tar* | grep ^- | head -n 1 127 | printf "%s ${GREEN}%s${RESET}\n" Backup complete. 128 | fi 129 | } 130 | ################################## 131 | backup_termux_system 132 | -------------------------------------------------------------------------------- /share/termux/menu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | android_termux_tmoe_menu() { 4 | RETURN_TO_MENU='android_termux_tmoe_menu' 5 | RETURN_TO_WHERE='android_termux_tmoe_menu' 6 | #17 60 6 7 | android_termux_tmoe_menu_zh() { 8 | OPTION=$(whiptail --title "Termux" --menu "您可以通过VNC客户端来连接GNU/Linux(proot/chroot)容器的桌面,\n并在此处修改termux音频服务端的配置\nYou can use vncviewer to connect container DE." 0 50 0 \ 9 | "1" "🍳 mirror sources镜像源(北外,腾讯)" \ 10 | "2" "🍹 backup 备份termux" \ 11 | "3" "🔯 restore 还原/恢复termux" \ 12 | "4" "🎶 configure Termux LAN audio局域网音频传输" \ 13 | "5" "🍅 query space occupation查询空间占用" \ 14 | "6" "🍑 vnc/xsdl.apk下载远程桌面客户端" \ 15 | "7" "🤖 termux_fdroid.apk下载termux" \ 16 | "8" "📺 termux original GUI:原系统GUI" \ 17 | "0" "🌚 Back to the main menu 返回主菜单" \ 18 | 3>&1 1>&2 2>&3) 19 | } 20 | android_termux_tmoe_menu_ja() { 21 | OPTION=$(whiptail --title "Termux" --menu "You can use vncviewer to connect container DE." 0 50 0 \ 22 | "1" "🍳 mirror sources" \ 23 | "2" "🍹 バックアップ termux" \ 24 | "3" "🔯 復元 termux" \ 25 | "4" "🎶 LANオーディオ送信を設定する" \ 26 | "5" "🍅 クエリスペースの占有" \ 27 | "6" "🍑 vnc.apkをダウンロード" \ 28 | "7" "🤖 termux_fdroid.apkをダウンロード" \ 29 | "8" "📺 termux オリジナルのGUI" \ 30 | "0" "🌚 戻る" \ 31 | 3>&1 1>&2 2>&3) 32 | } 33 | android_termux_tmoe_menu_en() { 34 | OPTION=$(whiptail --title "Termux" --menu "You can use vncviewer to connect container DE." 0 50 0 \ 35 | "1" "🍳 mirror sources" \ 36 | "2" "🍹 backup termux" \ 37 | "3" "🔯 restore termux" \ 38 | "4" "🎶 configure Termux LAN audio" \ 39 | "5" "🍅 query space occupation" \ 40 | "6" "🍑 vnc/xsdl.apk" \ 41 | "7" "🤖 termux_fdroid.apk" \ 42 | "8" "📺 termux original GUI" \ 43 | "0" "🌚 Back to the main menu" \ 44 | 3>&1 1>&2 2>&3) 45 | } 46 | ######################################## 47 | case ${TMOE_MENU_LANG} in 48 | zh_*UTF-8) android_termux_tmoe_menu_zh ;; 49 | ja_JP.UTF-8) android_termux_tmoe_menu_ja ;; 50 | *) android_termux_tmoe_menu_en ;; 51 | esac 52 | 53 | case "${OPTION}" in 54 | 0 | "") tmoe_manager_main_menu ;; 55 | 1) tmoe_switch_sources_list ;; 56 | 2) backup_termux_menu ;; 57 | 3) restore_termux_menu ;; 58 | 4) termux_pulse_audio_lan ;; 59 | 5) space_occupation ;; 60 | 6) download_vnc_apk ;; 61 | 7) aria2_download_termux_apk ;; 62 | 8) termux_original_system_gui ;; 63 | esac 64 | #################################### 65 | # "8" "Video tutorial(2020-02,旧版教程)" \ 8) download_video_tutorial ;; 66 | press_enter_to_return 67 | android_termux_tmoe_menu 68 | } 69 | ################# 70 | tmoe_switch_sources_list() { 71 | source ${TMOE_SHARE_DIR}/termux/mirror 72 | } 73 | backup_termux_menu() { 74 | TMOE_CHROOT='false' 75 | source ${TMOE_SHARE_DIR}/termux/backup 76 | } 77 | restore_termux_menu() { 78 | TMOE_CHROOT='false' 79 | source ${TMOE_SHARE_DIR}/termux/restore 80 | } 81 | space_occupation() { 82 | source ${TMOE_SHARE_DIR}/termux/space_occupation 83 | } 84 | download_vnc_apk() { 85 | source ${TMOE_SHARE_DIR}/app/vnc 86 | } 87 | aria2_download_termux_apk() { 88 | source ${TMOE_SHARE_DIR}/app/termux 89 | } 90 | start_vscode() { 91 | source ${TMOE_SHARE_DIR}/app/code-server 92 | } 93 | download_video_tutorial() { 94 | source ${TMOE_SHARE_DIR}/termux/video_tutorial 95 | } 96 | termux_original_system_gui() { 97 | source ${TMOE_SHARE_DIR}/termux/xfce 98 | } 99 | ################## 100 | termux_pulse_audio_lan() { 101 | if [ "${LINUX_DISTRO}" = 'Android' ]; then 102 | cd $PREFIX/etc/pulse 103 | else 104 | cd /etc/pulse 105 | fi 106 | if grep -q '192.168.0.0/16' default.pa; then 107 | LANPULSE='检测到您已启用局域网音频传输,you have enabled LAN audio transmission' 108 | else 109 | LANPULSE='检测到您未启用局域网音频传输,默认仅允许本机传输,you have disabled LAN audio transmission' 110 | fi 111 | #10 50 112 | if (whiptail --title "请问您是需要启用还是禁用此功能呢?(。・∀・)ノ゙" --yes-button 'yes(* ̄▽ ̄*)o' --no-button 'no(っ °Д °)' --yesno "${LANPULSE},请选择您需要执行的操作!\nDo you want to enable LAN audio transmission?" 11 50); then 113 | sed -i '/auth-ip-acl/d' default.pa 114 | sed -i '/module-native-protocol-tcp/d' default.pa 115 | sed -i '$ a\load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/16;172.16.0.0/12 auth-anonymous=1' default.pa 116 | else 117 | sed -i '/auth-ip-acl/d' default.pa 118 | sed -i '/module-native-protocol-tcp/d' default.pa 119 | sed -i '$ a\load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1' default.pa 120 | fi 121 | printf "%s\n" "修改完成!( ̄▽ ̄)" 122 | printf "%s\n" "如需单独启动音频服务,请输pulseaudio --start" 123 | printf "%s\n" "若无声音,则您需要安装termux:api的apk,并升级termux至最新版本" 124 | press_enter_to_return 125 | android_termux_tmoe_menu 126 | } 127 | ##################################### 128 | android_termux_tmoe_menu $@ 129 | -------------------------------------------------------------------------------- /share/termux/restore: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | TMOE_PREFIX='' 4 | source ${TMOE_SHARE_DIR}/compression/restore 5 | if (whiptail --title "RESTORE FILE" --yes-button '最新latest' --no-button 'select manually' --yesno "您是想要还原最新文件,还是手动选择备份文件\nDo you want to restore the latest file or select the file manually?" 9 50); then 6 | #RESTORE=$(ls -lth ./termux*tar* | grep ^- | head -n 1 | cut -d '/' -f 2) 7 | cd /sdcard/Download/backup 8 | RESTORE=$(ls -lth ./*-termux*_bak.tar* | grep ^- | head -n 1 | awk -F ' ' '$0=$NF') 9 | restore_the_latest_backup_file 10 | else 11 | BACKUP_FILE_NAME="*-termux*_bak.tar*" 12 | where_is_start_dir 13 | fi 14 | -------------------------------------------------------------------------------- /share/termux/space_occupation: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | space_occupation_menu() { 4 | cd ${HOME}/.. 5 | #15 60 4 6 | OPTION=$(whiptail --title "Query space occupation ranking" --menu "查询空间占用排行" 0 0 0 \ 7 | "0" "🌚 Back返回" \ 8 | "1" "termux各目录" \ 9 | "2" "termux文件" \ 10 | "3" "sdcard" \ 11 | "4" "总存储空间用量Disk usage" \ 12 | 3>&1 1>&2 2>&3) 13 | ########################################################################### 14 | case ${OPTION} in 15 | 0 | "") ${RETURN_TO_MENU} ;; 16 | 1) 17 | printf '%s\n' '正在加载中,可能需要几秒钟时间,加载时间取决于文件数量和闪存读写速度。' 18 | printf '%s\n' 'Loading may take several seconds, depending on the number of files and the UFS or emmc flash read and write speed.' 19 | printf "%s\n" "${YELLOW}主目录 TOP15${RESET}" 20 | du -hsx ./home/* ./home/.* 2>/dev/null | sort -rh | head -n 15 21 | printf '%s\n' '-------------------' 22 | printf "%s\n" "${YELLOW}usr 目录 TOP6${RESET}" 23 | du -hsx ./usr/* 2>/dev/null | sort -rh | head -n 6 24 | printf '%s\n' '-------------------' 25 | printf "%s\n" "${YELLOW}usr/lib 目录 TOP8${RESET}" 26 | du -hsx ./usr/lib/* 2>/dev/null | sort -rh | head -n 8 27 | printf '%s\n' '-------------------' 28 | printf "%s\n" "${YELLOW}usr/share 目录 TOP8${RESET}" 29 | du -hsx ./usr/share/* 2>/dev/null | sort -rh | head -n 8 30 | printf '%s\n' '-------------------' 31 | ;; 32 | 2) 33 | printf '%s\n' '正在加载中,可能需要几秒钟时间,加载时间取决于文件数量和闪存读写速度。' 34 | printf '%s\n' 'Loading may take several seconds, depending on the number of files and the UFS or emmc flash read and write speed.' 35 | printf "%s\n" "${YELLOW}termux 文件大小排行榜(30名)${RESET}" 36 | find ./ -type f -print0 2>/dev/null | 37 | xargs -0 du 2>/dev/null | 38 | sort -n | 39 | tail -30 | 40 | cut -f2 | 41 | xargs -I{} du -sh {} 2>/dev/null 42 | ;; 43 | 3) 44 | cd /sdcard 45 | printf '%s\n' '正在加载中,可能需要几秒钟时间,加载时间取决于文件数量和闪存读写速度。' 46 | printf '%s\n' 'Loading may take several seconds, depending on the number of files and the UFS or emmc flash read and write speed.' 47 | printf "%s\n" "${YELLOW}sdcard 目录 TOP15${RESET}" 48 | du -hsx ./* ./.* 2>/dev/null | sort -rh | head -n 15 49 | printf "%s\n" "${YELLOW}sdcard文件大小排行榜(30名)${RESET}" 50 | find ./ -type f -print0 2>/dev/null | 51 | xargs -0 du 2>/dev/null | 52 | sort -n | 53 | tail -30 | 54 | cut -f2 | 55 | xargs -I{} du -sh {} 2>/dev/null 56 | ;; 57 | 4) 58 | printf "%s\n" "${YELLOW}Disk usage${RESET}" 59 | df -h | grep G | grep -v tmpfs 60 | press_enter_to_return 61 | space_occupation_menu 62 | ;; 63 | esac 64 | ##################################### 65 | press_enter_to_return 66 | space_occupation_menu 67 | } 68 | ######################################################################## 69 | space_occupation_menu $@ 70 | -------------------------------------------------------------------------------- /share/termux/termux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ########### 3 | termux_tuna_sources_list() { 4 | #if ! grep -q '^deb.*edu.cn.*termux-packages-24' 5 | if ! grep -q '^deb.*bfsu.*termux-packages-24' '/data/data/com.termux/files/usr/etc/apt/sources.list'; then 6 | sed -i 's@^\(deb.*stable main\)$@#\1\ndeb https://mirrors.bfsu.edu.cn/termux/termux-packages-24 stable main@' /data/data/com.termux/files/usr/etc/apt/sources.list 7 | if ! grep -q '^deb' '/data/data/com.termux/files/usr/etc/apt/sources.list'; then 8 | printf "%s\n" 'deb https://mirrors.bfsu.edu.cn/termux/termux-packages-24 stable main' >>/data/data/com.termux/files/usr/etc/apt/sources.list 9 | fi 10 | fi 11 | 12 | if [ -e "/data/data/com.termux/files/usr/etc/apt/sources.list.d/game.list" ]; then 13 | if ! grep -q '^deb.*bfsu' '/data/data/com.termux/files/usr/etc/apt/sources.list.d/game.list'; then 14 | sed -i 's@^\(deb.*games stable\)$@#\1\ndeb https://mirrors.bfsu.edu.cn/termux/game-packages-24 games stable@' /data/data/com.termux/files/usr/etc/apt/sources.list.d/game.list 15 | fi 16 | fi 17 | 18 | if [ -e "/data/data/com.termux/files/usr/etc/apt/sources.list.d/science.list" ]; then 19 | if ! grep -q '^deb.*bfsu' '/data/data/com.termux/files/usr/etc/apt/sources.list.d/science.list'; then 20 | sed -i 's@^\(deb.*science stable\)$@#\1\ndeb https://mirrors.bfsu.edu.cn/termux/science-packages-24 science stable@' /data/data/com.termux/files/usr/etc/apt/sources.list.d/science.list 21 | fi 22 | fi 23 | if [ -e "/data/data/com.termux/files/usr/etc/apt/sources.list.d/x11.list" ]; then 24 | if ! grep -q '^deb.*bfsu' '/data/data/com.termux/files/usr/etc/apt/sources.list.d/x11.list'; then 25 | sed -i 's@^\(deb.*x11 main\)$@#\1\ndeb https://mirrors.bfsu.edu.cn/termux/x11-packages x11 main@' /data/data/com.termux/files/usr/etc/apt/sources.list.d/x11.list 26 | fi 27 | fi 28 | 29 | if [ -e "/data/data/com.termux/files/usr/etc/apt/sources.list.d/unstable.list" ]; then 30 | if ! grep -q '^deb.*bfsu' '/data/data/com.termux/files/usr/etc/apt/sources.list.d/unstable.list'; then 31 | sed -i 's@^\(deb.*unstable main\)$@#\1\ndeb https://mirrors.bfsu.edu.cn/termux/unstable-packages unstable main@' /data/data/com.termux/files/usr/etc/apt/sources.list.d/unstable.list 32 | fi 33 | fi 34 | 35 | if [ -e "/data/data/com.termux/files/usr/etc/apt/sources.list.d/root.list" ]; then 36 | if ! grep -q '^deb.*bfsu' '/data/data/com.termux/files/usr/etc/apt/sources.list.d/root.list'; then 37 | sed -i 's@^\(deb.*root stable\)$@#\1\ndeb https://mirrors.bfsu.edu.cn/termux/termux-root-packages-24 root stable@' /data/data/com.termux/files/usr/etc/apt/sources.list.d/root.list 38 | fi 39 | fi 40 | apt_dist_upgrade 41 | press_enter_to_return 42 | android_termux 43 | #此处要返回依赖检测处! 44 | } 45 | ############# 46 | #此函数重复出现两次,另一次位于mirror 47 | apt_dist_upgrade() { 48 | apt update 49 | apt dist-upgrade -y 50 | printf '%s\n' '修改完成,您当前的软件源列表如下所示。' 51 | sed -n p /data/data/com.termux/files/usr/etc/apt/sources.list 52 | sed -n p /data/data/com.termux/files/usr/etc/apt/sources.list.d/* 53 | printf "%s\n" "您可以输${YELLOW}apt edit-sources${RESET}来手动编辑main源" 54 | printf "%s\n" "您也可以输${YELLOW}cd ${PREFIX}/etc/apt/sources.list.d ; nano ./* ${RESET}来手动编辑其它源" 55 | } 56 | ###################### 57 | switch_android_termux_mirror_to_bfsu() { 58 | if (("${ANDROID_VERSION}" >= '7')); then 59 | if ! grep -q '^deb.*edu.cn.*termux-packages-24' '/data/data/com.termux/files/usr/etc/apt/sources.list'; then 60 | printf "%s\n" "${YELLOW}检测到您当前使用的sources.list不是北外源,是否需要更换为北外源[Y/n]${RESET} " 61 | printf "%s\n" "更换后可以加快国内的下载速度,${YELLOW}按回车键确认,输n拒绝。${RESET}" 62 | printf "%s\n" "If you are not living in the People's Republic of China, then please type ${YELLOW}n${RESET} .${PURPLE}[Y/n]${RESET}" 63 | read opt 64 | case $opt in 65 | y* | Y* | "") 66 | termux_tuna_sources_list 67 | ;; 68 | n* | N*) printf "%s\n" "skipped." ;; 69 | *) printf "%s\n" "Invalid choice. skipped." ;; 70 | esac 71 | fi 72 | else 73 | android_6_mirror 74 | fi 75 | } 76 | ################ 77 | android_termux() { 78 | DEPENDENCIES="" 79 | for i in curl git pv grep pulseaudio proot tar; do 80 | if [ ! -e "${PREFIX}/bin/${i}" ]; then 81 | DEPENDENCIES="${DEPENDENCIES} ${i}" 82 | fi 83 | done 84 | 85 | for i in termux-audio-info aria2c xz termux-setup-storage whiptail pkill which; do 86 | if [ ! -e "${PREFIX}/bin/${i}" ]; then 87 | case ${i} in 88 | termux-audio-info) DEPENDENCIES="${DEPENDENCIES} termux-api" ;; 89 | xz) DEPENDENCIES="${DEPENDENCIES} xz-utils" ;; 90 | aria2c) DEPENDENCIES="${DEPENDENCIES} aria2" ;; 91 | termux-setup-storage) DEPENDENCIES="${DEPENDENCIES} termux-tools" ;; 92 | whiptail) DEPENDENCIES="${DEPENDENCIES} dialog" ;; 93 | pkill) DEPENDENCIES="${DEPENDENCIES} procps" ;; 94 | which) DEPENDENCIES="${DEPENDENCIES} debianutils" ;; 95 | esac 96 | fi 97 | done 98 | 99 | if [ ! -z "${DEPENDENCIES}" ]; then 100 | case ${TMOE_LANG} in 101 | zh_*UTF-8) switch_android_termux_mirror_to_bfsu ;; 102 | *) ;; 103 | esac 104 | notes_of_tmoe_package_installation 105 | apt update 106 | apt install -y ${DEPENDENCIES} 107 | case ${TERMUX_STORAGE} in 108 | false) termux-setup-storage ;; 109 | esac 110 | fi 111 | 112 | PULSE_AUDIO_PA="${PREFIX}/etc/pulse/default.pa" 113 | PULSE_AUDIO_CONF="${PREFIX}/etc/pulse/daemon.conf" 114 | 115 | if ! grep -q 'anonymous=1' ${PULSE_AUDIO_PA}; then 116 | sed -i '/auth-ip-acl/d;/module-native-protocol-tcp/d;$a\load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1' ${PULSE_AUDIO_PA} 117 | #sed -i '/module-native-protocol-tcp/d' ${PULSE_AUDIO_PA} 118 | #grep -q "anonymous" ${PULSE_AUDIO_PA} 119 | #printf "%s\n" "load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" >>${PULSE_AUDIO_PA} 120 | fi 121 | #auth-ip-acl=127.0.0.1;192.168.0.0/16时允许局域网内其它设备连接。 122 | #auth-ip-acl不能是localhost,可以是127.0.0.1或0.0.0.0 123 | if ! grep -q "exit-idle-time = -1" ${PULSE_AUDIO_CONF}; then 124 | sed -i '/exit-idle/d;$ a\exit-idle-time = -1' ${PULSE_AUDIO_CONF} 125 | #printf "%s\n" "exit-idle-time = -1" >>${PULSE_AUDIO_CONF} 126 | fi 127 | #exit-idle-time 可设为180 128 | #已废弃 129 | } 130 | ######### 131 | android_6_mirror() { 132 | printf "%s\n" "Android :${ANDROID_VERSION}" 133 | printf "%s\n" "${RED}WARNING!${RESET}检测到您的系统版本低于Android 7,建议您${YELLOW}更新Android系统${RESET}版本和termux版本。" 134 | printf "%s\n" "Your current Android system version is lower than 7." 135 | if ! grep -q '^deb.*mirrors.*stable' '/data/data/com.termux/files/usr/etc/apt/sources.list'; then 136 | printf "%s\n" "${YELLOW}检测到您当前使用的sources.list不是中科大源,是否需要更换为中科大源[Y/n]${RESET} " 137 | printf "%s\n" "更换后可以加快国内的下载速度,${YELLOW}按回车键确认,输n拒绝。${RESET}" 138 | printf "%s\n" "If you are not living in the People's Republic of China, then please type ${YELLOW}n${RESET} .${PURPLE}[Y/n]${RESET}" 139 | read opt 140 | case $opt in 141 | y* | Y* | "") 142 | if grep -q '^deb.*termux stable main' '/data/data/com.termux/files/usr/etc/apt/sources.list'; then 143 | sed -i 's@^\(deb.*stable main\)$@#\1\ndeb https://mirrors.ustc.edu.cn/termux stable main@' '/data/data/com.termux/files/usr/etc/apt/sources.list' 144 | else 145 | sed -i '$ a\deb https://mirrors.ustc.edu.cn/termux stable main' '/data/data/com.termux/files/usr/etc/apt/sources.list' 146 | fi 147 | apt_dist_upgrade 148 | press_enter_to_return 149 | android_termux 150 | ;; 151 | n* | N*) printf "%s\n" "skipped." ;; 152 | *) printf "%s\n" "Invalid choice. skipped." ;; 153 | esac 154 | fi 155 | } 156 | ############# 157 | android_termux 158 | -------------------------------------------------------------------------------- /share/termux/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ############### 3 | if [ $(command -v fortune) ]; then 4 | fortune 2>/dev/null 5 | elif [ -e /usr/games/fortune ]; then 6 | /usr/games/fortune 2>/dev/null 7 | fi 8 | get_hitokito_cn 2>/dev/null 9 | check_tmoe_completion_version 10 | check_tmoe_completion 11 | #aria2c --no-conf --allow-overwrite=true -d ${PREFIX}/bin -o debian-i "https://${TMOE_GIT_URL}/raw/master/manager.sh" || curl -Lo ${PREFIX}/bin/debian-i "https://${TMOE_GIT_URL}/raw/master/manager.sh" || sudo -E aria2c --no-conf --allow-overwrite=true -d ${PREFIX}/bin -o debian-i "https://${TMOE_GIT_URL}/raw/master/manager.sh" 12 | if [ ! -h "${PREFIX}/bin/debian-i" ]; then 13 | rm -fv /usr/local/bin/debian-i 2>/dev/null 14 | ln -sfv ${TMOE_GIT_DIR}/manager.sh ${PREFIX}/bin/debian-i 15 | else 16 | ln -sf ${TMOE_GIT_DIR}/manager.sh ${PREFIX}/bin/debian-i 17 | fi 18 | #if [ "${LINUX_DISTRO}" != "Android" ]; then 19 | # sed -i '1 c\#!/usr/bin/env bash' ${PREFIX}/bin/debian-i 20 | #fi 21 | chmod a+x ${PREFIX}/bin/debian-i 22 | if [ -e "${TMOE_GIT_DIR}/.git" ]; then 23 | cd ${TMOE_GIT_DIR} 24 | git reset --hard origin/master 25 | git pull --rebase --stat origin master --allow-unrelated-histories || git rebase --skip 26 | if [ "$?" != '0' ]; then 27 | git fetch --all 28 | git reset --hard origin/master 29 | git pull --rebase --stat origin master --allow-unrelated-histories || git rebase --skip 30 | fi 31 | fi 32 | [[ $(command -v tmoe) ]] || ln -sf ${TMOE_SHARE_DIR}/app/tmoe ${PREFIX}/bin 33 | for i in ${PREFIX}/bin/tmoe ${PREFIX}/bin/debian-i ${TMOE_SHARE_DIR}/container/debian/lnk-menu ${TMOE_SHARE_DIR}/container/debian/debian; do 34 | [[ ! $(command -v termux-fix-shebang) ]] || termux-fix-shebang ${i} 35 | done 36 | printf "%s\n" '(o゜▽゜)o☆ Thank you for using Tmoe-linux manager.' 37 | printf "${YELLOW}%s\n${RESET}" "更新完成,按回车键返回。" 38 | printf "%s\n" "Press ${GREEN}enter${RESET} to ${BLUE}return.${RESET}" 39 | read 40 | source ${PREFIX}/bin/debian-i 41 | -------------------------------------------------------------------------------- /share/termux/video_tutorial: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ############################# 3 | download_old_version_video_tutorial() { 4 | cd /sdcard/Download 5 | if [ -f "20200229vnc教程06.mp4" ]; then 6 | if (whiptail --title "检测到视频已下载,请选择您需要执行的操作!" --yes-button 'Play播放o(* ̄▽ ̄*)o' --no-button '重新下载(っ °Д °)' --yesno "Detected that the video has been downloaded, do you want to play it, or download it again?" 7 60); then 7 | play_video_tutorial 8 | else 9 | download_old_version_video_tutorial 10 | fi 11 | else 12 | download_old_version_video_tutorial 13 | fi 14 | } 15 | ########################## 16 | download_old_version_video_tutorial() { 17 | if [ $(command -v aria2c) ]; then 18 | aria2c --no-conf -x 6 -k 1M --split=6 --allow-overwrite=true -o "20200229vnc教程06.mp4" "https://m.tmoe.me/tmoe-vnc_video-tutorial_06" 19 | else 20 | curl -Lo "20200229vnc教程06.mp4" "https://m.tmoe.me/tmoe-vnc_video-tutorial_06" 21 | fi 22 | play_video_tutorial 23 | } 24 | ####################### 25 | play_video_tutorial() { 26 | termux-open "20200229vnc教程06.mp4" 27 | printf "%s\n" "${YELLOW}若视频无法自动播放,则请进入下载目录手动播放。${RESET}" 28 | printf "%s\n" "If the video does not play automatically, please enter the download directory to play it manually." 29 | printf "%s\n" "按回车键继续,按Ctrl+C取消。" 30 | printf "%s\n" "${YELLOW}Press enter to continue.${RESET}" 31 | read 32 | am start -n com.android.documentsui/com.android.documentsui.ViewDownloadsActivity 33 | cd ${CURRENT_DIR} 34 | } 35 | ####################################### 36 | download_old_version_video_tutorial $@ 37 | -------------------------------------------------------------------------------- /share/termux/xfce: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | tmoe_install_xfce() { 4 | if [ "${LINUX_DISTRO}" != 'Android' ]; then 5 | aria2c --no-conf --allow-overwrite=true -d /tmp -o '.tmoe-linux-tool.sh' 'https://raw.githubusercontent.com/2moe/tmoe-linux/master/tool.sh' 6 | bash /tmp/.tmoe-linux-tool.sh --install-gui 7 | exit 0 8 | fi 9 | 10 | if [ -e "${PREFIX}/bin/xfwm4" ]; then 11 | printf "%s\n" "检测到您已安装,是否继续?" 12 | printf '%s\n' 'Press enter to continue' 13 | printf "%s\n" "${YELLOW}按回车键确认继续,按Ctrl+C取消。${RESET}" 14 | read 15 | fi 16 | apt update 17 | apt install -y x11-repo 18 | apt update 19 | apt dist-upgrade -y 20 | 21 | apt install -y xfce tigervnc aterm 22 | cat >${PREFIX}/bin/startvnc <<-'EndOfFile' 23 | #!/usr/bin/env bash 24 | pkill Xvnc 2>/dev/null 25 | pulseaudio --kill 2>/dev/null 26 | pulseaudio --start 27 | printf "%s\n" "正在启动vnc服务,本机默认vnc地址localhost:5901" 28 | echo The LAN VNC address 局域网地址 $(ip -4 -br -c a | tail -n 1 | cut -d '/' -f 1 | cut -d 'P' -f 2):5901 29 | export DISPLAY=:1 30 | Xvnc -geometry 720x1440 -depth 24 --SecurityTypes=None $DISPLAY & 31 | export PULSE_SERVER=127.0.0.1 32 | am start -n com.realvnc.viewer.android/com.realvnc.viewer.android.app.ConnectionChooserActivity 33 | sleep 1s 34 | thunar & 35 | printf "%s\n" "已为您启动vnc服务 Vnc server has been started, enjoy it!" 36 | printf "%s\n" "默认为前台运行,您可以按Ctrl+C终止当前进程。" 37 | startxfce4 38 | 39 | EndOfFile 40 | termux-fix-shebang ${PREFIX}/bin/startvnc 41 | chmod +x ${PREFIX}/bin/startvnc 42 | source ${PREFIX}/bin/startvnc 43 | } 44 | ########## 45 | tmoe_modify_vnc_conf() { 46 | if [ "${LINUX_DISTRO}" != 'Android' ]; then 47 | aria2c --no-conf --allow-overwrite=true -d /tmp -o '.tmoe-linux-tool.sh' 'https://raw.githubusercontent.com/2moe/tmoe-linux/master/tool.sh' 48 | bash /tmp/.tmoe-linux-tool.sh --modify_remote_desktop_config 49 | exit 0 50 | fi 51 | modify_android_termux_vnc_config 52 | } 53 | ######### 54 | termux_original_system_gui_menu() { 55 | RETURN_TO_WHERE='termux_original_system_gui_menu' 56 | termux_original_system_gui_menu_en() { 57 | OPTION=$(whiptail --title "Termux" --menu "Termux native GUI has fewer software packages.It is recommended that you install a container." 0 50 0 \ 58 | "1" "modify termux-vnc conf" \ 59 | "2" "🐹 install termux-xfce4" \ 60 | "3" "💔 remove xfce4" \ 61 | "0" "🌚 Return to previous menu" \ 62 | 3>&1 1>&2 2>&3) 63 | } 64 | termux_original_system_gui_menu_cn() { 65 | #\n这里是termux原系统的配置区域,不是GNU/Linux容器的哦!\nThe following options only apply to termux original system. 66 | OPTION=$(whiptail --title "Termux" --menu "Termux原系统GUI可玩性较低,建议您安装GNU/Linux(proot/chroot)容器" 0 50 0 \ 67 | "1" "modify termux-vnc conf" \ 68 | "2" "🐹 install termux-xfce4" \ 69 | "3" "💔 remove xfce4" \ 70 | "0" "🌚 Return 返回上级菜单" \ 71 | 3>&1 1>&2 2>&3) 72 | } 73 | case ${TMOE_MENU_LANG} in 74 | zh_*UTF-8) termux_original_system_gui_menu_cn ;; 75 | *) termux_original_system_gui_menu_en ;; 76 | esac 77 | ##################################### 78 | case "${OPTION}" in 79 | 0 | "") android_termux_tmoe_menu ;; 80 | 1) tmoe_modify_vnc_conf ;; 81 | 2) tmoe_install_xfce ;; 82 | 3) tmoe_remove_xfce ;; 83 | esac 84 | #################################### 85 | press_enter_to_return 86 | termux_original_system_gui_menu 87 | } 88 | ############### 89 | tmoe_remove_xfce() { 90 | if [ "${LINUX_DISTRO}" != 'Android' ]; then 91 | aria2c --no-conf --allow-overwrite=true -d /tmp -o '.tmoe-linux-tool.sh' 'https://raw.githubusercontent.com/2moe/tmoe-linux/master/tool.sh' 92 | bash /tmp/.tmoe-linux-tool.sh --remove_gui 93 | exit 0 94 | fi 95 | remove_android_termux_xfce 96 | } 97 | ##########I 98 | modify_android_termux_vnc_config() { 99 | if [ ! -e ${PREFIX}/bin/startvnc ]; then 100 | printf "%s\n" "${PREFIX}/bin/startvnc is not detected, maybe you have not installed the graphical desktop environment, do you want to continue editing?" 101 | printf '%s\n' '未检测到startvnc,您可能尚未安装图形桌面,是否继续编辑?' 102 | printf "%s\n" "Press Enter to confirm." 103 | printf "%s\n" "${YELLOW}按回车键确认编辑。${RESET}" 104 | read 105 | fi 106 | CURRENTTERMUXVNCRES=$(sed -n 7p "$(command -v startvnc)" | cut -d 'y' -f 2 | cut -d '-' -f 1) 107 | if (whiptail --title "modify vnc configuration" --yes-button '分辨率resolution' --no-button '其它other' --yesno "您想要修改哪项配置信息?Which configuration do you want to modify?" 9 50); then 108 | if grep -q 'debian_' "$(command -v startvnc)"; then 109 | printf "%s\n" "您当前使用的startvnc配置为Linux容器系统专用版,请输debian进入容器后再输tmoe t修改" 110 | printf "%s\n" "本选项仅适用于termux原系统。" 111 | press_enter_to_return 112 | tmoe_manager_main_menu 113 | fi 114 | TARGET=$(whiptail --inputbox "Please enter a resolution,请输入分辨率,例如2880x1440,2400x1200,1920x1080,1920x960,1440x720,1280x1024,1280x960,1280x720,1024x768,800x680等等,默认为720x1440,当前为${CURRENTTERMUXVNCRES}。分辨率可自定义,但建议您根据屏幕比例来调整,输入完成后按回车键确认,修改完成后将自动停止VNC服务。注意:x为英文小写,不是乘号。Press Enter after the input is completed." 16 50 --title "请在方框内输入 水平像素x垂直像素 (数字x数字) " 3>&1 1>&2 2>&3) 115 | #此处termux的whiptail跟debian不同,必须截取Error前的字符。 116 | #TRUETARGET="$(printf '%s\n' "${TARGET}" | cut -d 'E' -f 1)" 117 | TRUETARGET="$(printf '%s\n' "${TARGET}" | head -n 1 | cut -d ' ' -f 1)" 118 | #下面那条变量TRUETARGETTARGET前加空格 119 | #sed -i "s#${CURRENTTERMUXVNCRES}# ${TRUETARGETTARGET}#" "$(command -v startvnc)" 120 | sed -i "7 c Xvnc -geometry ${TRUETARGET} -depth 24 --SecurityTypes=None \$DISPLAY \&" "$(command -v startvnc)" 121 | printf '%s\n' 'Your current resolution has been modified.' 122 | printf '%s\n' '您当前的分辨率已经修改为' 123 | printf "%s\n" "$(sed -n 7p "$(command -v startvnc)" | cut -d 'y' -f 2 | cut -d '-' -f 1)" 124 | else 125 | printf '%s\n' '您可以手动修改vnc的配置信息' 126 | printf '%s\n' 'If you want to modify the resolution, please change the 720x1440 (default resolution , vertical screen) to another resolution, such as 1920x1080 (landscape).' 127 | printf '%s\n' '若您想要修改分辨率,请将默认的720x1440(竖屏)改为其它您想要的分辨率,例如1920x1080(横屏)。' 128 | printf "%s\n" "您当前分辨率为${CURRENTTERMUXVNCRES}" 129 | printf '%s\n' '改完后按Ctrl+S保存,Ctrl+X退出。' 130 | printf "%s\n" "Press Enter to confirm." 131 | printf "%s\n" "${YELLOW}按回车键确认编辑。${RESET}" 132 | read 133 | nano ${PREFIX}/bin/startvnc || nano $(command -v startvnc) 134 | printf "%s\n" "您当前分辨率为$(sed -n 7p "$(command -v startvnc)" | cut -d 'y' -f 2 | cut -d '-' -f 1)" 135 | fi 136 | press_enter_to_return 137 | tmoe_manager_main_menu 138 | } 139 | ############### 140 | remove_android_termux_xfce() { 141 | do_you_want_to_continue 142 | apt purge -y ^xfce tigervnc aterm 143 | apt purge -y x11-repo 144 | apt autoremove 145 | press_enter_to_return 146 | tmoe_manager_main_menu 147 | } 148 | ################# 149 | termux_original_system_gui_menu $@ 150 | -------------------------------------------------------------------------------- /tools/app/lnk/tmoe-linux.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Tmoe-linux tool 3 | Comment=Easily configure remote desktop server and qemu vm. 4 | Exec=/usr/local/etc/tmoe-linux/git/tool.sh 5 | Terminal=true 6 | X-MultipleArgs=false 7 | Type=Application 8 | StartupNotify=false 9 | Categories=System; 10 | Icon=/usr/local/etc/tmoe-linux/git/.mirror/icon.png 11 | X-Ubuntu-Gettext-Domain=tmoe-linux 12 | X-KDE-SubstituteUID=true 13 | Keywords=tmoe;Tmoe;moe;vnc;aria2;xserver;xsdl;startvnc;debian-i;tool;manager;configuration;settings;menu; 14 | -------------------------------------------------------------------------------- /tools/app/terminal: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ######################## 3 | tmoe_terminal_main_menu() { 4 | RETURN_TO_WHERE='tmoe_terminal_main_menu' 5 | DEPENDENCY_01="" 6 | TMOE_APP=$(whiptail --title "TERMINAL APP" --menu \ 7 | "Which software do you want to install?" 0 50 0 \ 8 | "0" "🌚 Return to previous menu 返回上级菜单" \ 9 | "01" "cool-retro-term(穿梭时光,感受复古风,领略CRT的魅力)" \ 10 | "02" "Terminology(酷炫终端,支持预览图片和视频)" \ 11 | "03" "Terminator(支持分屏的终端)" \ 12 | "04" "Yakuake(基于KDE Konsole技术的下拉式终端)" \ 13 | "05" "Guake(GNOME下拉式终端)" \ 14 | "06" "Tilda(雷神之锤风格的下拉式终端)" \ 15 | "07" "Konsole(KDE默认终端)" \ 16 | "08" "Xfce4-Terminal(xfce默认终端)" \ 17 | "09" "Gnome-Terminal(gnome默认终端)" \ 18 | "10" "LXTerminal(lxde默认终端)" \ 19 | "11" "Mate-Terminal(mate默认终端)" \ 20 | "12" "LilyTerm(基于libvte,追求轻量和快速)" \ 21 | "13" "Sakura(如櫻花般優雅)" \ 22 | "14" "Rxvt(资源占用低,启动速度快)" \ 23 | "15" "st(简单,清晰,且节约资源)" \ 24 | "16" "Aterm(基于rxvt,高度可定制)" \ 25 | "17" "xterm/Uxterm(X11标准指定的虚拟终端)" \ 26 | 3>&1 1>&2 2>&3) 27 | ########################## 28 | #Terminus (x64,超唯美现代化终端) 29 | case "${TMOE_APP}" in 30 | 0 | "") beta_features ;; 31 | 01) 32 | DEPENDENCY_02="cool-retro-term" 33 | printf "%s\n" "${YELLOW}https://github.com/Swordfish90/cool-retro-term${RESET}" 34 | ;; 35 | 02) 36 | DEPENDENCY_02="terminology" 37 | printf "%s\n" "tycat命令预览图片和视频,tysend复制文件,tyls显示文件列表" 38 | ;; 39 | 03) 40 | DEPENDENCY_02="terminator" 41 | printf "%s\n" "按Ctrl+Shift+O或E进行切割" 42 | ;; 43 | 04) DEPENDENCY_02="yakuake" ;; 44 | 05) DEPENDENCY_02="guake" ;; 45 | 06) DEPENDENCY_02="tilda" ;; 46 | 07) DEPENDENCY_02="konsole" ;; 47 | 08) DEPENDENCY_02="xfce4-terminal" ;; 48 | 09) DEPENDENCY_02="gnome-terminal" ;; 49 | 10) DEPENDENCY_02="lxterminal" ;; 50 | 11) DEPENDENCY_02="mate-terminal" ;; 51 | 12) DEPENDENCY_02="lilyterm" ;; 52 | 13) DEPENDENCY_02="sakura" ;; 53 | 14) DEPENDENCY_02="rxvt" ;; 54 | 15) 55 | DEPENDENCY_02="stterm" 56 | printf "%s\n" "You can type st to start it.输st或stterm启动" 57 | ;; 58 | 16) 59 | DEPENDENCY_02="atem" 60 | printf "%s\n" "You can type aterm to start it.输aterm启动" 61 | ;; 62 | 17) DEPENDENCY_02="xterm" ;; 63 | esac 64 | ########################## 65 | beta_features_quick_install 66 | case ${DEPENDENCY_02} in 67 | cool-retro-term) 68 | case ${LINUX_DISTRO} in 69 | debian) 70 | printf "%s\n" "若安装失败,则请手动添加ppa源,${GREEN}sudo add-apt-repository${RESET} ${BLUE}ppa:noobslab/apps${RESET}" 71 | ;; 72 | esac 73 | ;; 74 | terminology) 75 | printf "%s\n" "tycat命令预览图片和视频,tysend复制文件,tyls显示文件列表" 76 | ;; 77 | stterm) 78 | printf "%s\n" "You can type st to start it.输st或stterm启动" 79 | ;; 80 | aterm) 81 | printf "%s\n" "You can type aterm to start it.输aterm启动" 82 | ;; 83 | esac 84 | press_enter_to_return 85 | tmoe_terminal_main_menu 86 | } 87 | ####################### 88 | tmoe_terminal_main_menu 89 | -------------------------------------------------------------------------------- /tools/code/bin/codium: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/vscodium-data/bin/codium' 3 | #export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) ${TMOE_BIN} --no-sandbox --user-data-dir=${HOME}/.codium "$@" ;; 6 | *) 7 | ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) ${TMOE_BIN} --no-sandbox --user-data-dir=${HOME}/.codium "$@" ;; 11 | esac 12 | ;; 13 | esac 14 | -------------------------------------------------------------------------------- /tools/code/lnk/codium.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=VSCodium 3 | Comment=Code Editing. Redefined. 4 | GenericName=Text Editor 5 | Exec=/usr/local/bin/codium --unity-launch %F 6 | Icon=/usr/share/icons/vscodium.png 7 | Type=Application 8 | StartupNotify=false 9 | StartupWMClass=VSCodium 10 | Categories=Utility;TextEditor;Development;IDE; 11 | MimeType=text/plain;inode/directory; 12 | Actions=new-empty-window; 13 | Keywords=vscode; 14 | 15 | X-Desktop-File-Install-Version=0.26 16 | 17 | [Desktop Action new-empty-window] 18 | Name=New Empty Window 19 | Exec=/usr/local/bin/codium --new-window %F 20 | Icon=vscodium 21 | -------------------------------------------------------------------------------- /tools/code/lnk/intellij-idea-ultimate-edition.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=IntelliJ IDEA Ultimate Edition 3 | Type=Application 4 | Comment=Intelligent coding assistance and ergonomic design make development not only productive but also enjoyable. 5 | Exec=/opt/intellij-idea-ultimate-edition/opt/intellij-idea-ultimate-edition/bin/idea.sh %u 6 | Icon=/opt/intellij-idea-ultimate-edition/opt/intellij-idea-ultimate-edition/bin/idea.png 7 | Terminal=false 8 | StartupWMClass=jetbrains-idea 9 | Categories=Development;IDE; 10 | StartupNotify=true 11 | MimeType=text/plain;inode/directory; -------------------------------------------------------------------------------- /tools/downloader/thunder: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ########### 3 | thunder_bin_env() { 4 | case ${LINUX_DISTRO} in 5 | arch) DEPENDENCY_01='xunlei-bin' ;; 6 | debian | *) DEPENDENCY_01='com.xunlei.download' ;; 7 | esac 8 | GREP_NAME='com.xunlei.download' 9 | OFFICIAL_URL='https://dl.xunlei.com' 10 | tmoe_app_menu_01 11 | DEPENDENCY_01='' 12 | } 13 | ########## 14 | install_thunder_bin() { 15 | REPO_URL='https://aur.tuna.tsinghua.edu.cn/packages/xunlei-bin/' 16 | THE_LATEST_DEB_URL=$(curl -L ${REPO_URL} | grep deb | cut -d '=' -f 2 | cut -d '"' -f 2 | head -n 1) 17 | #https://cdn-package-store6.deepin.com/appstore/pool/appstore/c/com.xunlei.download/com.xunlei.download_1.0.0.1_amd64.deb 18 | case ${ARCH_TYPE} in 19 | arm64) THE_LATEST_DEB_URL=$(printf '%s\n' "${THE_LATEST_DEB_URL}" | sed "s@amd64.deb@arm64.deb@") ;; 20 | *) ;; 21 | esac 22 | THE_LATEST_DEB_FILE=$(printf '%s\n' "${THE_LATEST_DEB_URL}" | awk -F '/' '{print $NF}') 23 | THE_LATEST_DEB_VERSION=$(printf '%s\n' "${THE_LATEST_DEB_FILE}" | sed 's@.deb@@' | sed "s@${GREP_NAME}_@@") 24 | ICON_FILE='/opt/apps/com.xunlei.download/entries/icons/hicolor/128x128/apps/com.xunlei.download.png' 25 | if [ -e "${ICON_FILE}" ]; then 26 | catimg "${ICON_FILE}" 2>/dev/null 27 | fi 28 | printf "%s\n" "若无法以root身份运行electron应用,则请切换为普通用户,或手动禁用sandbox。" 29 | case ${LINUX_DISTRO} in 30 | arch) printf "%s\n" "若安装失败,则请手动输yay -S ${DEPENDENCY_01}" ;; 31 | esac 32 | check_deb_version 33 | this_app_may_non_support_running_on_proot 34 | case ${ARCH_TYPE} in 35 | amd64 | arm64) ;; 36 | *) arch_does_not_support ;; 37 | esac 38 | do_you_want_to_upgrade_it_02 39 | do_you_want_to_continue 40 | TEMP_FOLDER="/tmp/.${GREP_NAME}" 41 | mkdir -p ${TEMP_FOLDER} 42 | cd ${TEMP_FOLDER} 43 | aria2c --no-conf --allow-overwrite=true -s 5 -x 5 -k 1M -o "${THE_LATEST_DEB_FILE}" "${THE_LATEST_DEB_URL}" 44 | ar xv ${THE_LATEST_DEB_FILE} 45 | if [ -e "data.tar.gz" ]; then 46 | tar -zxvf data.tar.gz -C / 47 | elif [ -e data.tar.xz ]; then 48 | tar -Jxvf data.tar.xz -C / 49 | fi 50 | cd /opt/apps/com.xunlei.download/files 51 | sed -i 's@thunder -start@thunder --no-sandbox -start@' start.sh 52 | cd ../entries 53 | sed -i 's@Icon=.*@Icon=/usr/share/icons/hicolor/scalable/apps/com.thunder.download.svg@' applications/com.xunlei.download.desktop 54 | cp -rvf ./applications ./icons /usr/share 55 | rm -rv ${TEMP_FOLDER} 2>/dev/null 56 | printf "%s\n" "${THE_LATEST_DEB_VERSION}" >${LOCAL_APP_VERSION_TXT} 57 | } 58 | ################ 59 | remove_thunder_opt_app() { 60 | rm -rv /opt/apps/com.xunlei.download 61 | cd /usr/share 62 | rm -fv ./applications/com.xunlei.download.desktop ./icons/hicolor/256x256/apps/com.xunlei.download.png ./icons/hicolor/32x32/apps/com.xunlei.download.png ./icons/hicolor/scalable/apps/com.thunder.download.svg ./icons/hicolor/128x128/apps/com.xunlei.download.png ./icons/hicolor/16x16/apps/com.xunlei.download.png ./icons/hicolor/48x48/apps/com.xunlei.download.png ./icons/hicolor/24x24/apps/com.xunlei.download.png 63 | } 64 | ############## 65 | thunder_bin_env 66 | -------------------------------------------------------------------------------- /tools/gui/config/xfce4-panel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /tools/gui/launch_dbus_daemon: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | dbus_daemon_fork() { 3 | if [ $(command -v sudo) ]; then 4 | sudo dbus-daemon --system --fork 2>/dev/null 5 | else 6 | su -c "dbus-daemon --system --fork 2>/dev/null" 7 | fi 8 | } 9 | ########### 10 | check_dbus_daemon() { 11 | case ${TMOE_CHROOT} in 12 | true) 13 | case $(id -u) in 14 | 0) 15 | rm -vf /run/dbus/pid 2>/dev/null 16 | dbus_daemon_fork 17 | ;; 18 | *) 19 | if [ -e "/run/dbus/pid" ]; then 20 | if [ $(command -v sudo) ]; then 21 | sudo rm -vf /run/dbus/pid 2>/dev/null 22 | else 23 | su -c "rm -vf /run/dbus/pid 2>/dev/null" 24 | fi 25 | fi 26 | dbus_daemon_fork 27 | ;; 28 | esac 29 | ;; 30 | esac 31 | } 32 | ########### 33 | check_dbus_daemon 34 | -------------------------------------------------------------------------------- /tools/gui/startvnc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ######################### 3 | stopvnc -non-stop-dbus 2>/dev/null 4 | TMOE_VNC_DISPLAY_NUMBER=1 5 | export USER="$(whoami)" 6 | export PULSE_SERVER=127.0.0.1 7 | TMOE_LINUX_DIR='/usr/local/etc/tmoe-linux' 8 | TMOE_GIT_DIR="${TMOE_LINUX_DIR}/git" 9 | TMOE_TOOL_DIR="${TMOE_GIT_DIR}/tools" 10 | XSESSION_FILE='/etc/X11/xinit/Xsession' 11 | TMOE_LOCALE_FILE="${TMOE_LINUX_DIR}/locale.txt" 12 | ######################## 13 | check_tmoe_locale() { 14 | if [ -e "${TMOE_LOCALE_FILE}" ]; then 15 | TMOE_LANG=$(sed -n p ${TMOE_LOCALE_FILE} | head -n 1) 16 | export LANG="${TMOE_LANG}" 17 | else 18 | export LANG="en_US.UTF-8" 19 | fi 20 | } 21 | ########### 22 | check_current_user_name_and_group() { 23 | CURRENT_USER_NAME=$(sed -n p /etc/passwd | grep "${HOME}" | awk -F ':' '{print $1}' | head -n 1) 24 | CURRENT_USER_GROUP=$(sed -n p /etc/passwd | grep "${HOME}" | awk -F ':' '{print $5}' | cut -d ',' -f 1 | head -n 1) 25 | if [ -z "${CURRENT_USER_GROUP}" ]; then 26 | CURRENT_USER_GROUP=${CURRENT_USER_NAME} 27 | fi 28 | } 29 | ############### 30 | fix_vnc_permissions() { 31 | check_current_user_name_and_group 32 | CURRENT_USER_VNC_FILE_PERMISSION=$(ls -l ${HOME}/.vnc/passwd | awk -F ' ' '{print $3}') 33 | case ${CURRENT_USER_VNC_FILE_PERMISSION} in 34 | ${CURRENT_USER_NAME}) ;; 35 | *) 36 | printf "%s\n" "检测到${HOME}/.vnc/passwd文件所属非当前用户(${CURRENT_USER_NAME}),为避免权限问题,正在将${HOME}目录下的.vnc 的权限归属修改为${CURRENT_USER_NAME}用户和${CURRENT_USER_GROUP}用户组" 37 | cd ${HOME} 38 | sudo -E chown -Rv ${CURRENT_USER_NAME}:${CURRENT_USER_GROUP} .vnc || su -c "chown -Rv ${CURRENT_USER_NAME}:${CURRENT_USER_GROUP} .vnc" 39 | for i in ".ICEauthority" ".Xauthority"; do 40 | if [ -e "${i}" ]; then 41 | sudo -E chown -Rv ${CURRENT_USER_NAME}:${CURRENT_USER_GROUP} "${i}" || su -c "chown -Rv ${CURRENT_USER_NAME}:${CURRENT_USER_GROUP} ${i}" 42 | fi 43 | done 44 | unset i 45 | ;; 46 | esac 47 | } 48 | ############## 49 | tmoe_vnc_preconfigure() { 50 | check_tmoe_locale 51 | if [ ! -s "${HOME}/.vnc/passwd" ]; then 52 | sudo -E cp -rvf "/root/.vnc" "${HOME}" || su -c "cp -rvf /root/.vnc ${HOME}" 53 | if [ ! -e "${HOME}/.vnc/passwd" ]; then 54 | cd ${TMOE_TOOL_DIR} 55 | git reset --hard origin/master 56 | git pull --rebase --stat origin master --allow-unrelated-histories || git rebase --skip 57 | debian-i -passwd 58 | fi 59 | fi 60 | fix_vnc_permissions 61 | if [ "$(uname -r | cut -d '-' -f 3)" = "Microsoft" ] || [ "$(uname -r | cut -d '-' -f 2)" = "microsoft" ]; then 62 | . ${TMOE_LINUX_DIR}/wsl_pulse_audio 63 | fi 64 | } 65 | ############### 66 | display_vnc_ip_addr() { 67 | #CURRENT_PORT=$(sed -n p /usr/local/bin/startvnc | grep '\-geometry' | awk -F ' ' '$0=$NF' | cut -d ':' -f 2 | tail -n 1) 68 | CURRENT_PORT=${TMOE_VNC_DISPLAY_NUMBER} 69 | CURRENT_VNC_PORT=$((${CURRENT_PORT} + 5900)) 70 | TMOE_IP_ADDR=$(ip -4 -br -c a | awk '{print $NF}' | cut -d '/' -f 1 | grep -v '127\.0\.0\.1' | sed "s@\$@:${CURRENT_VNC_PORT}@") 71 | cat <<-EOF 72 | 正在启动vnc服务,本机默认vnc地址localhost:${CURRENT_VNC_PORT} 73 | The LAN VNC address 局域网地址${TMOE_IP_ADDR} 74 | EOF 75 | } 76 | ############ 77 | start_tmoe_xvnc() { 78 | . /etc/tigervnc/vncserver-config-defaults 2>/dev/null 79 | if [[ $(readlink /etc/alternatives/vncserver) = "/usr/bin/tigervncserver" || -n $(command -v vncsession) ]]; then 80 | set -- "${@}" "-ZlibLevel=1" 81 | fi 82 | #tightvnc专有参数bc #enable bug compatibility #set -- "${@}" "bc" 83 | set -- "${@}" "-a" "5" 84 | set -- "${@}" "-wm" 85 | set -- "${@}" "-alwaysshared" 86 | set -- "${@}" "-geometry" "${geometry}" 87 | set -- "${@}" "-once" 88 | set -- "${@}" "-depth" "16" 89 | set -- "${@}" "-deferglyphs" "16" 90 | set -- "${@}" "-rfbauth" "${HOME}/.vnc/passwd" 91 | set -- "${@}" "-desktop" "${desktop}" 92 | set -- "${@}" ":${TMOE_VNC_DISPLAY_NUMBER}" 93 | set -- "Xvnc" "${@}" 94 | "${@}" & 95 | export DISPLAY=:${TMOE_VNC_DISPLAY_NUMBER} 96 | . ${XSESSION_FILE} &>/dev/null & 97 | exit 0 98 | } 99 | ############## 100 | source_tmoe_dbus_daemon() { 101 | . ${TMOE_TOOL_DIR}/gui/launch_dbus_daemon 102 | } 103 | ########### 104 | check_vncsession() { 105 | if [ $(command -v vncsession) ]; then 106 | case $(id -u) in 107 | 0) 108 | vncsession $(whoami) :${TMOE_VNC_DISPLAY_NUMBER} 109 | exit 0 110 | ;; 111 | *) check_xvnc ;; 112 | esac 113 | else 114 | check_xvnc 115 | fi 116 | } 117 | ######### 118 | check_xvnc() { 119 | if [ $(command -v Xvnc) ]; then 120 | start_tmoe_xvnc 121 | exit 0 122 | fi 123 | } 124 | ########## 125 | tmoe_vnc_preconfigure 126 | source_tmoe_dbus_daemon 127 | display_vnc_ip_addr 128 | #check_vncsession 129 | check_xvnc 130 | ########## 131 | #最后一行命令已废弃,仅作兼容性测试,直接修改其参数值可能不会生效。 132 | #20200912注:tigervnc-1.11.0-2及其之后的版本,可能无法使用旧版命令。 133 | vncserver -geometry 1440x720 -depth 24 -name tmoe-linux :1 134 | -------------------------------------------------------------------------------- /tools/gui/startx11vnc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | stopvnc -non-stop-dbus 2>/dev/null 3 | export PULSE_SERVER=127.0.0.1 4 | export DISPLAY=:233 5 | TMOE_X11_PASSWD_FILE=${HOME}/.vnc/x11passwd 6 | TMOE_X11_RESOLUTION=1440x720 7 | TCP_PORT_FOR_RFB_PROTOCOL=5901 8 | X11VNC_CURSOR_ARROW=2 9 | TMOE_LINUX_DIR='/usr/local/etc/tmoe-linux' 10 | TMOE_LOCALE_FILE="${TMOE_LINUX_DIR}/locale.txt" 11 | TMOE_GIT_DIR="${TMOE_LINUX_DIR}/git" 12 | TMOE_TOOL_DIR="${TMOE_GIT_DIR}/tools" 13 | XSESSION_FILE='/etc/X11/xinit/Xsession' 14 | ################# 15 | start_windows_10_pulse_audio_server() { 16 | . ${TMOE_LINUX_DIR}/wsl_pulse_audio 17 | } 18 | ##################### 19 | start_tmoe_x11vnc() { 20 | set -- "${@}" "-ncache_cr" 21 | set -- "${@}" "-xkb" 22 | set -- "${@}" "-noxrecord" 23 | #set -- "${@}" "-noxfixes" 24 | set -- "${@}" "-noxdamage" 25 | set -- "${@}" "-display" "${DISPLAY}" 26 | set -- "${@}" "-forever" 27 | set -- "${@}" "-bg" 28 | set -- "${@}" "-rfbauth" "${TMOE_X11_PASSWD_FILE}" 29 | set -- "${@}" "-users" "$(whoami)" 30 | set -- "${@}" "-rfbport" "${TCP_PORT_FOR_RFB_PROTOCOL}" 31 | set -- "${@}" "-noshm" 32 | set -- "${@}" "-desktop" "tmoe-linux" 33 | set -- "${@}" "-shared" 34 | set -- "${@}" "-verbose" 35 | set -- "${@}" "-cursor" "arrow" 36 | set -- "${@}" "-arrow" "${X11VNC_CURSOR_ARROW}" 37 | set -- "${@}" "-nothreads" 38 | set -- "x11vnc" "${@}" 39 | "${@}" & 40 | } 41 | ################### 42 | tmoe_x11vnc_preconfigure() { 43 | if [ ! -s "${TMOE_X11_PASSWD_FILE}" ]; then 44 | x11vncpasswd 45 | fi 46 | 47 | if [ -e "${TMOE_LOCALE_FILE}" ]; then 48 | TMOE_LANG=$(sed -n p ${TMOE_LOCALE_FILE} | head -n 1) 49 | export LANG="${TMOE_LANG}" 50 | else 51 | export LANG="en_US.UTF-8" 52 | fi 53 | } 54 | ################# 55 | source_tmoe_dbus_daemon() { 56 | . ${TMOE_TOOL_DIR}/gui/launch_dbus_daemon 57 | } 58 | ########### 59 | start_tmoe_xvfb() { 60 | set -- "${@}" "${DISPLAY}" 61 | set -- "${@}" "-screen" "0" "${TMOE_X11_RESOLUTION}x24" 62 | set -- "${@}" "-ac" 63 | set -- "${@}" "+extension" "GLX" 64 | set -- "${@}" "+render" 65 | set -- "${@}" "-deferglyphs" "16" 66 | set -- "${@}" "-br" 67 | set -- "${@}" "-wm" 68 | set -- "${@}" "-retro" 69 | set -- "${@}" "-noreset" 70 | set -- "Xvfb" "${@}" 71 | "${@}" & 72 | } 73 | #################### 74 | if [ "$(uname -r | cut -d '-' -f 3 | head -n 1)" = "Microsoft" ] || [ "$(uname -r | cut -d '-' -f 2 | head -n 1)" = "microsoft" ]; then 75 | start_windows_10_pulse_audio_server 76 | fi 77 | ############### 78 | start_x_session() { 79 | . ${XSESSION_FILE} & 80 | } 81 | ############# 82 | tmoe_x11vnc_preconfigure 83 | source_tmoe_dbus_daemon 84 | start_tmoe_xvfb 85 | start_x_session 86 | start_tmoe_x11vnc 87 | ########### 88 | sleep 2s 89 | TMOE_IP_ADDR=$(ip -4 -br -c a | awk '{print $NF}' | cut -d '/' -f 1 | grep -v '127\.0\.0\.1' | sed "s@\$@:5901@") 90 | cat <<-ENFOFX11VNCTIPS 91 | 正在启动x11vnc服务,本机默认vnc地址localhost:5901 92 | 本机IPv6 vnc地址[::]:5900或:: 93 | The LAN VNC address 局域网地址${TMOE_IP_ADDR} 94 | 您可能会经历长达10多秒的黑屏 95 | You may experience a black screen for up to 10 seconds. 96 | 您之后可以输startx11vnc启动,输stopvnc停止 97 | You can type startx11vnc to start x11vnc,type stopvnc to stop it. 98 | ENFOFX11VNCTIPS 99 | -------------------------------------------------------------------------------- /tools/gui/startxsdl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ################### 3 | stopvnc -non-stop-dbus 2>/dev/null 4 | export DISPLAY=127.0.0.1:0 5 | export PULSE_SERVER=tcp:127.0.0.1:4713 6 | TMOE_LINUX_DIR='/usr/local/etc/tmoe-linux' 7 | TMOE_GIT_DIR="${TMOE_LINUX_DIR}/git" 8 | TMOE_TOOL_DIR="${TMOE_GIT_DIR}/tools" 9 | XSESSION_FILE='/etc/X11/xinit/Xsession' 10 | TMOE_LOCALE_FILE="${TMOE_LINUX_DIR}/locale.txt" 11 | ############### 12 | check_tmoe_locale() { 13 | if [ -e "${TMOE_LOCALE_FILE}" ]; then 14 | TMOE_LANG=$(sed -n p ${TMOE_LOCALE_FILE} | head -n 1) 15 | export LANG="${TMOE_LANG}" 16 | else 17 | export LANG="en_US.UTF-8" 18 | fi 19 | } 20 | ########### 21 | notes_of_xserver() { 22 | printf '%s\n' '正在为您启动x11,请将display number改为0' 23 | printf '%s\n' 'Starting x11, please change display number to 0' 24 | printf '%s\033[32m%s\033[m%s\n' "您可以输" "stopvnc" "停止" 25 | printf '%s \033[32m%s\033[m %s\n' "You can type" "stopvnc" "to stop it." 26 | } 27 | #################### 28 | start_windows_xserver() { 29 | VCXSRV_DISPLAY_PORT=37985 30 | . ${TMOE_LINUX_DIR}/wsl_pulse_audio 31 | cd "/mnt/c/Users/Public/Downloads/VcXsrv/" 32 | #/mnt/c/WINDOWS/system32/cmd.exe /c "start .\config.xlaunch" 33 | /mnt/c/WINDOWS/system32/taskkill.exe /f /im vcxsrv.exe 2>/dev/null 34 | /mnt/c/WINDOWS/system32/cmd.exe /c "start .\vcxsrv.exe :${VCXSRV_DISPLAY_PORT} -multiwindow -clipboard -wgl -ac" 35 | printf "%s\n" "若无法自动打开X服务,则请手动在资源管理器中打开C:\Users\Public\Downloads\VcXsrv\vcxsrv.exe" 36 | if grep -q '172..*1' "/etc/resolv.conf"; then 37 | printf "%s\n" "检测到您当前使用的可能是WSL2,如需手动启动,请在xlaunch.exe中勾选Disable access control" 38 | WSL2IP=$(sed -n p /etc/resolv.conf | grep nameserver | awk '{print $2}' | head -n 1) 39 | export DISPLAY=${WSL2IP}:${VCXSRV_DISPLAY_PORT} 40 | printf "%s\n" "已将您的显示和音频服务ip修改为${WSL2IP}" 41 | else 42 | export DISPLAY="$(printf '%s\n' "${DISPLAY}" | cut -d ':' -f 1):${VCXSRV_DISPLAY_PORT}" 43 | fi 44 | sleep 2 45 | } 46 | ############### 47 | check_wsl() { 48 | if [ "$(uname -r | cut -d '-' -f 3)" = "Microsoft" ] || [ "$(uname -r | cut -d '-' -f 2)" = "microsoft" ]; then 49 | start_windows_xserver 50 | fi 51 | } 52 | ############### 53 | source_tmoe_dbus_daemon() { 54 | . ${TMOE_TOOL_DIR}/gui/launch_dbus_daemon 55 | } 56 | ############ 57 | check_tmoe_locale 58 | notes_of_xserver 59 | check_wsl 60 | source_tmoe_dbus_daemon 61 | ########### 62 | . ${XSESSION_FILE} & 63 | -------------------------------------------------------------------------------- /tools/gui/stopvnc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ################# 3 | stop_vnc_main() { 4 | tmoe_vnc_env 5 | rm_vnc_lock 6 | pkill_vnc 7 | case "$1" in 8 | -non-stop-dbus) 9 | stopx11vnc 10 | ;; 11 | -non-stop-x11vnc) ;; 12 | -x11) 13 | stop_dbus_daemon 14 | stopx11vnc 15 | ;; 16 | -h | --h | --help | -help) 17 | cat <<-'EOF' 18 | -non-stop-dbus --不停止dbus-daemon 19 | -non-stop-x11vnc --不停止x11vnc 20 | -x11 --停止x11vnc 21 | -h --获取帮助信息 22 | EOF 23 | ;; 24 | *) 25 | stopx11vnc 2>/dev/null 26 | stop_dbus_daemon 27 | stopx11vnc 28 | vnc_server_has_been_stopped 29 | ;; 30 | esac 31 | } 32 | ############ 33 | stopx11vnc() { 34 | pkill Xvfb 35 | rm -fv /tmp/.X233-lock /tmp/.X11-unix/X233 2>/dev/null 36 | } 37 | ########## 38 | tmoe_vnc_env() { 39 | export USER="$(whoami)" 40 | export HOME="${HOME}" 41 | #CURRENT_PORT=$(sed -n p /usr/local/bin/startvnc | grep '\-geometry' | awk -F ' ' '$0=$NF' | cut -d ':' -f 2 | tail -n 1) 42 | CURRENT_PORT=$(sed -n p /usr/local/bin/startvnc | grep 'TMOE_VNC_DISPLAY_NUMBER=' | cut -d '=' -f 2 | head -n 1) 43 | } 44 | ########### 45 | rm_vnc_lock() { 46 | vncserver -kill :${CURRENT_PORT} 2>/dev/null 47 | rm -vf /tmp/.X${CURRENT_PORT}-lock 2>/dev/null 48 | rm -vf /tmp/.X11-unix/X${CURRENT_PORT} 2>/dev/null 49 | } 50 | ############# 51 | rm_dbus_pid_file() { 52 | if [ $(command -v sudo) ]; then 53 | sudo rm -vf /run/dbus/pid /var/run/dbus/pid /run/dbus/messagebus.pid /run/messagebus.pid /var/run/dbus/messagebus.pid /var/run/messagebus.pid 2>/dev/null 54 | else 55 | su -c "rm -vf /run/dbus/pid /var/run/dbus/pid /run/dbus/messagebus.pid /run/messagebus.pid /var/run/dbus/messagebus.pid /var/run/messagebus.pid 2>/dev/null" 56 | fi 57 | } 58 | ############ 59 | stop_dbus_daemon() { 60 | case ${TMOE_CHROOT} in 61 | true) 62 | if [ -e "/run/dbus/pid" ]; then 63 | DBUS_PID=$(sed -n p /run/dbus/pid) 64 | printf "%s\n" "kill -9 ${DBUS_PID}" 65 | kill -9 ${DBUS_PID} 66 | rm_dbus_pid_file 67 | fi 68 | ;; 69 | esac 70 | #pkill dbus 71 | } 72 | ########## 73 | pkill_vnc() { 74 | pkill -9 Xtightvnc 75 | pkill -9 Xtigertvnc 76 | pkill -9 Xvnc 77 | pkill -9 vncsession 78 | } 79 | ############# 80 | vnc_server_has_been_stopped() { 81 | if [ ! "$(pgrep Xvnc)" ]; then 82 | printf "%s\n" "已停止VNC服务!" 83 | printf "%s\n" "VNC server has been terminated." 84 | fi 85 | } 86 | ################# 87 | stop_vnc_main "$@" 88 | -------------------------------------------------------------------------------- /tools/gui/vncserver-config-defaults: -------------------------------------------------------------------------------- 1 | ## Default settings for VNC servers started by the vncserver service 2 | # 3 | # Any settings given here will override the builtin defaults, but can 4 | # also be overriden by ~/.vnc/config and vncserver-config-mandatory. 5 | # 6 | # See the following manpages for more details: vncserver(1) Xvnc(1) 7 | # 8 | # Several common settings are shown below. Uncomment and modify to your 9 | # liking. 10 | 11 | securitytypes=vncauth,tlsvnc 12 | alwaysshared 13 | geometry=1440x720 14 | desktop=tmoe-linux 15 | verbose 16 | depth=16 17 | ZlibLevel=1 18 | ImprovedHextile 19 | CompareFB=1 20 | br 21 | wm 22 | deferglyphs=16 23 | retro 24 | once 25 | -------------------------------------------------------------------------------- /tools/gui/wsl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################################### 3 | if [ ! -e "/mnt/c/Users/Public/Downloads/pulseaudio/pulseaudio.bat" ]; then 4 | printf "%s\n" "正在为您下载windows版pulseaudio" 5 | printf "%s\n" "目录C:\Users\Public\Downloads\pulseaudio" 6 | mkdir -p /mnt/c/Users/Public/Downloads 7 | cd /mnt/c/Users/Public/Downloads 8 | rm -rf ./pulseaudio 2>/dev/null 9 | git clone -b pulseaudio --depth=1 https://gitee.com/mo2/wsl.git ./pulseaudio 10 | fi 11 | 12 | if [ ! -e "/mnt/c/Users/Public/Downloads/VcXsrv" ]; then 13 | if grep -q '172..*1' "/etc/resolv.conf"; then 14 | printf "%s\n" "检测到您当前使用的可能是WSL2,正在为您下载windows版VcXsrv" 15 | else 16 | printf "%s\n" "检测到您当前使用的可能是初代WSL,正在为您下载windows版VcXsrv" 17 | fi 18 | printf "%s\n" "目录C:\Users\Public\Downloads\VcXsrv" 19 | mkdir -p /mnt/c/Users/Public/Downloads 20 | cd /mnt/c/Users/Public/Downloads 21 | rm -rf ./.WSLXSERVERTEMPFILE 2>/dev/null 22 | git clone -b VcXsrv --depth=1 https://gitee.com/mo2/wsl.git ./.WSLXSERVERTEMPFILE 23 | mv ./.WSLXSERVERTEMPFILE/VcXsrv.tar.xz ./ 24 | tar -Jxvf VcXsrv.tar.xz 25 | rm -rf ./.WSLXSERVERTEMPFILE VcXsrv.tar.xz 26 | fi 27 | #######此处download iso 28 | if ! grep -q '172..*1' "/etc/resolv.conf"; then 29 | case ${TMOE_CHROOT} in 30 | true) 31 | printf "%s\n" "检测到您当前使用的是chroot容器,将不会自动调用Windows程序。" 32 | printf "%s\n" "请手动启动音频服务和X服务。" 33 | ;; 34 | esac 35 | printf "%s\n" "您当前使用的可能不是WSL2,部分功能无法正常运行。" 36 | CURRENTwinVersion=$(/mnt/c/WINDOWS/system32/cmd.exe /c "VER" 2>/dev/null | cut -d '.' -f 3 | tail -n 1) 37 | printf "%s\n" "您当前的系统版本为${CURRENTwinVersion}" 38 | if (("${CURRENTwinVersion}" >= '19041')); then 39 | cat <<-EOF 40 | 您需要以管理员身份打开Powershell,并输入dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart 41 | 重启PC,然后输入以下命令 42 | wsl --set-default-version 2 43 | wsl --set-version 当前发行版名称 2 44 | 您可以输wsl -l -v来获取发行版名称和版本号 45 | wsl -l -v 46 | 最后以管理员身份安装wsl_update_x64.msi(升级WSL2内核) 47 | EOF 48 | press_enter_to_continue 49 | else 50 | cat <<-EOF 51 | Do you want to download win10_2004_x64 iso and upgrade system?[Y/n] 52 | 您的宿主机系统版本低于10.0.19041,需要更新系统。 53 | 请在更新完系统后,以管理员身份打开Powershell,并输入dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart 54 | dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart 55 | wsl --set-default-version 2 56 | EOF 57 | /mnt/c/WINDOWS/system32/control.exe /name Microsoft.WindowsUpdate 58 | printf "%s\n" "-------------------------------" 59 | fi 60 | fi 61 | -------------------------------------------------------------------------------- /tools/gui/wsl_pulse_audio: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | printf '%s\n' '检测到您使用的是WSL,正在为您打开音频服务' 3 | export PULSE_SERVER=tcp:127.0.0.1 4 | cd "/mnt/c/Users/Public/Downloads/pulseaudio" 5 | /mnt/c/WINDOWS/system32/cmd.exe /c "start .\pulseaudio.bat" 6 | printf "%s\n" "若无法自动打开音频服务,则请手动在资源管理器中打开C:\Users\Public\Downloads\pulseaudio\pulseaudio.bat" 7 | if grep -q '172..*1' "/etc/resolv.conf"; then 8 | printf "%s\n" "检测到您当前使用的可能是WSL2" 9 | WSL2IP=$(sed -n p /etc/resolv.conf | grep nameserver | awk '{print $2}' | head -n 1) 10 | #sed -i "s/^export PULSE_SERVER=.*/export PULSE_SERVER=${WSL2IP}/g" ~/.vnc/xstartup 11 | export PULSE_SERVER=${WSL2IP} 12 | printf "%s\n" "已将您的音频服务ip修改为${WSL2IP}" 13 | fi 14 | sleep 2 15 | -------------------------------------------------------------------------------- /tools/gui/x11vncpasswd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | printf "%s\n" "Configuring x11vnc..." 3 | printf "%s\n" "正在配置x11vnc server..." 4 | read -sp "请输入6至8位密码,please type the new VNC password: " TMOE_X11_PASSWD 5 | if [ ! -e "${HOME}/.vnc" ]; then 6 | mkdir -p ${HOME}/.vnc 7 | fi 8 | x11vnc -storepasswd ${TMOE_X11_PASSWD} ${HOME}/.vnc/x11passwd 9 | -------------------------------------------------------------------------------- /tools/optimization/compress_pictures: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #################### 3 | image_compression_menu() { 4 | RETURN_TO_WHERE='image_compression_menu' 5 | SOFTWARE=$( 6 | whiptail --title "image_compression" --menu \ 7 | "TMOE批量压缩图片小工具,基于graphicsmagick-imagemagick-compat" 0 0 0 \ 8 | "1" "start 启动" \ 9 | "2" "install dependencies安装依赖" \ 10 | "3" "remove 卸载" \ 11 | "0" "🌚 Back to the main menu 返回主菜单" \ 12 | 3>&1 1>&2 2>&3 13 | ) 14 | case "${SOFTWARE}" in 15 | 0 | "") tmoe_multimedia_menu ;; 16 | 1) image_compression_tool_gui_or_tui ;; 17 | 2) 18 | DEPENDENCY_02='zenity' 19 | install_image_compression_tool 20 | ;; 21 | 3) remove_image_compression_tool ;; 22 | esac 23 | ############################################ 24 | press_enter_to_return 25 | image_compression_menu 26 | } 27 | ########### 28 | remove_image_compression_tool() { 29 | DEPENDENCY_01='ImageMagick imagemagick graphicsmagick-imagemagick-compat' 30 | DEPENDENCY_02='zenity' 31 | printf "%s\n" "${RED}${TMOE_REMOVAL_COMMAND}${RESET} ${BLUE}${DEPENDENCY_01} ${DEPENDENCY_02}${RESET}" 32 | do_you_want_to_continue 33 | ${TMOE_REMOVAL_COMMAND} ${DEPENDENCY_01} ${DEPENDENCY_02} 34 | } 35 | ########## 36 | install_image_compression_tool() { 37 | case ${LINUX_DISTRO} in 38 | debian) DEPENDENCY_01='graphicsmagick-imagemagick-compat' ;; 39 | redhat) DEPENDENCY_01='ImageMagick' ;; 40 | *) DEPENDENCY_01='imagemagick' ;; 41 | esac 42 | beta_features_quick_install 43 | } 44 | ############### 45 | fix_pic_folder_permissions() { 46 | if [ "${HOME}" != '/root' ]; then 47 | printf "%s\n" "chown -R ${CURRENT_USER_NAME}:${CURRENT_USER_GROUP} ${TMOE_COMPRESSION_FOLDER}" 48 | printf "%s\n" "正在将${TMOE_COMPRESSION_FOLDER}的权限修改为${CURRENT_USER_NAME}用户和${CURRENT_USER_GROUP}用户组" 49 | chown -R ${CURRENT_USER_NAME}:${CURRENT_USER_GROUP} ${TMOE_COMPRESSION_FOLDER} 50 | fi 51 | } 52 | ########### 53 | tui_image_compression_tool() { 54 | FILE_EXT_01='jpg' 55 | FILE_EXT_02='png' 56 | if [ -e "${HOME}/图片" ]; then 57 | START_DIR="${HOME}/图片" 58 | elif [ -e "${HOME}/Pictures" ]; then 59 | START_DIR="${HOME}/Pictures" 60 | else 61 | START_DIR="${HOME}" 62 | fi 63 | IMPORTANT_TIPS='任意选择一张图片,该文件夹内的所有图片都将被压缩' 64 | tmoe_file_manager 65 | if [ -z ${SELECTION} ]; then 66 | printf "%s\n" "没有指定${YELLOW}有效${RESET}的${BLUE}文件${GREEN},请${GREEN}重新${RESET}选择" 67 | else 68 | choose_the_pic_quality 69 | catimg ${TMOE_FILE_ABSOLUTE_PATH} 2>/dev/null 70 | printf "%s\n" "该文件夹内的${RED}所有图片${RESET}(不包含子目录) 都将被压缩" 71 | printf "%s\n" "压缩过的图片将保存至${FILE_PATH}/${TMOE_COMPRESSION_FOLDER}" 72 | do_you_want_to_continue 73 | compress_pics 74 | fi 75 | } 76 | ################# 77 | compress_pics() { 78 | cd ${FILE_PATH} 79 | if [ ! -e "${TMOE_COMPRESSION_FOLDER}" ]; then 80 | mkdir -p ${TMOE_COMPRESSION_FOLDER} 81 | fi 82 | for TMOE_PICS in *; do 83 | convert +profile "*" -strip -quality ${TARGET} ${TMOE_PICS} ${TMOE_COMPRESSION_FOLDER}/${TMOE_PICS%%.*}.jpg 84 | done 85 | printf "%s\n" "压缩完成。" 86 | fix_pic_folder_permissions 87 | ls -lah ${FILE_PATH}/${TMOE_COMPRESSION_FOLDER} 88 | xdg-open ${TMOE_COMPRESSION_FOLDER} 2>/dev/null 89 | } 90 | ############# 91 | choose_the_pic_quality() { 92 | TARGET=$(whiptail --inputbox "若数值为空,则自动调整为80" 0 50 --title "请输入图片质量(1-99)" 3>&1 1>&2 2>&3) 93 | if [ "$?" != "0" ]; then 94 | ${RETURN_TO_WHERE} 95 | elif [ -z "${TARGET}" ]; then 96 | TARGET='80' 97 | fi 98 | TMOE_COMPRESSION_FOLDER="tmoe_compression_quality_${TARGET}" 99 | } 100 | ################## 101 | image_compression_tool_gui_or_tui() { 102 | check_imagemagick 103 | if (whiptail --title "GUI or TUI" --yes-button "GUI" --no-button "TUI" --yesno "您是想用图形用户界面,还是文本用户界面呢?\nDo you want to use GUI or TUI?\n若您处于桌面环境下,则建议选择GUI,否则请选择TUI♪(^∇^*) " 0 0); then 104 | gui_image_compression_tool 105 | else 106 | tui_image_compression_tool 107 | fi 108 | } 109 | ################ 110 | check_imagemagick() { 111 | if [ ! $(command -v convert) ]; then 112 | DEPENDENCY_02='' 113 | install_image_compression_tool 114 | fi 115 | } 116 | ################# 117 | gui_image_compression_tool() { 118 | check_zenity 119 | PIC_DIR=$(zenity --title "请选择图片文件夹,并按确认键" --file-selection --directory) 120 | case "$?" in 121 | 0) cd ${PIC_DIR} ;; 122 | *) ${RETURN_TO_WHERE} ;; 123 | esac 124 | ######## 125 | zenity --question --title="tmoe-pic-compressor的提示o(* ̄▽ ̄*)o" --text="${PIC_DIR} 内的所有图片文件将被压缩!" --ok-label="好哒" --cancel-label="我知道啦" 126 | TARGET=$(zenity --scale --title="Picture quality图片质量" --text "1为最低,99为最高" --min-value=1 --max-value=99 --value=2 --step 2) 127 | case "$?" in 128 | 0) 129 | TMOE_COMPRESSION_FOLDER="tmoe_compression_quality_${TARGET}" 130 | if [ ! -e "${TMOE_COMPRESSION_FOLDER}" ]; then 131 | mkdir -p ${TMOE_COMPRESSION_FOLDER} 132 | fi 133 | xdg-open ${TMOE_COMPRESSION_FOLDER} 134 | ( 135 | printf "%s\n" "10" 136 | printf "%s\n" "40" 137 | sleep 1 138 | for TMOE_PICS in *; do 139 | convert +profile "*" -strip -quality ${TARGET} ${TMOE_PICS} ${TMOE_COMPRESSION_FOLDER}/${TMOE_PICS%%.*}.jpg 140 | done 141 | printf "%s\n" "100" 142 | sleep 1 143 | ) | zenity --progress --title="正在压缩图片..." --text="正在保存至${TMOE_COMPRESSION_FOLDER}" --percentage=0 --auto-close 144 | fix_pic_folder_permissions 145 | ls -lah ${PIC_DIR}/${TMOE_COMPRESSION_FOLDER} 146 | printf "%s\n" "文件已经保存至${BLUE}${PIC_DIR}/${TMOE_COMPRESSION_FOLDER}${RESET}" 147 | ;; 148 | *) ${RETURN_TO_WHERE} ;; 149 | esac 150 | } 151 | ########### 152 | image_compression_menu 153 | -------------------------------------------------------------------------------- /tools/other/frequently_asked_questions.sh: -------------------------------------------------------------------------------- 1 | frequently_asked_questions() { 2 | RETURN_TO_WHERE='frequently_asked_questions' 3 | DEPENDENCY_01='' 4 | 5 | #17 50 7 6 | TMOE_FAQ=$(whiptail --title "FAQ(よくある質問)" --menu \ 7 | "您有哪些疑问?\nWhat questions do you have?" 0 0 0 \ 8 | "1" "软件禁止以root权限运行" \ 9 | "2" "android chroot无法执行ping命令" \ 10 | "3" "修复xfce配置文件无法写入" \ 11 | "4" "无法连接至设置服务/电量信息为空" \ 12 | "5" "udisks2/gvfs配置失败" \ 13 | "6" "linuxQQ闪退" \ 14 | "7" "VNC/X11闪退" \ 15 | "8" "无法打开Baidu Netdisk" \ 16 | "9" "mlocate数据库初始化失败" \ 17 | "10" "TTY下中文字体乱码" \ 18 | "11" "Linux与win10双系统时间不一致" \ 19 | "0" "Back to the main menu 返回主菜单" \ 20 | 3>&1 1>&2 2>&3) 21 | ############################## 22 | case "${TMOE_FAQ}" in 23 | 0 | "") tmoe_linux_tool_menu ;; 24 | 1) 25 | notes_of_tmoe_sudo_01 26 | ;; 27 | 2) 28 | notes_of_tmoe_sudo_02 29 | ;; 30 | 3) 31 | printf "%s\n" "chown -Rv ${CURRENT_USER_NAME}:${CURRENT_USER_GROUP} ${HOME}/.config/xfce4" 32 | printf "%s\n" "若您遇到其他权限问题,还可以手动执行chown -Rv ${CURRENT_USER_NAME}:${CURRENT_USER_GROUP} ${HOME}" 33 | do_you_want_to_continue 34 | chown -Rv ${CURRENT_USER_NAME}:${CURRENT_USER_GROUP} ${HOME}/.config/xfce4 35 | ;; 36 | 4) 37 | printf "%s\n" "无法连接至设置服务跟dbus有关,请选择FAQ中的vnc/x11闪退选项。" 38 | printf "%s\n" "无法监控电池信息同样与dbus有关。" 39 | printf "%s\n" "请注意,proot容器可能无权启动dbus-daemon --system,请跳过本题。" 40 | printf "%s\n" "仅当TMOE_CHROOT变量的值为true时,即您使用的是tmoe-manager安装的chroot/docker容器,dbus-daemon才会自动启动。" 41 | printf "%s\n" "若您使用的非tmoe-linux容器,则需要手动启动。" 42 | printf "%s\n" "启动命令为sudo dbus-daemon --system --fork" 43 | printf "%s\n" "您可以输入rm /run/dbus/pid来删除pid文件。" 44 | ;; 45 | 5) 46 | printf "%s\n" "${YELLOW}按回车键卸载gvfs和udisks2${RESET}" 47 | RETURN_TO_WHERE='frequently_asked_questions' 48 | do_you_want_to_continue 49 | ${TMOE_REMOVAL_COMMAND} --allow-change-held-packages ^udisks2 ^gvfs 50 | ;; 51 | 6) 52 | printf "%s\n" "如果版本更新后登录出现闪退的情况,那么您可以输rm -rf ~/.config/tencent-qq/ 后重新登录。" 53 | printf "%s\n" "${YELLOW}按回车键自动执行上述命令${RESET}" 54 | RETURN_TO_WHERE='frequently_asked_questions' 55 | do_you_want_to_continue 56 | rm -rvf ~/.config/tencent-qq/ 57 | ;; 58 | 7) 59 | fix_vnc_dbus_launch 60 | ;; 61 | 8) 62 | can_not_open_baidu_netdisk 63 | ;; 64 | 9) 65 | printf "%s\n" "您是否需要卸载mlocate和catfish" 66 | printf "%s\n" "Do you want to remove mlocate and catfish?" 67 | do_you_want_to_continue 68 | ${TMOE_REMOVAL_COMMAND} mlocate catfish 69 | apt autopurge 2>/dev/null 70 | ;; 71 | 10) 72 | tty_chinese_code 73 | ;; 74 | 11) 75 | fix_linux_utc_timezone 76 | ;; 77 | esac 78 | ################## 79 | press_enter_to_return 80 | frequently_asked_questions 81 | } 82 | ############## 83 | notes_of_tmoe_sudo_01() { 84 | printf '%s\n' 'deb系创建用户的说明' 85 | printf "%s\n" "部分软件出于安全性考虑,禁止以root权限运行。权限越大,责任越大。若root用户不慎操作,将有可能破坏系统。" 86 | printf "%s\n" "您可以使用以下命令来新建普通用户" 87 | printf "%s\n" "#创建一个用户名为moe的新用户" 88 | printf "%s\n" "${YELLOW}adduser moe${RESET}" 89 | printf "%s\n" "#输入的密码是隐藏的,根据提示创建完成后,您可以在本工具内将该用户加入sudo用户组" 90 | #printf "%s\n" "#将moe加入到sudo用户组" 91 | #printf "%s\n" "${YELLOW}adduser moe sudo${RESET}" 92 | printf "%s\n" "之后,若需要提权,则只需输sudo 命令" 93 | printf "%s\n" "例如${YELLOW}sudo apt update${RESET}" 94 | printf "%s\n" "--------------------" 95 | printf "%s\n" "切换用户的说明" 96 | printf "%s\n" "您可以输${YELLOW}su - ${RESET}或${YELLOW}sudo su - ${RESET}亦或者是${YELLOW}sudo -i ${RESET}切换至root用户" 97 | printf "%s\n" "亦可输${YELLOW}su - moe${RESET}或${YELLOW}sudo -iu moe${RESET}切换回moe用户" 98 | printf "%s\n" "若需要以普通用户身份启动VNC,请先切换至普通用户,再输${YELLOW}startvnc${RESET}" 99 | printf '%s\n' '--------------------' 100 | printf '%s\n' 'arch系创建新用户的命令为useradd -m miku' 101 | printf '%s\n' '其中miku为用户名' 102 | printf '%s\n' '输passwd miku修改该用户密码' 103 | printf '%s\n' '如需将其添加至sudo用户组,那么您可以使用本工具自带的sudo用户组管理功能(位于秘密花园的系统管理选项)' 104 | printf '%s\n' '--------------------' 105 | } 106 | ############## 107 | notes_of_tmoe_sudo_02() { 108 | cat <<-EOF 109 | 在Android termux上运行的chroot容器(非proot),以root身份执行${GREEN}ping 127.0.0.1${RESET}可以能会遇到${RED}socket 权限不够 Permission denied${RESET}的问题 110 | 解决方法如下: 111 | 方法1: 112 | 输入${GREEN}newgrp aid_inet${RESET}切换到aid_inet用户组,该用户组具有安卓系统的联网权限。 113 | 方法2: 114 | 新建一名普通用户,再前往本工具的秘密花园的系统管理选项,将该用户添加至sudo用户组。 115 | 当检测到TMOE_CHROOT='true'时,将会自动把该用户加入aid_inet和aid_net_raw等用户组。 116 | 若您的宿主机为Android系统,则需要加入这些用户组。 117 | --------------- 118 | 若部分程序无法联网,则请将相关用户加入aid_inet用户组,例如${GREEN}usermod -a -G aid_inet mysql${RESET} 119 | EOF 120 | } 121 | ########### 122 | can_not_open_baidu_netdisk() { 123 | #printf "%s\n" "若无法打开,则请手动输rm -f ~/baidunetdisk/baidunetdiskdata.db" 124 | printf "%s\n" "若无法打开,则请手动输rm -rf ~/baidunetdisk" 125 | printf "%s\n" "按回车键自动执行${YELLOW}rm -vf ~/baidunetdisk/baidunetdiskdata.db${RESET}" 126 | RETURN_TO_WHERE='frequently_asked_questions' 127 | do_you_want_to_continue 128 | rm -vf ~/baidunetdisk/baidunetdiskdata.db 129 | } 130 | ############## 131 | fix_linux_utc_timezone() { 132 | timedatectl status 133 | printf "%s\n" "是否需要将硬件时钟设置为本地时区,并开启NTP时间同步?" 134 | printf "%s\n" "${GREEN}timedatectl set-local-rtc 1 --adjust-system-clock${RESET}" 135 | do_you_want_to_continue 136 | #timedatectl set-local-rtc true 137 | #hwclock --localtime --systohc 138 | if [ ! $(command -v ntpdate) ]; then 139 | DEPENDENCY_02='ntpdate' 140 | beta_features_quick_install 141 | fi 142 | if [ ! $(command -v chronyc) ]; then 143 | DEPENDENCY_02='chrony' 144 | beta_features_quick_install 145 | fi 146 | printf "%s\n" "正在与microsoft ntp时间同步服务器进行同步..." 147 | printf "%s\n" "${GREEN}ntpdate time.windows.com${RESET}" 148 | ntpdate time.windows.com 149 | printf "%s\n" "${GREEN}timedatectl set-ntp true${RESET}" 150 | printf "%s\n" "If you want to close it,then enter ${GREEN}timedatectl set-ntp false${RESET}" 151 | printf "%s\n" "正在配置时间自动同步服务..." 152 | timedatectl set-ntp true 153 | printf "%s\n" "${GREEN}systemctl enable chrony${RESET}" 154 | systemctl enable chrony 2>/dev/null || systemctl enable chronyd 2>/dev/null || rc-update add chrony 155 | printf "%s\n" "If you want to disable it,then enter ${GREEN}systemctl disable chrony${RESET}" 156 | printf "%s\n" "${GREEN}chronyc sourcestats -v${RESET}" 157 | chronyc sourcestats -v 158 | } 159 | ############## 160 | tty_chinese_code() { 161 | if (whiptail --title "您想要对这个小可爱执行哪项方案?" --yes-button 'fbterm' --no-button '修改$LANG' --yesno "目前有两种简单的解决方法(っ °Д °)\n前者提供了一个快速的终端仿真器,它直接运行在你的系统中的帧缓冲 (framebuffer) 之上;而后者则是修改语言变量。" 11 45); then 162 | if [ ! $(command -v fbterm) ]; then 163 | DEPENDENCY_01='fbterm' 164 | ${TMOE_INSTALLATION_COMMAND} ${DEPENDENCY_01} 165 | fi 166 | printf '%s\n' '若启动失败,则请手动执行fbterm' 167 | fbterm 168 | else 169 | export LANG='C.UTF-8' 170 | printf "%s\n" "请手动执行${GREEN}export LANG=C.UTF-8${RESET}" 171 | fi 172 | } 173 | ################ 174 | frequently_asked_questions 175 | -------------------------------------------------------------------------------- /tools/sources/deb-installer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #################### 3 | deb_batch_installer_tui_or_gui() { 4 | if (whiptail --title "GUI or TUI" --yes-button "GUI" --no-button "TUI" --yesno "您是想用图形用户界面,还是文本用户界面呢?\nDo you want to use GUI or TUI?\n若您处于桌面环境下,则建议选择GUI,否则请选择TUI♪(^∇^*) " 0 0); then 5 | gui_deb_batch_installer 6 | else 7 | tui_deb_batch_installer 8 | fi 9 | } 10 | ################# 11 | deb_installer_menu() { 12 | RETURN_TO_WHERE='deb_installer_menu' 13 | SOFTWARE=$( 14 | whiptail --title "TMOE-DEB-INSTALLER" --menu \ 15 | "软件包安装与卸载管理器" 0 0 0 \ 16 | "1" "batch-installation批量安装" \ 17 | "2" "单独安装并检测卸载命令" \ 18 | "0" "🌚 Back to the main menu 返回主菜单" \ 19 | 3>&1 1>&2 2>&3 20 | ) 21 | case "${SOFTWARE}" in 22 | 0 | "") tmoe_software_package_menu ;; 23 | 1) deb_batch_installer_tui_or_gui ;; 24 | 2) tmoe_deb_file_installer ;; 25 | esac 26 | ############################################ 27 | press_enter_to_return 28 | deb_installer_menu 29 | } 30 | ########### 31 | tmoe_deb_batch_installer_01() { 32 | DEPENDENCY_02="" 33 | for TMOE_DEB_FILE in *deb; do 34 | apt-cache show ./${TMOE_DEB_FILE} 35 | PACKAGE_NAME=$(apt-cache show ./${TMOE_DEB_FILE} 2>&1 | grep Package | head -n 1 | awk -F ' ' '$0=$NF') 36 | DEPENDENCY_01=${PACKAGE_NAME} 37 | apt install -y ./${TMOE_DEB_FILE} 38 | beta_features_install_completed 39 | done 40 | } 41 | ############# 42 | tmoe_deb_batch_installer_02() { 43 | DEPENDENCY_02="" 44 | for TMOE_DEB_FILE in *deb; do 45 | apt-cache show ./${TMOE_DEB_FILE} 46 | PACKAGE_NAME=$(apt-cache show ./${TMOE_DEB_FILE} 2>&1 | grep Package | head -n 1 | awk -F ' ' '$0=$NF') 47 | DEPENDENCY_01=${PACKAGE_NAME} 48 | apt install ./${TMOE_DEB_FILE} 49 | beta_features_install_completed 50 | done 51 | } 52 | ############# 53 | gui_deb_batch_installer() { 54 | check_zenity 55 | DEB_DIR=$(zenity --title "请选择deb文件所在目录,并按确认键,该目录下所有文件都将被安装。" --file-selection --directory) 56 | case "$?" in 57 | 0) cd ${DEB_DIR} ;; 58 | *) ${RETURN_TO_WHERE} ;; 59 | esac 60 | zenity --question --title="tmoe-deb-installer的提示o(* ̄▽ ̄*)o" --text="${DEB_DIR} 内的所有deb文件将被安装!" --ok-label="好哒" --cancel-label="我知道啦" 61 | cd ${DEB_DIR} 62 | tmoe_deb_batch_installer_01 63 | } 64 | ######### 65 | check_deb_file_start_dir() { 66 | if [ -e "${HOME}/下载" ]; then 67 | START_DIR="${HOME}/下载" 68 | elif [ -e "/var/cache/apt/archives" ]; then 69 | START_DIR="/var/cache/apt/archives" 70 | else 71 | START_DIR="${HOME}" 72 | fi 73 | } 74 | ############ 75 | tui_deb_batch_installer() { 76 | FILE_EXT_01='deb' 77 | FILE_EXT_02='DEB' 78 | check_deb_file_start_dir 79 | IMPORTANT_TIPS='任意选择一个deb包,该文件夹内的所有deb包都将被安装' 80 | tmoe_file_manager 81 | if [ -z ${SELECTION} ]; then 82 | printf "%s\n" "没有指定${YELLOW}有效${RESET}的${BLUE}文件${GREEN},请${GREEN}重新${RESET}选择" 83 | else 84 | cd ${FILE_PATH} 85 | file ${SELECTION} 86 | printf "%s\n" "${FILE_PATH}内的${RED}所有deb包${RESET}(不包含子目录) 都将被安装" 87 | do_you_want_to_continue 88 | tmoe_deb_batch_installer_02 89 | fi 90 | } 91 | ########### 92 | deb_file_installer() { 93 | #进入deb文件目录 94 | cd ${CURRENT_DIR} 95 | #./${SELECTION} 96 | case "${LINUX_DISTRO}" in 97 | "debian") 98 | file ./${SELECTION} 2>/dev/null 99 | apt-cache show ./${SELECTION} 100 | PACKAGE_NAME=$(apt-cache show ./${SELECTION} 2>&1 | grep Package | head -n 1 | awk -F ' ' '$0=$NF') 101 | printf "%s\n" "您是否需要安装此软件包?" 102 | printf "%s\n" "Do you want to install it?" 103 | if [ $(command -v ${PACKAGE_NAME}) ]; then 104 | printf "%s\n" "检测到您${RED}已安装${RESET}${BLUE}${PACKAGE_NAME}${RESET}" 105 | printf "%s\n" "如需卸载,请输${RED}apt purge${RESET} ${BLUE}${PACKAGE_NAME}${RESET}" 106 | printf "%s\n" "按${GREEN}回车键${RESET}${RED}重新安装${RESET}。" 107 | printf "%s\n" "输${YELLOW}n${RESET}返回并进入${BLUE}卸载菜单${RESET}" 108 | fi 109 | RETURN_TO_WHERE='remove_deb_package' 110 | do_you_want_to_continue 111 | RETURN_TO_WHERE='deb_installer_menu' 112 | apt install -y ./${SELECTION} 113 | DEPENDENCY_01=${PACKAGE_NAME} 114 | DEPENDENCY_02="" 115 | beta_features_install_completed 116 | ;; 117 | *) 118 | if [ ! $(command -v dpkg) ]; then 119 | DEPENDENCY_01='dpkg' 120 | DEPENDENCY_02='' 121 | printf "%s\n" "${TMOE_INSTALLATION_COMMAND} ${DEPENDENCY_01}" 122 | ${TMOE_INSTALLATION_COMMAND} ${DEPENDENCY_01} 123 | beta_features_install_completed 124 | fi 125 | if [ $(command -v dpkg) ]; then 126 | dpkg -i ./${SELECTION} 127 | else 128 | uncompress_deb_file 129 | fi 130 | ;; 131 | esac 132 | delete_tmoe_deb_file 133 | } 134 | ###################### 135 | uncompress_deb_file() { 136 | mkdir -p .DEB_TEMP_FOLDER 137 | mv ${SELECTION} .DEB_TEMP_FOLDER 138 | cd ./.DEB_TEMP_FOLDER 139 | ar xv ${SELECTION} 140 | mv ${SELECTION} ../ 141 | if [ -e "data.tar.xz" ]; then 142 | cd / 143 | tar -Jxvf ${CURRENT_DIR}/.DEB_TEMP_FOLDER/data.tar.xz ./usr 144 | elif [ -e "data.tar.gz" ]; then 145 | cd / 146 | tar -zxvf ${CURRENT_DIR}/.DEB_TEMP_FOLDER/data.tar.gz ./usr 147 | fi 148 | rm -rf ${CURRENT_DIR}/.DEB_TEMP_FOLDER 149 | } 150 | ######################## 151 | delete_tmoe_deb_file() { 152 | printf "%s\n" "请问是否需要${RED}删除${RESET}安装包文件" 153 | ls -lah ${TMOE_FILE_ABSOLUTE_PATH} 154 | printf "%s\n" "Do you want to ${RED}delete${RESET} it?" 155 | do_you_want_to_continue 156 | rm -fv ${TMOE_FILE_ABSOLUTE_PATH} 157 | } 158 | ################# 159 | remove_deb_package() { 160 | if (whiptail --title "您想要对这个小可爱做什么呢 " --yes-button "Back返回" --no-button "Remove移除" --yesno "${PACKAGE_NAME}\n您是想要返回还是卸载这个软件包?Do you want to return,or remove this package?♪(^∇^*) " 10 50); then 161 | deb_installer_menu 162 | else 163 | apt purge ${PACKAGE_NAME} 164 | delete_tmoe_deb_file 165 | deb_installer_menu 166 | fi 167 | } 168 | ############# 169 | tmoe_deb_file_installer() { 170 | FILE_EXT_01='deb' 171 | FILE_EXT_02='DEB' 172 | check_deb_file_start_dir 173 | IMPORTANT_TIPS='若您选中的是已安装的软件包,则将自动检测卸载命令' 174 | tmoe_file_manager 175 | if [ -z ${SELECTION} ]; then 176 | printf "%s\n" "没有指定${YELLOW}有效${RESET}的${BLUE}文件${GREEN},请${GREEN}重新${RESET}选择" 177 | else 178 | printf "%s\n" "您选择的deb文件为${TMOE_FILE_ABSOLUTE_PATH}" 179 | ls -lah ${TMOE_FILE_ABSOLUTE_PATH} 180 | deb_file_installer 181 | fi 182 | } 183 | ################## 184 | deb_installer_menu 185 | -------------------------------------------------------------------------------- /tools/sources/opt-bin/opt/Gridea/gridea: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/Gridea/app' 3 | export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) electron ${TMOE_BIN} --no-sandbox "$@" ;; 6 | *) 7 | electron ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) electron ${TMOE_BIN} --no-sandbox "$@" ;; 11 | esac 12 | ;; 13 | esac 14 | -------------------------------------------------------------------------------- /tools/sources/opt-bin/opt/draw.io/drawio: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/draw.io/app.asar' 3 | export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) electron ${TMOE_BIN} --no-sandbox "$@" ;; 6 | *) 7 | electron ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) electron ${TMOE_BIN} --no-sandbox "$@" ;; 11 | esac 12 | ;; 13 | esac 14 | -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/chord: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/chord' 3 | export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) electron ${TMOE_BIN} --no-sandbox "$@" ;; 6 | *) 7 | electron ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) electron ${TMOE_BIN} --no-sandbox "$@" ;; 11 | esac 12 | ;; 13 | esac 14 | -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/cocomusic: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | cd /opt/CocoMusic/dist/electron 3 | TMOE_PREFIX='dbus-launch' 4 | ELECTRON_BIN='/opt/electron-v8/electron' 5 | #2020.08 cocomusic linux-arm64需打防白屏补丁,还需要指定electron版本 6 | ####################### 7 | export ELECTRON_IS_DEV=0 8 | case "$(id -u)" in 9 | 0) ${TMOE_PREFIX} ${ELECTRON_BIN} main.js --no-sandbox "$@" ;; 10 | *) 11 | ${TMOE_PREFIX} ${ELECTRON_BIN} main.js "$@" 12 | case "$?" in 13 | 0) ;; 14 | *) ${TMOE_PREFIX} ${ELECTRON_BIN} main.js --no-sandbox "$@" ;; 15 | esac 16 | ;; 17 | esac 18 | -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/electron-netease-cloud-music: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/electron-netease-cloud-music/app.asar' 3 | export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) exec electron ${TMOE_BIN} --no-sandbox "$@" ;; 6 | *) 7 | exec electron ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) exec electron ${TMOE_BIN} --no-sandbox "$@" ;; 11 | esac 12 | ;; 13 | esac 14 | -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/iease-music: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/iease-music/dist' 3 | ELECTRON_BIN='/opt/electron-v8/electron' 4 | #ieasemusic需要指定electron版本 5 | ####################### 6 | export ELECTRON_IS_DEV=0 7 | case "$(id -u)" in 8 | 0) ${ELECTRON_BIN} ${TMOE_BIN} --no-sandbox "$@" ;; 9 | *) 10 | ${ELECTRON_BIN} ${TMOE_BIN} "$@" 11 | case "$?" in 12 | 0) ;; 13 | *) ${ELECTRON_BIN} ${TMOE_BIN} --no-sandbox "$@" ;; 14 | esac 15 | ;; 16 | esac 17 | -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/listen1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/Listen1/app' 3 | export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) electron ${TMOE_BIN} --no-sandbox "$@" ;; 6 | *) 7 | electron ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) electron ${TMOE_BIN} --no-sandbox "$@" ;; 11 | esac 12 | ;; 13 | esac -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/lossless-cut: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/lossless-cut' 3 | export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) electron ${TMOE_BIN} --no-sandbox "$@" ;; 6 | *) 7 | electron ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) electron ${TMOE_BIN} --no-sandbox "$@" ;; 11 | esac 12 | ;; 13 | esac -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/lx-music-desktop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/lx-music-desktop' 3 | cd ${TMOE_BIN} 4 | export ELECTRON_IS_DEV=0 5 | case "$(id -u)" in 6 | 0) electron ${TMOE_BIN} --no-sandbox "$@" ;; 7 | *) 8 | electron ${TMOE_BIN} "$@" 9 | case "$?" in 10 | 0) ;; 11 | *) electron ${TMOE_BIN} --no-sandbox "$@" ;; 12 | esac 13 | ;; 14 | esac 15 | -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/marktext: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/marktext' 3 | export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) electron ${TMOE_BIN} --no-sandbox "$@" ;; 6 | *) 7 | electron ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) electron ${TMOE_BIN} --no-sandbox "$@" ;; 11 | esac 12 | ;; 13 | esac 14 | -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/netron: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/netron' 3 | export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) electron ${TMOE_BIN} --no-sandbox "$@" ;; 6 | *) 7 | electron ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) electron ${TMOE_BIN} --no-sandbox "$@" ;; 11 | esac 12 | ;; 13 | esac -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/petal: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/petal/build/main.js' 3 | export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) electron ${TMOE_BIN} --no-sandbox "$@" ;; 6 | *) 7 | electron ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) electron ${TMOE_BIN} --no-sandbox "$@" ;; 11 | esac 12 | ;; 13 | esac -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/picgo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/picgo/app.asar' 3 | export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) electron ${TMOE_BIN} --no-sandbox "$@" ;; 6 | *) 7 | electron ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) electron ${TMOE_BIN} --no-sandbox "$@" ;; 11 | esac 12 | ;; 13 | esac -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/simplenote: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/simplenote' 3 | export ELECTRON_IS_DEV=0 4 | case "$(id -u)" in 5 | 0) electron ${TMOE_BIN} --no-sandbox "$@" ;; 6 | *) 7 | electron ${TMOE_BIN} "$@" 8 | case "$?" in 9 | 0) ;; 10 | *) electron ${TMOE_BIN} --no-sandbox "$@" ;; 11 | esac 12 | ;; 13 | esac -------------------------------------------------------------------------------- /tools/sources/opt-bin/usr/bin/zy-player: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | TMOE_BIN='/opt/zy-player/app.asar' 3 | ELECTRON_BIN='/opt/electron-v8/electron' 4 | export ELECTRON_IS_DEV=0 5 | case "$(id -u)" in 6 | 0) ${ELECTRON_BIN} ${TMOE_BIN} --no-sandbox "$@" ;; 7 | *) 8 | ${ELECTRON_BIN} ${TMOE_BIN} "$@" 9 | case "$?" in 10 | 0) ;; 11 | *) ${ELECTRON_BIN} ${TMOE_BIN} --no-sandbox "$@" ;; 12 | esac 13 | ;; 14 | esac 15 | -------------------------------------------------------------------------------- /tools/virtualization/anbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ##################### 3 | install_anbox() { 4 | cat <<-'EndOfFile' 5 | WARNING!本软件需要安装内核模块补丁,且无法保证可以正常运行! 6 | 您亦可使用以下补丁,并将它们构建为模块。 7 | https://salsa.debian.org/kernel-team/linux/blob/master/debian/patches/debian/android-enable-building-ashmem-and-binder-as-modules.patch 8 | https://salsa.debian.org/kernel-team/linux/blob/master/debian/patches/debian/export-symbols-needed-by-android-drivers.patch 9 | 若模块安装失败,则请前往官网阅读说明https://docs.anbox.io/userguide/install_kernel_modules.html 10 | 如需卸载该模块,请手动输apt purge -y anbox-modules-dkms 11 | EndOfFile 12 | do_you_want_to_continue 13 | DEPENDENCY_01='' 14 | case "${LINUX_DISTRO}" in 15 | "debian") 16 | case "${DEBIAN_DISTRO}" in 17 | "ubuntu") 18 | add-apt-repository ppa:morphis/anbox-support 19 | apt update 20 | apt install anbox-modules-dkms 21 | apt install linux-headers-generic 22 | ;; 23 | *) 24 | REPO_URL='http://ppa.launchpad.net/morphis/anbox-support/ubuntu/pool/main/a/anbox-modules/' 25 | GREP_NAME='all' 26 | download_ubuntu_ppa_deb_model_01 27 | ;; 28 | esac 29 | modprobe ashmem_linux 30 | modprobe binder_linux 31 | ls -1 /dev/{ashmem,binder} 32 | DEPENDENCY_02='anbox' 33 | beta_features_quick_install 34 | ;; 35 | "arch") 36 | DEPENDENCY_01='anbox-modules-dkms-git' 37 | DEPENDENCY_02='anbox-git' 38 | beta_features_quick_install 39 | ;; 40 | *) 41 | non_debian_function 42 | ;; 43 | esac 44 | if [[ -n $(command -v anbox) && ! -f "/var/lib/anbox/android.img" ]]; then 45 | download_anbox_rom 46 | fi 47 | service anbox-container-manager start 48 | printf "%s\n" "service anbox-container-manager start" 49 | service anbox-container-manager start || systemctl start anbox-container-manager 50 | service anbox-container-manager status || systemctl status anbox-container-manager 51 | printf '%s\n' 'anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity' 52 | printf '%s\n' 'Do you want to start it?' 53 | do_you_want_to_continue 54 | anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity 55 | } 56 | ########### 57 | download_anbox_rom() { 58 | lsmod | grep -e ashmem_linux -e binder_linux 59 | ls -lh /dev/binder /dev/ashmem 60 | anbox check-features 61 | case "${ARCH_TYPE}" in 62 | "amd64") THE_LATEST_ISO_LINK="https://build.anbox.io/android-images/2018/07/19/android_amd64.img" ;; 63 | "arm64") THE_LATEST_ISO_LINK="https://build.anbox.io/android-images/2017/08/04/android_1_arm64.img" ;; 64 | esac 65 | printf "%s\n" "${THE_LATEST_ISO_LINK}" 66 | do_you_want_to_continue 67 | aria2c --no-conf --allow-overwrite=true -s 16 -x 16 -k 1M "${THE_LATEST_ISO_LINK}" 68 | } 69 | ############# 70 | install_anbox 71 | -------------------------------------------------------------------------------- /tools/virtualization/vbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ##################### 3 | debian_add_virtual_box_gpg() { 4 | if [ "${DEBIAN_DISTRO}" = 'ubuntu' ]; then 5 | VBOX_RELEASE='focal' 6 | else 7 | VBOX_RELEASE='buster' 8 | fi 9 | curl -Lv https://www.virtualbox.org/download/oracle_vbox_2016.asc | apt-key add - 10 | cd /etc/apt/sources.list.d/ 11 | sed -i 's/^deb/# &/g' virtualbox.list 12 | printf "%s\n" "deb http://mirrors.bfsu.edu.cn/virtualbox/apt/ ${VBOX_RELEASE} contrib" >>virtualbox.list 13 | } 14 | ############### 15 | get_debian_vbox_latest_url() { 16 | TUNA_VBOX_LINK='https://mirrors.bfsu.edu.cn/virtualbox/apt/pool/contrib/v/' 17 | LATEST_VBOX_VERSION=$(curl -L ${TUNA_VBOX_LINK} | grep 'virtualbox-' | tail -n 1 | cut -d '=' -f 3 | cut -d '"' -f 2) 18 | 19 | if [ "${DEBIAN_DISTRO}" = 'ubuntu' ]; then 20 | DOCKER_RELEASE='Ubuntu' 21 | else 22 | DOCKER_RELEASE='Debian' 23 | fi 24 | 25 | DOCKER_TUNA_CODE_LIST=$(curl -L ${TUNA_VBOX_LINK}${LATEST_VBOX_VERSION} | grep ${DOCKER_RELEASE} | grep link | awk -F 'title=' '{print $2}' | cut -d '"' -f 2 | sed 's@\.deb@@') 26 | DOCKER_LIST=$(printf "%s\n" $DOCKER_TUNA_CODE_LIST | sed "s@\$@ .deb@g" | tr '\n' ' ') 27 | LATEST_VBOX_FILE=$( 28 | whiptail --title "DISTRO CODE & VBOX VERSION" --menu \ 29 | "Which version do you want to choose?" 0 0 0 \ 30 | ${DOCKER_LIST} \ 31 | "Back" "🌚 返回" \ 32 | 3>&1 1>&2 2>&3 33 | ) 34 | VBOX_DEB_FILE_URL="${TUNA_VBOX_LINK}${LATEST_VBOX_VERSION}${LATEST_VBOX_FILE}.deb" 35 | printf "%s\n" "获取到vbox的最新链接为${VBOX_DEB_FILE_URL},是否下载并安装?" 36 | RETURN_TO_WHERE='beta_features' 37 | do_you_want_to_continue 38 | cd /tmp 39 | curl -Lo .Oracle_VIRTUAL_BOX.deb "${VBOX_DEB_FILE_URL}" 40 | apt-cache show ./.Oracle_VIRTUAL_BOX.deb 41 | apt install -y ./.Oracle_VIRTUAL_BOX.deb 42 | rm -fv ./.Oracle_VIRTUAL_BOX.deb 43 | } 44 | ################ 45 | install_debian_virtual_box() { 46 | if [ ! $(command -v virtualbox) ]; then 47 | get_debian_vbox_latest_url 48 | else 49 | printf "%s\n" "检测到您已安装virtual box,是否将其添加到软件源?" 50 | RETURN_TO_WHERE='beta_features' 51 | do_you_want_to_continue 52 | debian_add_virtual_box_gpg 53 | fi 54 | } 55 | ############# 56 | install_virtual_box_qt() { 57 | DEPENDENCY_01="virtualbox-qt" 58 | DEPENDENCY_02="virtualbox-ext-pack" 59 | beta_features_quick_install 60 | } 61 | ############## 62 | debian_download_latest_vbox_deb() { 63 | if (whiptail --title "VirtualBox" --yes-button 'virtualbox-qt' --no-button 'virtualbox' --yesno "Which software do you want to install?" 0 50); then 64 | install_virtual_box_qt 65 | else 66 | install_debian_virtual_box 67 | fi 68 | } 69 | ############# 70 | redhat_add_virtual_box_repo() { 71 | cat >/etc/yum.repos.d/virtualbox.repo <<-'EndOFrepo' 72 | [virtualbox] 73 | name=Virtualbox Repository 74 | baseurl=https://mirrors.bfsu.edu.cn/virtualbox/rpm/el$releasever/ 75 | gpgcheck=0 76 | enabled=1 77 | EndOFrepo 78 | } 79 | ################ 80 | install_virtual_box() { 81 | case "${ARCH_TYPE}" in 82 | "amd64") ;; 83 | *) arch_does_not_support ;; 84 | esac 85 | 86 | if [ ! $(command -v gpg) ]; then 87 | DEPENDENCY_01="" 88 | DEPENDENCY_02="gpg" 89 | beta_features_quick_insta 90 | #linux-headers 91 | fi 92 | DEPENDENCY_02="virtualbox-qt" 93 | DEPENDENCY_01="virtualbox" 94 | #apt remove docker docker-engine docker.io 95 | if [ "${LINUX_DISTRO}" = 'debian' ]; then 96 | debian_download_latest_vbox_deb 97 | #$(#lsb_release -cs) 98 | elif [ "${LINUX_DISTRO}" = 'redhat' ]; then 99 | redhat_add_virtual_box_repo 100 | elif [ "${LINUX_DISTRO}" = 'arch' ]; then 101 | DEPENDENCY_01="virtualbox virtualbox-guest-iso" 102 | DEPENDENCY_02="virtualbox-ext-oracle" 103 | printf "%s\n" "您可以在安装完成后,输usermod -G vboxusers -a 当前用户名称" 104 | printf "%s\n" "将当前用户添加至vboxusers用户组" 105 | fi 106 | printf "%s\n" "您可以输modprobe vboxdrv vboxnetadp vboxnetflt来加载内核模块" 107 | beta_features_quick_install 108 | if [ "${LINUX_DISTRO}" = 'arch' ]; then 109 | printf "%s\n" "usermod -G vboxusers -a ${CURRENT_USER_NAME}" 110 | do_you_want_to_continue 111 | usermod -G vboxusers -a ${CURRENT_USER_NAME} 112 | fi 113 | #################### 114 | if [ ! $(command -v virtualbox) ]; then 115 | printf "%s\n" "检测到virtual box安装失败,是否将其添加到软件源?" 116 | RETURN_TO_WHERE='beta_features' 117 | do_you_want_to_continue 118 | debian_add_virtual_box_gpg 119 | beta_features_quick_install 120 | fi 121 | } 122 | ################### 123 | install_virtual_box 124 | -------------------------------------------------------------------------------- /tools/virtualization/virt-menu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ####################### 3 | qemu_main() { 4 | case "$1" in 5 | -x64qemu) 6 | start_tmoe_qemu_tool 7 | ;; 8 | -arm64qemu) 9 | start_tmoe_qemu_aarch64_manager 10 | ;; 11 | -m | *) 12 | install_container_and_virtual_machine 13 | ;; 14 | esac 15 | } 16 | ############ 17 | qemu_system_menu() { 18 | RETURN_TO_WHERE='qemu_system_menu' 19 | DEPENDENCY_01='' 20 | VIRTUAL_TECH=$( 21 | whiptail --title "qemu-system" --menu "您想要选择哪一项呢?" 0 0 0 \ 22 | "1" "tmoe-qemu:x86_64/i386虚拟机管理" \ 23 | "2" "virt-manager(GUI虚拟机管理器)" \ 24 | "3" "aqemu(QEMU和KVM的Qt5前端)" \ 25 | "4" "gnome-boxes(简单地管理远程和本地虚拟系统)" \ 26 | "0" "🌚 Return to previous menu 返回上级菜单" \ 27 | 3>&1 1>&2 2>&3 28 | ) 29 | ############# 30 | case ${VIRTUAL_TECH} in 31 | 0 | "") install_container_and_virtual_machine ;; 32 | 1) start_tmoe_qemu_tool ;; 33 | 2) DEPENDENCY_02='virt-manager' ;; 34 | 3) DEPENDENCY_02='aqemu' ;; 35 | 4) DEPENDENCY_02='gnome-boxes' ;; 36 | esac 37 | #未安装额外软件包,qemu-block-extra 38 | case ${VIRTUAL_TECH} in 39 | 1) ;; 40 | *) beta_features_quick_install ;; 41 | esac 42 | ############### 43 | press_enter_to_return 44 | qemu_system_menu 45 | } 46 | ############# 47 | start_tmoe_qemu_tool() { 48 | source ${TMOE_TOOL_DIR}/virtualization/qemu/tmoe-qemu 49 | } 50 | virtual_machine_iso_file() { 51 | source ${TMOE_TOOL_DIR}/virtualization/iso.sh 52 | } 53 | install_container_and_virtual_machine() { 54 | RETURN_TO_WHERE='install_container_and_virtual_machine' 55 | VIRTUAL_TECH=$( 56 | whiptail --title "虚拟化与api的转换" --menu "Which option do you want to choose?" 0 0 0 \ 57 | "1" "💻 qemu:开源、跨平台的虚拟机" \ 58 | "2" "📀 iso/qcow2:下载镜像(linux,win10)" \ 59 | "3" "🐳 docker:开源的应用容器引擎" \ 60 | "4" "🖥️ VirtualBox(甲骨文开源虚拟机x64)" \ 61 | "5" "🍷 wine:调用win api并即时转换" \ 62 | "6" "🥡 anbox(Android in a box)" \ 63 | "0" "🌚 Return to previous menu 返回上级菜单" \ 64 | "00" "Back to the main menu 返回主菜单" \ 65 | 3>&1 1>&2 2>&3 66 | ) 67 | ############# 68 | case ${VIRTUAL_TECH} in 69 | 0 | "") beta_features ;; 70 | 00) tmoe_linux_tool_menu ;; 71 | 1) qemu_system_menu ;; 72 | 2) virtual_machine_iso_file ;; 73 | 3) tmoe_docker_menu ;; 74 | 4) install_virtual_box ;; 75 | 5) wine_menu ;; 76 | 6) install_anbox ;; 77 | esac 78 | ############### 79 | press_enter_to_return 80 | install_container_and_virtual_machine 81 | } 82 | #"4" "OpenMediaVault(基于debian的NAS网络连接存储解决方案)" \ 83 | #4) install_open_media_vault ;; 84 | ##################### 85 | qemu_main "$@" 86 | -------------------------------------------------------------------------------- /tools/virtualization/wine32.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ##################### 3 | install_dxvk() { 4 | DEPENDENCY_01='dxvk' 5 | DEPENDENCY_02='wine-development' 6 | beta_features_quick_install 7 | dxvk-setup i -s || dxvk-setup i -d 8 | dxvk-setup 9 | } 10 | ########### 11 | wine_dependencies() { 12 | DEPENDENCY_01='wine winetricks q4wine' 13 | DEPENDENCY_02='playonlinux wine32' 14 | case "${LINUX_DISTRO}" in 15 | "debian") 16 | case "${DEBIAN_DISTRO}" in 17 | "ubuntu") DEPENDENCY_01='wine winetricks q4wine' ;; 18 | esac 19 | if [ "${INSTALL_WINE}" = "true" ]; then 20 | dpkg --add-architecture i386 21 | apt update 22 | apt install winetricks-zh wine64 23 | else 24 | apt purge winetricks-zh 25 | fi 26 | ;; 27 | "arch") 28 | DEPENDENCY_01='winetricks-zh' 29 | DEPENDENCY_02='playonlinux5-git q4wine' 30 | ;; 31 | esac 32 | } 33 | ########## 34 | install_wine64() { 35 | INSTALL_WINE='true' 36 | wine_dependencies 37 | beta_features_quick_install 38 | case "${ARCH_TYPE}" in 39 | "i386") ;; 40 | *) 41 | cat <<-'EOF' 42 | 如需完全卸载wine,那么您还需要移除i386架构的软件包。 43 | aptitude remove ~i~ri386 44 | dpkg --remove-architecture i386 45 | apt update 46 | EOF 47 | ;; 48 | esac 49 | } 50 | ######### 51 | wine_menu() { 52 | RETURN_TO_WHERE='wine_menu' 53 | 54 | VIRTUAL_TECH=$( 55 | whiptail --title "WINE" --menu "Wine is not an emulator" 0 50 0 \ 56 | "1" "install安装" \ 57 | "2" "remove卸载" \ 58 | "3" "wine-dxvk(将DirectX转换为Vulkan api)" \ 59 | "4" "wine-wechat微信" \ 60 | "0" "🌚 Return to previous menu 返回上级菜单" \ 61 | 3>&1 1>&2 2>&3 62 | ) 63 | ############# 64 | case ${VIRTUAL_TECH} in 65 | 0 | "") install_container_and_virtual_machine ;; 66 | 1) install_wine64 ;; 67 | 2) remove_wine_bin ;; 68 | 3) install_dxvk ;; 69 | 4) install_wine_wechat ;; 70 | esac 71 | ############### 72 | press_enter_to_return 73 | wine_menu 74 | } 75 | ########## 76 | remove_wine_bin() { 77 | case "${ARCH_TYPE}" in 78 | "i386") ;; 79 | *) 80 | printf '%s\n' 'dpkg --remove-architecture i386' 81 | printf '%s\n' '正在移除对i386软件包的支持' 82 | #apt purge ".*:i386" 83 | aptitude remove ~i~ri386 84 | dpkg --remove-architecture i386 85 | apt update 86 | ;; 87 | esac 88 | INSTALL_WINE='false' 89 | wine_dependencies 90 | printf "%s\n" "${TMOE_REMOVAL_COMMAND} ${DEPENDENCY_01} ${DEPENDENCY_02}" 91 | ${TMOE_REMOVAL_COMMAND} ${DEPENDENCY_01} ${DEPENDENCY_02} 92 | } 93 | ############ 94 | install_wine_wechat() { 95 | cat <<-'EOF' 96 | 微信安装包将下载/tmp目录 97 | 若安装失败,请手动执行wine /tmp/WeChatSetup.exe 98 | https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe 99 | 建议您在安装完成后执行winecfg,并选择“函数库”.接着添加riched20,最后选择"原装先于内建"。 100 | EOF 101 | cd /tmp 102 | if [ ! -e "WeChatSetup.exe" ]; then 103 | aria2c --no-conf --allow-overwrite=true -s 5 -x 5 -k 1M -o WeChatSetup.exe 'https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe' 104 | fi 105 | sudo -iu master wine /tmp/WeChatSetup.exe 106 | sudo -iu ${CURRENT_USER_NAME} winetricks riched20 107 | sudo -iu ${CURRENT_USER_NAME} winecfg 108 | } 109 | ################ 110 | wine_menu 111 | -------------------------------------------------------------------------------- /zsh.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ################### 3 | tmoe_container_zsh_main() { 4 | case "$1" in 5 | *) 6 | check_tmoe_linux_tool 7 | copy_git_status 8 | configure_tmoe_zsh 9 | check_ps_command 10 | creat_zlogin_file 11 | fix_sudo 12 | git_clone_tmoe_linux 13 | ;; 14 | esac 15 | } 16 | ############ 17 | check_tmoe_linux_tool() { 18 | if [ ! $(command -v debian-i) ]; then 19 | if [ -e "/usr/bin/curl" ]; then 20 | curl -Lo /usr/local/bin/debian-i 'https://raw.githubusercontent.com/2moe/tmoe-linux/master/tool.sh' 21 | else 22 | wget -qO /usr/local/bin/debian-i 'https://raw.githubusercontent.com/2moe/tmoe-linux/master/tool.sh' 23 | fi 24 | fi 25 | chmod 777 /usr/local/bin/debian-i 26 | mkdir -p /run/dbus 27 | } 28 | ############## 29 | copy_git_status() { 30 | if [ -e "/etc/gitstatus" ]; then 31 | mkdir -p ${HOME}/.cache 32 | cp -rf /etc/gitstatus ${HOME}/.cache 33 | fi 34 | } 35 | ################ 36 | check_ps_command() { 37 | ps -e &>/dev/null 38 | if [ "$?" != '0' ]; then 39 | TERMUX_BIN_PATH='/data/data/com.termux/files/usr/bin/' 40 | if [ -e "${TERMUX_BIN_PATH}/ps" ]; then 41 | ln -s ${TERMUX_BIN_PATH}/ps /usr/local/bin/ps 2>/dev/null 42 | ln -s ${TERMUX_BIN_PATH}/pstree /usr/local/bin/pstree 2>/dev/null 43 | fi 44 | fi 45 | } 46 | ########## 47 | configure_tmoe_zsh() { 48 | #此处不要source脚本 49 | TMOE_ZSH_TOOL_BIN=/usr/local/bin/zsh-i 50 | TMOE_ZSH_SCRIPT_URL='https://raw.githubusercontent.com/2moe/tmoe-zsh/master/zsh.sh' 51 | if [ -e "${HOME}/zsh-i" ]; then 52 | bash ${HOME}/zsh-i --tmoe_container_automatic_configure 53 | elif [ -e "${TMOE_ZSH_TOOL_BIN}" ]; then 54 | chmod +x ${TMOE_ZSH_TOOL_BIN} 55 | bash ${TMOE_ZSH_TOOL_BIN} --tmoe_container_automatic_configure 56 | else 57 | if [ -e "/usr/bin/curl" ]; then 58 | curl -Lo ${TMOE_ZSH_TOOL_BIN} ${TMOE_ZSH_SCRIPT_URL} 59 | else 60 | wget -O ${TMOE_ZSH_TOOL_BIN} ${TMOE_ZSH_SCRIPT_URL} 61 | fi 62 | chmod 777 ${TMOE_ZSH_TOOL_BIN} 63 | bash ${TMOE_ZSH_TOOL_BIN} --tmoe_container_automatic_configure 64 | fi 65 | } 66 | ############ 67 | creat_zlogin_file() { 68 | cd ${HOME} 69 | cp .bash_login .zlogin 70 | sed -i '/source ~\/\.profile/d' .zlogin 71 | } 72 | ######################### 73 | fix_sudo() { 74 | cat <<-EOF 75 | 少女祈禱中... 76 | 現在可公開的情報: 77 | ${BOLD}Tmoe-linux 小提示06${RESET}: 78 | 79 | 在${YELLOW}Android-termux${RESET}上运行的GNU/Linux的Tmoe-linux tool支持使用${BLUE}触摸屏${RESET}上下滑动。 80 | 运行于termux${YELLOW}原系统${RESET}的Tmoe-linux manager支持使用${BLUE}触摸屏${RESET}进行点击,还支持使用${GREEN}数字键${RESET}进行快速跳转,但${RED}不支持${RESET}使用触摸屏上下滑动。 81 | ------------------- 82 | You can use the ${BLUE}touch screen${RESET} on ${YELLOW}Android-termux${RESET} to slide the menu options of the tmoe-linux tool. 83 | ------------------- 84 | 07:容器的启动命令是${GREEN}debian${RESET}!o( =•ω•= )m 85 | ------------------- 86 | You can type ${GREEN}debian${RESET} to start and attach the ${BLUE}container${RESET}. 87 | ------------------- 88 | EOF 89 | ################## 90 | if [ -e "/usr/bin/sudo" ]; then 91 | chmod 4755 /usr/bin/sudo 92 | elif [ -e "/bin/sudo" ]; then 93 | chmod 4755 /bin/sudo 94 | fi 95 | ################## 96 | if [ -f "/tmp/.openwrtcheckfile" ]; then 97 | ADMINACCOUNT="$(ls -l /home | grep ^d | head -n 1 | awk -F ' ' '$0=$NF')" 98 | cp -rf /root/.z* /root/.oh-my-zsh /root/*sh /home/${ADMINACCOUNT} 99 | rm -f /tmp/.openwrtcheckfile 100 | fi 101 | ######################## 102 | cat <<-ENDOFTTMOEZSH 103 | All optimization steps have been completed, enjoy it! 104 | zsh配置完成,即将为您启动Tmoe-linux工具 105 | 您也可以手动输${YELLOW}tmoe t${RESET}进入 106 | Tmoe-linux tool will be launched. 107 | You can also type ${GREEN}tmoe t${RESET} to start it. 108 | ENDOFTTMOEZSH 109 | ########### 110 | if grep -q 'SUSE' /etc/os-release; then 111 | printf "%s\n" "zypper in -y yast2 yast2-packager" 112 | zypper in -y yast2 yast2-packager 113 | fi 114 | } 115 | ######################## 116 | sed_a_debian_testing_source() { 117 | #sed -i "$ r ${TMOE_MIRROR_DIR}/debian/sources.list;s@testing@${BACKPORTCODE}@g" ${SOURCE_LIST} 118 | cp -f ${TMOE_MIRROR_DIR}/debian/sources.list /tmp 119 | sed -i "s@testing@${BACKPORTCODE}@g" /tmp/sources.list 120 | sed -i '$ r /tmp/sources.list' ${SOURCE_LIST} 121 | } 122 | ######### 123 | sed_a_source_list() { 124 | SOURCE_LIST='/etc/apt/sources.list' 125 | MIRROR_LIST='/etc/pacman.d/mirrorlist' 126 | SOURCELISTCODE=$(sed -n p /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2 | head -n 1) 127 | if egrep -q 'debian|ubuntu' /etc/os-release; then 128 | SOURCELISTCODE=$(sed -n p /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2 | head -n 1) 129 | BACKPORTCODE=$(sed -n p /etc/os-release | grep PRETTY_NAME | head -n 1 | cut -d '=' -f 2 | cut -d '"' -f 2 | awk -F ' ' '$0=$NF' | cut -d '/' -f 1 | cut -d '(' -f 2 | cut -d ')' -f 1) 130 | if grep -q 'Debian' /etc/issue 2>/dev/null; then 131 | if ! grep -q '#Official' ${SOURCE_LIST}; then 132 | if [ $(command -v lsb_release) ]; then 133 | if [ "$(lsb_release -r | awk '{print $2}' | awk -F '/' '{print $1}')" = 'unstable' ]; then 134 | sed -i "$ r ${TMOE_MIRROR_DIR}/debian/sid.list" ${SOURCE_LIST} 135 | else 136 | sed_a_debian_testing_source 137 | fi 138 | else 139 | sed_a_debian_testing_source 140 | fi 141 | elif grep -q "ubuntu" /etc/os-release; then 142 | case $(uname -m) in 143 | i*86 | x86_64) 144 | #sed -i "$ r ${TMOE_MIRROR_DIR}/ubuntu/amd64/sources.list;s@focal@${SOURCELISTCODE}@g" ${SOURCE_LIST} 145 | cp -f ${TMOE_MIRROR_DIR}/ubuntu/amd64/sources.list /tmp 146 | sed -i "s@focal@${SOURCELISTCODE}@g" /tmp/sources.list 147 | sed -i '$ r /tmp/sources.list' ${SOURCE_LIST} 148 | ;; 149 | esac 150 | fi 151 | fi 152 | elif grep -q 'Arch' /etc/issue 2>/dev/null; then 153 | if ! grep -q '## Worldwide' ${MIRROR_LIST}; then 154 | case $(uname -m) in 155 | i*86 | x86_64) sed -i "$ r ${TMOE_MIRROR_DIR}/arch/x86_64/mirrorlist" ${MIRROR_LIST} ;; 156 | *) sed -i "$ r ${TMOE_MIRROR_DIR}/arch/aarch64/mirrorlist" ${MIRROR_LIST} ;; 157 | esac 158 | fi 159 | fi 160 | } 161 | ############### 162 | git_clone_tmoe_linux() { 163 | TMOE_LINUX_DIR='/usr/local/etc/tmoe-linux' 164 | TMOE_GIT_DIR="${TMOE_LINUX_DIR}/git" 165 | TMOE_SHARE_DIR="${TMOE_GIT_DIR}/share" 166 | TMOE_MIRROR_DIR="${TMOE_SHARE_DIR}/configuration/mirror-list" 167 | mkdir -p ${TMOE_LINUX_DIR} 168 | TMOE_GIT_URL='https://github.com/2moe/tmoe-linux.git' 169 | printf "%s\n" "github.com/2moe/tmoe-linux" 170 | if [ ! -e "${TMOE_GIT_DIR}/.git" ]; then 171 | rm -rv ${TMOE_GIT_DIR} 2>/dev/null 172 | git clone --depth=1 ${TMOE_GIT_URL} ${TMOE_GIT_DIR} 173 | fi 174 | ###################### 175 | #TMOE_LANG=$(head -n 1 ${TMOE_LINUX_DIR}/locale.txt) 176 | if [ -e "/etc/os-release" ]; then 177 | sed_a_source_list 178 | fi 179 | if [ ! -e "${HOME}/.face" ]; then 180 | cp -v ${TMOE_GIT_DIR}/.mirror/icon.png ${HOME}/.face 181 | ln -svf ${HOME}/.face ${HOME}/.face.icon 182 | fi 183 | mkdir -p /usr/share/applications 184 | cp ${TMOE_GIT_DIR}/tools/app/lnk/tmoe-linux.desktop /usr/share/applications 185 | #exec zsh & 186 | if [ ! $(command -v tmoe) ]; then 187 | ln -sf ${TMOE_GIT_DIR}/share/app/tmoe /usr/local/bin 188 | fi 189 | bash /usr/local/bin/debian-i 190 | exec zsh -l 191 | } 192 | ################### 193 | tmoe_container_zsh_main "$@" 194 | --------------------------------------------------------------------------------