Giter Club home page Giter Club logo

lemoe's Introduction

[中文|EN]

About lemoe

lemoe is short for lemon moe (🍋萌)

This project is inspired by tmoe.

But unlike tmoe:

  • this project is aimed to provide an easy-to-use command-line tool to build and deploy Linux distributions within termux, with a single command.
  • this project provides interfaces for integrating applications, allowing you to automatically integrate your apps during the build process, after which you can easily redistribute the image.

Features:

  • Lemoe deploys and starts up a Linux distribution with X11 with one single command: bash lemoe.sh
  • Lemoe uses termux:x11 for better graphical performance, in comparison to VNC.
  • Lemoe focuses on productivity, it pre-installs chromium, vscode, fcitx5, etc.
  • Lemoe can backup / restore distribution images and user's profile easily.

Quick Start

  1. Install Termux or ZeroTermux app from your favourite app store.

  2. Install the latest termux-x11 app from offical release

  3. Clone this repo

Clone the repo to the Download folder on your device. Step 5 is based on this assumuption.

git clone https://github.com/lesca/lemoe.git
  1. Download distro base image

You can download the base image and put it into the lemoe/backups folder.

Optionally, you can build your own image by running lemoe.sh build.

  1. Your first run
termux-change-repo && pkg install termux-am && termux-setup-storage && ln -sf storage/downloads/lemoe && bash lemoe/lemoe.sh

Tip

Documents and Download folders are mounted at /media folder for quick access.

Usage

Command Reference

Command Description Defaults
lemoe.sh Start X11. By default, it starts debian, and login as Lemoe. You can change this by lemoe.sh config
lemoe.sh config distro <distro> Config distro. Default is debian. Configuration file is .lemoe.
lemoe.sh config user <user> Config distro user. Default is Lemoe. Configuration file is .lemoe.
lemoe.sh config dpi <num> Config distro DPI by specifying a number. 200 is recommended for a 2.5~3K display. Default is 200.
lemoe.sh build Build custom image. Default distro is debian. You can change this by lemoe.sh config.
lemoe.sh reset Remove the configured distro from installation location. You can restore or build it later. By default, it removes the distro configured in .lemoe.
lemoe.sh backup Backup distro base image, distro profile and termux profile respectively. For more information, refer to the backup page. By default, it saves backups as below:
distro image: backups/$DISTRO-base-yyyyMMdd-hhmmss.tar.gz
distro profile: backups/$DISTRO-profile-yyyyMMdd-hhmmss.tar.gz.
termux profile: backups/termux-profile-yyyyMMdd-hhmmss.tar.gz.
lemoe.sh restore Restore distro base image and distro profile respectively. For more information, refer to the backup page. By default, it looks for the following files:
distro image: backups/$DISTRO-base.tar.gz
distro profile: backups/$DISTRO-profile.tar.gz.
lemoe.sh login [user_name] Login configured distribution in command line (bash) mode as root. By default, login user is root.
lemoe.sh lazypack Pack the current project to a lazy pack immediately, saved as zip file. Default pack name is as lemoe-$DISTRO-yyyyMMdd-hhmmss.zip.
Default pack directory is ../lazy-packs-lemoe.

Build your own image

Make sure you have good Internet connectivity to github, and run below command:

bash lemoe.sh build

By default, the Linux distribution is Debian and the user name is Lemoe.

If you want different ones, run configure before build:

To configure the distribution:

bash lemoe.sh config distro <archlinux|debian>

To configure the user name:

bash lemoe.sh config user <your_name>

The configuration is saved to .lemoe.

Development Guide

Add a new app

General Steps

You can add your own application into the corresponding distribution folder, e.g., debian or archlinux.

To add a new app, follow the steps below:

  1. Create a script file named xx_app.sh where xx is a two-digits prefix, lower nubmer higher priority; app is the name of the application.
  2. Define the installation steps in the install_app() function within the script.
  3. (Optional) Define the user configuration for the application in the setup_user_app() function within the script.

Example

Let's take the ime app for example. It's defined in this file: lemoe/debian/02_ime.sh.

  • install_ime() is the funcation to install the app. It runs as root.
    • You should replace the ime with your own application name.
    • You can call it with lemoe.sh install_ime for testing purpose.
    • During the build progress, it's called automatically.
  • setup_user_ime() is the function to setup the app during the user creation process. It runs as the distro user, by default it is Lemoe.
    • You should replace the ime with your own application name.
    • You can call it with lemoe.sh setup_user_ime for testing purpose.
    • During the user creation process, it's called automatically.
# install software
install_ime() {
    PKGS="fcitx5 fcitx5-chinese-addons fcitx5-material-color"
    $DISTRO_LOGIN -- apt install -y $PKGS

    # export to environment
    if ! grep -q "XMODIFIERS" $DISTRO_ROOTFS/etc/environment; then
        echo "GTK_IM_MODULE=fcitx" >> $DISTRO_ROOTFS/etc/environment
        echo "QT_IM_MODULE=fcitx" >> $DISTRO_ROOTFS/etc/environment
        echo "XMODIFIERS=@im=fcitx" >> $DISTRO_ROOTFS/etc/environment
    fi
}

