diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100755 index 0000000..bf6dc32 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: Build and Release + +on: + push: + branches: [ "main", "unit-test" ] + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + TARGET: aarch64-unknown-linux-musl + BINARY_NAME: autolinux + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Install Rust Toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ env.TARGET }} + + - name: Install Cross + run: cargo install cross + + - name: Build Release (Musl Static) + run: cross build --target ${{ env.TARGET }} --release + + - name: Prepare Artifact + run: | + mv target/${{ env.TARGET }}/release/${{ env.BINARY_NAME }} ${{ env.BINARY_NAME }}-aarch64 + echo "Artifact ready: ${{ env.BINARY_NAME }}-aarch64" + + - name: Upload Rolling Release + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: false + title: "Latest Build (Auto-generated)" + files: | + ${{ env.BINARY_NAME }}-aarch64 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100755 index 0000000..7a13270 --- /dev/null +++ b/README.md @@ -0,0 +1,97 @@ +# Auto-Linux (Rust Edition) + +![Build Status](https://img.shields.io/github/actions/workflow/status/HanSoBored/Auto-Linux/build.yml?branch=main) +![Language](https://img.shields.io/badge/language-Rust-orange) +![Platform](https://img.shields.io/badge/platform-Android%20(Root)-green) +![License](https://img.shields.io/badge/license-MIT-blue) + +**Auto-Linux** is a standalone, lightweight, and blazing fast Linux installer/manager for Android, written entirely in **Rust**. It provides a beautiful Terminal User Interface (TUI) to install, configure, and manage Ubuntu chroots without requiring Termux, Busybox, or external dependencies. + +> **Built for speed, stability, and ease of use.** + +--- + +## Key Features + +* **Native & Standalone:** Compiled as a static binary (`musl`). Zero dependencies. No Termux needed. +* **Beautiful TUI:** Powered by `ratatui`. Keyboard-driven dashboard. +* **Instant Launch:** Switch users and enter Chroot directly from the dashboard. +* **Auto-Configuration:** + * **Network:** Auto-detects DNS and fixes connection issues inside chroot. + * **Users:** Auto-creates User & Password during setup. + * **Sudo:** Auto-configures `sudo` (wheel group) privileges. + * **Mounts:** Handles `/dev`, `/proc`, `/sys`, `/sdcard` binding automatically. +* **Distribution Support:** Ubuntu 20.04 LTS up to 26.04. +* **Root Detection:** Supports Magisk, KernelSU, and APatch natively. + +--- + +## Screenshots + +Preview: +![preview 1](https://raw.githubusercontent.com/HanSoBored/Auto-Linux/main/preview/preview1.jpg) + +![preview 2](https://raw.githubusercontent.com/HanSoBored/Auto-Linux/main/preview/preview2.jpg) + +![preview 3](https://raw.githubusercontent.com/HanSoBored/Auto-Linux/main/preview/preview3.jpg) + + +--- + +## Installation + +### Option 1: One-Line Install. +Run this command in **Termux**, **ADB Shell**, or any Terminal Emulator: + +```bash +curl -sL https://raw.githubusercontent.com/HanSoBored/Auto-Linux/master/install.sh | sh +``` + +> **Note:** This script automatically detects if you have Termux installed and creates a shortcut. You can then simply type `autolinux` to start. + +### Option 2: Manual Install +1. Download the latest binary from [Releases](https://github.com/HanSoBored/Auto-Linux/releases). +2. Push to device: `adb push autolinux-aarch64 /data/local/tmp/autolinux` +3. Permission: `chmod +x /data/local/tmp/autolinux` +4. Run: `/data/local/tmp/autolinux` + +--- + +## Build from Source + +You need **Rust** and **Cross** (for cross-compiling to Android/ARM64 Musl). + +1. **Install Prerequisites**: + ```bash + cargo install cross + ``` +2. **Build Release**: + ```bash + # Static binary (Musl) ensures it runs on any Android version + cross build --target aarch64-unknown-linux-musl --release + ``` +3. **Locate Binary**: + The binary will be in `target/aarch64-unknown-linux-musl/release/autolinux`. + +--- + +## Contributing + +Contributions are welcome! +1. Fork the project +2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) +3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) +4. Push to the Branch (`git push origin feature/AmazingFeature`) +5. Open a Pull Request + +--- + +## Disclaimer + +This tool modifies system partitions (mounting) and creates files in `/data`. While safe, **I am not responsible for any bricked devices or data loss.** Always backup your data. + +--- + +## License + +Distributed under the MIT License. See `LICENSE` for more information. diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..fb87450 --- /dev/null +++ b/install.sh @@ -0,0 +1,114 @@ +#!/system/bin/sh + +REPO="HanSoBored/Auto-Linux" +BINARY_NAME="autolinux" +RELEASE_FILE="autolinux-aarch64" + +SYSTEM_PATH="/data/local/bin" +USER_PATH="$HOME/.local/bin" + +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +RED='\033[0;31m' +NC='\033[0m' + +echo -e "${GREEN}=== AutoLinux Installer ===${NC}" + +find_temp_dir() { + if [ -n "$TMPDIR" ] && [ -w "$TMPDIR" ]; then + echo "$TMPDIR" + return + fi + + if [ -d "/data/data/com.termux/files/usr/tmp" ] && [ -w "/data/data/com.termux/files/usr/tmp" ]; then + echo "/data/data/com.termux/files/usr/tmp" + return + fi + + if [ -w "$HOME" ]; then + echo "$HOME" + return + fi + + if [ -d "/data/local/tmp" ] && [ -w "/data/local/tmp" ]; then + echo "/data/local/tmp" + return + fi + + echo "." +} + +TMP_DIR=$(find_temp_dir) +TARGET_TMP="$TMP_DIR/$BINARY_NAME-tmp" + +echo "[*] Working directory: $TMP_DIR" + +DOWNLOAD_URL="https://github.com/$REPO/releases/latest/download/$RELEASE_FILE" + +echo "[*] Downloading binary..." +if [ -x "$(command -v curl)" ]; then + curl -L --fail "$DOWNLOAD_URL" -o "$TARGET_TMP" +elif [ -x "$(command -v wget)" ]; then + wget -O "$TARGET_TMP" "$DOWNLOAD_URL" +else + echo -e "${RED}[!] Error: curl atau wget tidak ditemukan.${NC}" + exit 1 +fi + +if [ ! -f "$TARGET_TMP" ]; then + echo -e "${RED}[!] Gagal download.${NC}" + exit 1 +fi + +chmod +x "$TARGET_TMP" + +INSTALLED_PATH="" + +if [ "$(id -u)" = "0" ]; then + echo "[*] Running as Root. Installing to System Path..." + mkdir -p "$SYSTEM_PATH" + mv "$TARGET_TMP" "$SYSTEM_PATH/$BINARY_NAME" + INSTALLED_PATH="$SYSTEM_PATH/$BINARY_NAME" + +elif command -v su >/dev/null 2>&1; then + echo -e "${YELLOW}[?] Root access detected.${NC}" + echo " Attempting to install to system path ($SYSTEM_PATH)..." + echo " (Please grant Root permission on your device prompt)" + + if su -c "mkdir -p $SYSTEM_PATH && cp $TARGET_TMP $SYSTEM_PATH/$BINARY_NAME && chmod 755 $SYSTEM_PATH/$BINARY_NAME"; then + echo -e "${GREEN}[OK] Successfully installed as Root!${NC}" + rm "$TARGET_TMP" + INSTALLED_PATH="$SYSTEM_PATH/$BINARY_NAME" + + TERMUX_BIN="/data/data/com.termux/files/usr/bin" + if [ -d "$TERMUX_BIN" ]; then + su -c "ln -sf $SYSTEM_PATH/$BINARY_NAME $TERMUX_BIN/$BINARY_NAME" + fi + else + echo -e "${RED}[!] Root permission denied/failed.${NC}" + echo " Falling back to User installation..." + fi +fi + +if [ -z "$INSTALLED_PATH" ]; then + echo "[*] Installing to User Path ($USER_PATH)..." + mkdir -p "$USER_PATH" + mv "$TARGET_TMP" "$USER_PATH/$BINARY_NAME" + INSTALLED_PATH="$USER_PATH/$BINARY_NAME" + + case ":$PATH:" in + *":$USER_PATH:"*) ;; + *) + echo -e "${YELLOW}[!] Warning: $USER_PATH is not in your PATH.${NC}" + echo " Add this to your .bashrc/.zshrc:" + echo " export PATH=\"\$PATH:$USER_PATH\"" + ;; + esac +fi + +echo "" +echo -e "${GREEN}=== Installation Complete ===${NC}" +echo "Location: $INSTALLED_PATH" +echo "Run using command:" +echo -e "${GREEN} $BINARY_NAME${NC}" +echo "" \ No newline at end of file diff --git a/preview/preview1.jpg b/preview/preview1.jpg new file mode 100755 index 0000000..7d8079c Binary files /dev/null and b/preview/preview1.jpg differ diff --git a/preview/preview2.jpg b/preview/preview2.jpg new file mode 100755 index 0000000..d0958f1 Binary files /dev/null and b/preview/preview2.jpg differ diff --git a/preview/preview3.jpg b/preview/preview3.jpg new file mode 100755 index 0000000..c0486ca Binary files /dev/null and b/preview/preview3.jpg differ