# post user setup after installation
setup_user_ime() {
    # auto start
    $DISTRO_LOGIN --user $DISTRO_USER -- bash -c "mkdir -p ~/.config/autostart && cp /usr/share/applications/org.fcitx.Fcitx5.desktop ~/.config/autostart"
}

Troubleshooting

No sound

Try the following:

  1. Completely close termux and start again

  2. If you are using Bluetooth headphone, disable bluetooth and try abvoe again.

This is known issue, that the playback won't work if the BT audio device is connected and idle.

  1. If still not working, run below command:
bash lemoe.sh fix_audio

This changes the pulseaudio module from load-module module-sles-sink to load-module module-aaudio-sink.

This works for HUAWEI devices, and is automatically applied during your fisrt run.

For other devices, it worth a try.

Note

Remember to close termux completely and start over again.

Process completed (singal 9)

Run below commands in adb shell to unrestrict the process number limits:

device_config set_sync_disabled_for_tests persistent
device_config put activity_manager max_phantom_processes 2147483647

lemoe's People

Contributors

lesca avatar

Stargazers

XiaoYeZi avatar  avatar  avatar  avatar  avatar Alpaca avatar Matrixer Xu avatar

Watchers

 avatar

lemoe's Issues

chromium无法运行,vs-code也找不到

设备是华为matpad air
安装后运行bash run-archlinux.sh,chromium无法运行,也找不到vs-code,最后一段安装日志如下:

proot warning: can't sanitize binding "/data/data/com.termux/files/home/something": No such file or directory
Done.
Installing vscode ...
fatal: destination path '/data/data/com.termux/files/usr/tmp/vscode' already exists and is not an empty directory.
proot warning: can't sanitize binding "/data/data/com.termux/files/home/something": No such file or directory
==> Making package: visual-studio-code-bin 1.89.0-2 (Wed 08 May 2024 01:37:30 PM CST)
==> Checking runtime dependencies...
==> Installing missing dependencies...

 resolving dependencies...
looking for conflicting packages...

Packages (1) lsof-4.99.3-2

Total Download Size:   0.13 MiB
Total Installed Size:  0.39 MiB

:: Proceed with installation? [Y/n]
:: Retrieving packages...
 lsof-4.99.3-2-aarch64                                                       132.6 KiB   227 KiB/s 00:01 [##############################################################] 100%
(1/1) checking keys in keyring                                                                           [##############################################################] 100%
(1/1) checking package integrity                                                                         [##############################################################] 100%
(1/1) loading package files                                                                              [##############################################################] 100%
(1/1) checking for file conflicts                                                                        [##############################################################] 100%
(1/1) checking available disk space                                                                      [##############################################################] 100%
:: Processing package changes...
(1/1) installing lsof                                                                                    [##############################################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found code.desktop
  -> Found code-url-handler.desktop
  -> Found visual-studio-code-workspace.xml
  -> Found visual-studio-code-bin.sh
  -> Found code_arm64_1.89.0.tar.gz
==> Validating source files with sha256sums...
    code.desktop ... Passed
    code-url-handler.desktop ... Passed
    visual-studio-code-workspace.xml ... Passed
    visual-studio-code-bin.sh ... Passed
==> Validating source_aarch64 files with sha256sums...
    code_arm64_1.89.0.tar.gz ... Passed
==> Extracting sources...
  -> Extracting code_arm64_1.89.0.tar.gz with bsdtar
==> Removing existing $pkgdir/ directory...
==> Entering fakeroot environment...
semop(2): encountered an error: Success
sed: can't read /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/archlinux/usr/share/applications/code.desktop: No such file or directory

运行日志如下:

~/.../downloads/lemoe $ bash run-archlinux.sh
Starting x11 for archlinux ...
Starting: Intent { cmp=com.termux.x11/.MainActivity }
proot warning: can't sanitize binding "/data/data/com.termux/files/home/something": No such file or directory
_IceTransmkdir: Owner of /tmp/.ICE-unix should be set to root
gpg-agent[12632]: directory '/home/lemoe/.gnupg' created
gpg-agent[12632]: directory '/home/lemoe/.gnupg/private-keys-v1.d' created
gpg-agent[12633]: gpg-agent (GnuPG) 2.4.5 started

(xfwm4:12634): xfwm4-WARNING **: 13:40:49.751: Another compositing manager is running on screen 0
I2024-05-08 13:40:51.401546 instance.cpp:1373] Override Enabled Addons: {}
I2024-05-08 13:40:51.402378 instance.cpp:1374] Override Disabled Addons: {}
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
E2024-05-08 13:40:51.439550 waylandmodule.cpp:239] Failed to open wayland connection
I2024-05-08 13:40:51.439628 addonmanager.cpp:193] Loaded addon wayland
I2024-05-08 13:40:51.521578 xcbconnection.cpp:189] Connecting to X11 display, display name::1.0.
I2024-05-08 13:40:51.532481 addonmanager.cpp:193] Loaded addon xcb

(xfdesktop:12714): GLib-GObject-CRITICAL **: 13:40:51.536: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
I2024-05-08 13:40:51.540885 addonmanager.cpp:193] Loaded addon quickphrase
I2024-05-08 13:40:51.545237 addonmanager.cpp:193] Loaded addon clipboard
I2024-05-08 13:40:51.546971 addonmanager.cpp:193] Loaded addon imselector
I2024-05-08 13:40:51.561649 addonmanager.cpp:193] Loaded addon keyboard
I2024-05-08 13:40:51.563361 addonmanager.cpp:193] Loaded addon waylandim
I2024-05-08 13:40:51.566333 addonmanager.cpp:193] Loaded addon unicode
I2024-05-08 13:40:51.571174 addonmanager.cpp:193] Loaded addon pinyinhelper
I2024-05-08 13:40:51.578842 addonmanager.cpp:193] Loaded addon dbus

(xfdesktop:12714): GLib-GIO-WARNING **: 13:40:51.587: Error creating IO channel for /proc/self/mountinfo: Operation not permitted (g-io-error-quark, 14)
I2024-05-08 13:40:51.612724 addonmanager.cpp:193] Loaded addon fcitx4frontend

(polkit-gnome-authentication-agent-1:12725): polkit-gnome-1-WARNING **: 13:40:51.627: Error getting authority: Error initializing authority: Could not connect: No such file or directory
I2024-05-08 13:40:51.633117 addonmanager.cpp:193] Loaded addon ibusfrontend
I2024-05-08 13:40:51.645556 addonmanager.cpp:193] Loaded addon xim
I2024-05-08 13:40:51.652942 addonmanager.cpp:193] Loaded addon dbusfrontend
I2024-05-08 13:40:51.739347 inputmethodmanager.cpp:189] Found 734 input method(s) in addon keyboard
I2024-05-08 13:40:51.739934 inputmethodmanager.cpp:116] No valid input method group in configuration. Building a default one
I2024-05-08 13:40:51.741217 instance.cpp:375] Items in Default: [InputMethodGroupItem(keyboard-us,layout=)]
I2024-05-08 13:40:51.741272 instance.cpp:380] Generated groups: [Default]
I2024-05-08 13:40:51.791472 addonmanager.cpp:193] Loaded addon kimpanel
I2024-05-08 13:40:51.793112 addonmanager.cpp:193] Loaded addon vi rtualkeyboard
xfce4-panel-Message: 13:40:51.804: Plugin "(null)-7" was not found and has been removed from the configuration
xfce4-panel-Message: 13:40:51.820: Plugin "power-manager-plugin-9" was not found and has been removed from the configuration

** (xfdesktop:12714): WARNING **: 13:40:51.901: Failed to get system bus: Could not connect: No such file or directory
I2024-05-08 13:40:52.006560 classicui.cpp:64] Created classicui for x11 display::1.0
I2024-05-08 13:40:52.008025 addonmanager.cpp:193] Loaded addon classicui
I2024-05-08 13:40:52.014949 addonmanager.cpp:193] Loaded addon notificationitem
I2024-05-08 13:40:52.017956 addonmanager.cpp:193] Loaded addon notifications
I2024-05-08 13:40:52.145848 dbusmodule.cpp:790] Service name change: org.fcitx.Fcitx5  :1.15
I2024-05-08 13:40:52.169139 kimpanel.cpp:116] Kimpanel new owner:
I2024-05-08 13:40:52.170277 virtualkeyboard.cpp:216] VirtualKeyboard new owner:
E2024-05-08 13:40:52.171991 portalsettingmonitor.cpp:115] DBus call error: org.freedesktop.DBus.Error.ServiceUnknown The name org.freedesktop.portal.Desktop was not provided by any .service files

(xfce4-session:12591): xfce4-session-WARNING **: 13:40:53.018: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)

(xfce4-session:12591): xfce4-session-WARNING **: 13:40:53.026: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)

(xfce4-session:12591): xfce4-session-WARNING **: 13:40:53.037: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)
[12950:12950:0508/134116.176953:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /usr/lib/chromium/chrome-sandbox is owned by root and has mode 4755.
[12959:12959:0508/134116.306997:ERROR:file_path_watcher_inotify.cc(890)] Failed to read /proc/sys/fs/inotify/max_user_watches
[12959:12959:0100/000000.315359:ERROR:zygote_linux.cc(672)] write: Broken pipe (32)

关于xfce中文问题

[Lemoe@localhost ~]$ echo $LANG
zh_CN.UTF-8
[Lemoe@localhost ~]$ locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
[Lemoe@localhost ~]$
arch系统
按照官方文档都设置好了 但是始终是英文环境 问下大佬有解决方案吗

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.