├── .github
├── FUNDING.yml
└── workflows
│ ├── build_image_uboot.yaml
│ └── build_image_uefi.yaml
├── .gitignore
├── README.md
├── arch-installer
├── config
├── acu_config.yaml
├── boot.yaml
├── desktop.yaml
├── kernel.yaml
├── language.yaml
├── postinstall.yaml
└── repo.yaml
├── create-installation-media
├── examples
└── install_example.yaml
├── scripts
├── README.md
├── arch-bootstrap-chroot
├── asahi
│ ├── asahi-installer
│ ├── installer_data.json
│ └── os-package-tool
├── get-installer
└── init-setup.sh
└── tools
├── README.md
└── arch-rock-config
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: kwankiu # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 |
--------------------------------------------------------------------------------
/.github/workflows/build_image_uboot.yaml:
--------------------------------------------------------------------------------
1 | name: Build Arch Linux Installer (U-Boot + Extlinux)
2 |
3 | # Controls when the workflow will run
4 | on:
5 | push:
6 | tags:
7 | - 'b*'
8 |
9 | # Allows you to run this workflow manually from the Actions tab
10 | workflow_dispatch:
11 |
12 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
13 | jobs:
14 | build:
15 | # The type of runner that the job will run on
16 | runs-on: ubuntu-latest
17 | name: Build Images
18 | permissions:
19 | contents: write
20 |
21 | strategy:
22 | matrix:
23 | model_name:
24 | # Generic
25 | #- generic
26 | # Raspberry Pi
27 | - raspberrypi
28 | # Radxa
29 | - radxa-rock-2 #rock-2f & e20c shares rock-2a u-boot
30 | - radxa-rock-3a
31 | - radxa-rock-3b
32 | - radxa-rock-3c
33 | - radxa-rock-pi-4a
34 | - radxa-rock-pi-4a-plus
35 | - radxa-rock-pi-4b
36 | - radxa-rock-pi-4b-plus
37 | - radxa-rock-pi-4c
38 | - radxa-rock-4c-plus
39 | - radxa-rock-4se
40 | - radxa-rock-5a
41 | - radxa-rock-5b
42 | - radxa-rock-5b-plus
43 | - radxa-rock-5c
44 | - radxa-rock-5d
45 | - radxa-rock-5-itx
46 | - radxa-cm3-io
47 | - radxa-cm3-rpi-cm4-io
48 | - radxa-cm3-sodimm-io
49 | #- radxa-cm3i-io
50 | #- radxa-e23
51 | #- radxa-e25
52 | - radxa-cm5-io
53 | - radxa-cm5-rpi-cm4-io
54 | - radxa-nx5-io
55 | #- radxa-zero
56 | #- radxa-zero-2pro
57 | - radxa-zero3
58 | # Khadas
59 | - khadas-edge
60 | - khadas-edge2
61 | #- khadas-vim3
62 | #- khadas-vim4
63 | # Orange Pi
64 | - orangepi-5
65 | - orangepi-5b
66 | - orangepi-5-plus
67 | - orangepi-5-pro
68 | - orangepi-5-max
69 | - orangepi-cm5
70 | #- orangepi-3b
71 | # Nano Pi
72 | - nanopc-t6
73 | - nanopi-r6c
74 | - nanopi-r6s
75 | #- nanopi-cm3588
76 | # Other Rockchip RK35XX
77 | #- indiedroid-nova #9tripod-rk3588s
78 | #- mixtile-blade3 #rockchip-rk3588-blade3-v101-linux
79 | #- mixtile-core3588e
80 | #- embedfire-lubancat-4 #rockchip-rk3588s-lubancat-4
81 | #- turing-rk1
82 | - armsom-sige7 #rockchip-rk3588-armsom-sige7
83 | - armsom-aim7 #rockchip-rk3588-armsom-aim7
84 | - armsom-w3 #rockchip-rk3588-armsom-w3
85 | # Others
86 | # Add more models as needed
87 |
88 | steps:
89 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
90 | - name: Checkout Repository
91 | uses: actions/checkout@v2
92 |
93 | - name: Preparing
94 | run: |
95 | for model in ${{ matrix.model_name }}; do
96 | echo "Building image for $model"
97 | case $model in
98 | raspberrypi)
99 | # Notes: Raspberry Pi does not use extlinux and does not need to pack u-boot
100 | args="--kernel=linux-rpi --addpkg=firmware-raspberrypi -b --bootpartstart=4MiB --bootloader=skip"
101 | ;;
102 | radxa-*)
103 | # Use different kernel and u-boot path for different boards
104 | if [[ "$model" == "radxa-rock"* ]]; then
105 | args="--kernel=linux-aarch64-rockchip-bsp6.1-joshua-git --addpkg=linux-firmware-joshua-git --bootfirmware=usr/lib/u-boot/${model#*-}"
106 | elif [[ "$model" == "radxa-rock-2"* ]]; then
107 | args="--kernel=linux-aarch64-rockchip-bsp6.1-radxa --bootfirmware=usr/lib/u-boot/${model#*-}"
108 | elif [[ "$model" == "radxa-zero" ]] || [[ "$model" == "radxa-zero-2pro" ]]; then
109 | args="--kernel=linux-aarch64-flippy-git --addpkg=linux-firmware-amlogic-ophub-git --bootfirmware=usr/lib/u-boot/${model}"
110 | else
111 | args="--kernel=linux-aarch64-rockchip-bsp6.1-joshua-git --addpkg=linux-firmware-joshua-git --bootfirmware=usr/lib/u-boot/${model}"
112 | fi
113 | # URL to download u-boot for the board
114 | if [[ "$model" == "radxa-rock-5c" ]] || [[ "$model" == "radxa-cm5"* ]] || [[ "$model" == "radxa-nx5"* ]]; then
115 | # RK3582 Patch
116 | uboot_url="https://github.com/kwankiu/archlinux-installer/releases/download/kernel/uboot-radxa-rknext_2017.09-1_arm64.deb"
117 | elif [[ "$model" == "radxa-rock-5"* ]] || [[ "$model" == "radxa-rock-2"* ]] || [[ "$model" == "radxa-zero3" ]]; then
118 | uboot_url="https://radxa-repo.github.io/bookworm-test/pool/main/u/u-boot-rk2410/u-boot-rk2410_2017.09-46-575d1a1_arm64.deb"
119 | else
120 | uboot_url="https://github.com/radxa-repo/bullseye/raw/gh-pages/.pool/u-boot-latest_2023.10-9-eed05a18_arm64.deb"
121 | fi
122 | ;;
123 | khadas-*)
124 | if [[ "$model" == "khadas-vim"* ]]; then
125 | args="--kernel=linux-aarch64-flippy-git --addpkg=linux-firmware-amlogic-ophub-git --bootfirmware=usr/lib/u-boot"
126 | else
127 | args="--kernel=linux-aarch64-rockchip-bsp6.1-joshua-git --addpkg=linux-firmware-joshua-git --bootfirmware=usr/lib/u-boot"
128 | fi
129 | # URL to download u-boot for the board
130 | if [ "$model" == "khadas-edge2" ]; then
131 | uboot_url="https://dl.khadas.com/repos/edge2/pool/main/l/linux-u-boot-edge2-vendor/linux-u-boot-edge2-vendor_1.7.3-2017.09_arm64.deb"
132 | elif [ "$model" == "khadas-edge" ]; then
133 | uboot_url="https://dl.khadas.com/repos/edge/pool/main/l/linux-u-boot-edge-vendor/linux-u-boot-edge-vendor_0.8.3-2017.09_arm64.deb"
134 | elif [ "$model" == "khadas-vim3" ]; then
135 | uboot_url="https://dl.khadas.com/repos/vim3/pool/main/l/linux-u-boot-vim3-vendor/linux-u-boot-vim3-vendor_1.7.3-2015.01-5.15_arm64.deb"
136 | elif [ "$model" == "khadas-vim4" ]; then
137 | uboot_url="https://dl.khadas.com/repos/vim4/pool/main/l/linux-u-boot-vim4-vendor/linux-u-boot-vim4-vendor_1.7.3-2019.01_arm64.deb"
138 | fi
139 | ;;
140 | orangepi-* | nanopi-* | nanopc-* | armsom-*)
141 | args="--kernel=linux-aarch64-rockchip-bsp6.1-joshua-git --addpkg=linux-firmware-joshua-git --bootfirmware=usr/lib/u-boot -b"
142 | # URL to download u-boot for the board
143 | uboot_url="https://launchpad.net/~jjriek/+archive/ubuntu/rockchip/+files/u-boot-${model}_2017.09+20240806.gitf73b1eed-2_arm64.deb"
144 | ;;
145 | *)
146 | # Generic
147 | args="--kernel=linux -b"
148 | ;;
149 | esac
150 | done
151 | echo "ARGS=$args" >> $GITHUB_ENV
152 | echo "UBOOT_URL=$uboot_url" >> $GITHUB_ENV
153 |
154 | - name: Extract U-Boot
155 | if: ${{ env.UBOOT_URL }}
156 | env:
157 | uboot_url: ${{ env.UBOOT_URL }}
158 | run: |
159 | curl -L ${uboot_url} -o uboot.deb
160 | ar xv uboot.deb
161 | if [ -f "data.tar.xz" ]; then
162 | tar -xf data.tar.xz
163 | elif [ -f "data.tar.zst" ]; then
164 | tar -xI unzstd -f data.tar.zst
165 | fi
166 | ls -l
167 |
168 | - name: Build Image
169 | env:
170 | args: ${{ env.ARGS }}
171 | run: |
172 | bash <(curl -fsSL https://raw.githubusercontent.com/kwankiu/archlinux-installer/main/create-installation-media) --model=${{ matrix.model_name }} --image=${{ matrix.model_name }}-archlinux-installer.img -c $args
173 | cp -r out/*-archlinux-*.img.xz .
174 |
175 | - name: Add xze metadata to Image (OOWOW)
176 | if: startsWith(matrix.model_name, 'khadas')
177 | run: |
178 | bash <(curl -fsSL https://raw.githubusercontent.com/khadas/krescue/master/tools/xze) "${{ matrix.model_name }}-archlinux-installer.img.xz" \
179 | --meta \
180 | label="Arch Linux Installer" \
181 | builder="Arch Linux Installer" \
182 | date="$(LANG=C TZ= date)" \
183 | match=BOARD=$(echo "${{ matrix.model_name }}" | awk -F'-' '{print toupper(substr($2,1,1)) substr($2,2)}') \
184 | link=https://github.com/kwankiu/archlinux-installer/wiki \
185 | duration=250 \
186 | desc="Community-built Arch Linux Installer for ARM (Aarch64), Image built for $(echo "${{ matrix.model_name }}" | sed 's/-/ /g; s/\b\(.\)/\u\1/g') on $(LANG=C TZ= date)"
187 | # Rename image name to begin with the board model (required to prevent OOWOW hiding the image)
188 | mv ${{ matrix.model_name }}-archlinux-installer.img.xz $(echo "${{ matrix.model_name }}" | awk -F'-' '{print substr($2,1)}')-khadas-archlinux-installer.img.xz
189 | continue-on-error: true
190 |
191 | - name: Upload to GitHub Release
192 | uses: ncipollo/release-action@v1
193 | with:
194 | artifacts: "*-archlinux-*.img.xz"
195 | makeLatest: false
196 | allowUpdates: true
197 | omitBody: true
--------------------------------------------------------------------------------
/.github/workflows/build_image_uefi.yaml:
--------------------------------------------------------------------------------
1 | name: Build Arch Linux Installer (UEFI)
2 |
3 | # Controls when the workflow will run
4 | on:
5 | push:
6 | tags:
7 | #- 'b*'
8 | - 'UEFI*'
9 |
10 | # Allows you to run this workflow manually from the Actions tab
11 | workflow_dispatch:
12 |
13 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
14 | jobs:
15 | build:
16 | # The type of runner that the job will run on
17 | runs-on: ubuntu-latest
18 | name: Build Images
19 | permissions:
20 | contents: write
21 |
22 | strategy:
23 | matrix:
24 | model_name:
25 | # Generic
26 | - generic
27 | # Asahi (Apple Silicon)
28 | - asahi
29 | ## Raspberry Pi UEFI ##
30 | #- raspberrypi
31 | ## RK3588-EDK2 ##
32 | # Radxa
33 | - radxa-rock-5a
34 | - radxa-rock-5b
35 | - radxa-rock-5bplus
36 | - radxa-rock-5c
37 | - radxa-rock-5-itx
38 | - radxa-cm5
39 | # Orange Pi
40 | - orangepi-5 #rockchip-rk3588s-orangepi-5
41 | - orangepi-5plus
42 | # Khadas
43 | - khadas-edge2
44 | # Nano Pi
45 | - nanopc-t6
46 | - nanopi-r6c
47 | - nanopi-r6s
48 | #- nanopi-m6
49 | - nanopc-cm3588-nas
50 | # Firefly
51 | - firefly-roc-rk3588s-pc
52 | - firefly-itx-3588j
53 | - firefly-aio-3588q
54 | # Other Rockchip
55 | - indiedroid-nova #9tripod-rk3588s
56 | - mixtile-blade3 #rockchip-rk3588-blade3-v101-linux
57 | - stationpc-station-m3
58 | - mekotronics-r58x
59 | - mekotronics-r58-mini
60 | - hinlink-h88k
61 | - fydetab-duo
62 | #- buzztv-powerstation-6
63 | # Add more models as needed
64 |
65 | steps:
66 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
67 | - name: Checkout Repository
68 | uses: actions/checkout@v2
69 |
70 | - name: Preparing
71 | run: |
72 | for model in ${{ matrix.model_name }}; do
73 | echo "Building image for $model"
74 | case $model in
75 | radxa-* | khadas-* | mixtile-* | mekotronics-* | stationpc-* | hinlink-* | firefly-* | orangepi-* | nanopi-* | nanopc-* | indiedroid-*)
76 | if [[ "$model" == "orangepi"* ]] || [[ "$model" == "nanopi"* ]] || [[ "$model" == "nanopc"* ]] || [[ "$model" == "indiedroid"* ]] || [[ "$model" == "radxa-cm"* ]]; then
77 | bootfw_url="https://github.com/kwankiu/edk2-rk3588/releases/download/v1.1/${model}_UEFI_Release_v1.1.img"
78 | else
79 | bootfw_url="https://github.com/kwankiu/edk2-rk3588/releases/download/v1.1/${model#*-}_UEFI_Release_v1.1.img"
80 | fi
81 | args="--kernel=linux-aarch64-rockchip-bsp6.1-joshua-git --addpkg=linux-firmware-joshua-git -b --bootpartstart=9MiB --bootfirmware=firmware.img"
82 | ;;
83 | fydetab-*)
84 | bootfw_url="https://github.com/kwankiu/edk2-rk3588/releases/download/v1.1/${model}_UEFI_Release_v1.1.img"
85 | args="--kernel=linux-aarch64-rockchip-bsp6.1-fydetab-git --addpkg=linux-firmware-joshua-git,firmware-fydetab -b --bootpartstart=9MiB --bootfirmware=firmware.img"
86 | ;;
87 | asahi)
88 | args="--kernel=linux-asahi --addpkg=linux-asahi-loader -e --bootpartstart=1MB --bootpartend=201MB"
89 | ;;
90 | *)
91 | # Generic
92 | args="--kernel=linux -b --vmimages=qcow2,vmdk"
93 | ;;
94 | esac
95 | done
96 | echo "ARGS=$args" >> $GITHUB_ENV
97 | echo "BOOTFW_URL=$bootfw_url" >> $GITHUB_ENV
98 |
99 | - name: Download UEFI Firmware
100 | if: ${{ env.BOOTFW_URL }}
101 | env:
102 | bootfw_url: ${{ env.BOOTFW_URL }}
103 | run: |
104 | curl -L ${bootfw_url} -o firmware.img
105 | ls -l
106 |
107 | - name: Build Image
108 | env:
109 | args: ${{ env.ARGS }}
110 | run: |
111 | bash <(curl -fsSL https://raw.githubusercontent.com/kwankiu/archlinux-installer/main/create-installation-media) --model=${{ matrix.model_name }} --image=${{ matrix.model_name }}-archlinux-installer-uefi.img --bootloader=grub -c $args
112 | cp -r out/*-archlinux-*.*.xz .
113 |
114 | - name: Add xze metadata to Image (OOWOW)
115 | if: startsWith(matrix.model_name, 'khadas')
116 | run: |
117 | bash <(curl -fsSL https://raw.githubusercontent.com/khadas/krescue/master/tools/xze) "${{ matrix.model_name }}-archlinux-installer-uefi.img.xz" \
118 | --meta \
119 | label="Arch Linux Installer" \
120 | builder="Arch Linux Installer" \
121 | date="$(LANG=C TZ= date)" \
122 | match=BOARD=$(echo "${{ matrix.model_name }}" | awk -F'-' '{print toupper(substr($2,1,1)) substr($2,2)}') \
123 | link=https://github.com/kwankiu/archlinux-installer/wiki \
124 | duration=250 \
125 | desc="Community-built Arch Linux Installer for ARM (Aarch64), UEFI Image built for $(echo "${{ matrix.model_name }}" | sed 's/-/ /g; s/\b\(.\)/\u\1/g') on $(LANG=C TZ= date)"
126 | # Rename image name to begin with the board model (required to prevent OOWOW hiding the image)
127 | mv ${{ matrix.model_name }}-archlinux-installer-uefi.img.xz $(echo "${{ matrix.model_name }}" | awk -F'-' '{print substr($2,1)}')-khadas-archlinux-installer-uefi.img.xz
128 | continue-on-error: true
129 |
130 | - name: Upload to GitHub Release
131 | uses: ncipollo/release-action@v1
132 | with:
133 | artifacts: "*-archlinux-*.*.xz"
134 | makeLatest: false
135 | allowUpdates: true
136 | omitBody: true
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore temporary files
2 | *.xz
3 | *.gz
4 | *.img
5 | *.service
6 | *.tmp
7 |
8 | # Ignore macOS DS_Store
9 | .DS_Store
10 |
11 | # Ignore output folder
12 | out
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Arch Linux Installer for ARM (Aarch64)
2 |
3 | 
4 |
5 | a community-built Arch Linux Installer for ARM (Aarch64) based devices.
6 |
7 | [](https://github.com/kwankiu/archlinux-installer/releases)
8 |
9 |
10 |
11 |
12 | ## Supported devices:
13 | - Rockchip (Radxa, Khadas, Orange Pi, etc)
14 | - Raspberry Pi (4B/5B/Zero 2W & other aarch64 model)
15 | - Asahi (Apple Silicon Macs) 
16 | - and More
17 |
18 | Please check this [page](https://github.com/kwankiu/archlinux-installer/wiki/Supported-devices) for all supported devices.
19 |
20 | # Get the installer
21 |
22 | ## Flashing images (Recommended)
23 |
24 | ### Radxa Rock 5 series
25 |
26 | Images for Radxa Rock 5 series are available on the [RPI Imager repository](https://forum.radxa.com/t/i-made-a-community-images-repository-for-rpi-imager/20080).
27 |
28 | ### Khadas Edge 2
29 |
30 | ~~Images for Khadas Edge 2 are available on [OOWOW](https://docs.khadas.com/software/oowow/getting-started).~~
31 |
32 | 
33 |
34 | ### Asahi (apple silicon)
35 |
36 | There are no images available for Asahi.
37 |
38 | [However, you can install Arch Linux ARM using the dev version of Asahi Installer. After that, you can download and run this installer.](https://github.com/kwankiu/archlinux-installer/discussions/40#discussion-6456051)
39 |
40 | 
41 |
42 | ### For other devices
43 | Our [prebuilt image](https://github.com/kwankiu/archlinux-installer/releases/latest) are available for downloads, you can flash it (using [RPI Imager](https://www.raspberrypi.com/software/), [balenaEtcher](https://etcher.balena.io/), etc) to your storage device.
44 |
45 | More details can be found at our [wiki](https://github.com/kwankiu/archlinux-installer/wiki/Get-the-installer).
46 |
47 | ## The `create-installation-media` tool (Advanced)
48 |
49 | You can build your own image or flash the Installer to your disk directly by executing the following command:
50 |
51 | ```bash
52 |
53 | bash <(curl -fsSL https://raw.githubusercontent.com/kwankiu/archlinux-installer/main/create-installation-media)
54 |
55 | ```
56 |
57 | More details can be found at our [wiki](https://github.com/kwankiu/archlinux-installer/wiki/Advanced).
58 |
59 | # Installation
60 |
61 | 1. Power ON your Device with the **Storage Device** and **Ethernet Cable (or WiFi Adapter)** plugged in.
62 |
63 | 2. The installer may install some required packages and perform some inital setup at its first boot, then it will reboot.
64 |
65 | 3. Network setup will be shown, if you have a wired connection, kindy wait for 5-15 seconds, and it should get connected. If you want to use wireless connection, press 'w' key to setup a WiFi.
66 |
67 | 4. Now, choose 'Install Arch Linux (CLI/TUI)' to launch the installer.
68 |
69 | 5. The installer will guide you through the installation of Arch Linux with your desired Settings, Kernel, Desktop Environment, and Software, Enjoy!
70 |
71 | More details can be found at our [wiki](https://github.com/kwankiu/archlinux-installer/wiki/Installation).
72 |
73 | # Troubleshooting
74 |
75 | 1. If your first boot shows a user login screen instead, login to root/root and run `installer`.
76 |
77 | 2. If you get stuck while rebooting, unplug the power and power it on manually.
78 |
79 | 3. For WiFi support, please refer to [linux-firmware](https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/), [USB WiFi Support](https://github.com/morrownr/USB-WiFi/blob/main/home/USB_WiFi_Adapters_that_are_supported_with_Linux_in-kernel_drivers.md) & [Joshua's firmware](https://github.com/Joshua-Riek/firmware) (for rockchip SBCs) for supported WiFi adapter.
80 |
81 | 4. During the installation, your system may reboot serveral times.
82 |
83 | 5. Sometimes you may need to connect to WiFi again after a reboot.
84 |
85 | 6. After the installation finishes, you will need to connect to WiFi again.
86 |
87 | More details can be found at our [wiki](https://github.com/kwankiu/archlinux-installer/wiki/General#troubleshooting).
88 |
89 | # ACU - A Configuration Utility for Arch Linux ARM
90 | ### Warning: ACU is still experimental.
91 |
92 | ACU is a community-built tool designed for managing configurations and packages on Arch Linux ARM (Aarch64).
93 |
94 | We have created this configuration utility just like [armbian-config](https://github.com/armbian/config), [rsetup](https://docs.radxa.com/en/radxa-os/rsetup/rsetup-tool), or [raspi-config](https://www.raspberrypi.com/documentation/computers/configuration.html) but for Arch Linux ARM.
95 |
96 | 
97 |
98 | This utility is included with our archlinux-installer.
99 |
100 | To launch this configuration utility:
101 |
102 | ```
103 | acu
104 | ```
105 |
106 | Note that if you do not want this utility, it can be uninstalled by simply running `acu remove acu`.
107 |
108 | More details can be found at [ACU](https://github.com/kwankiu/acu).
109 |
--------------------------------------------------------------------------------
/config/acu_config.yaml:
--------------------------------------------------------------------------------
1 | # __ ___ _ _ ___ __ __ _ ____ __ ___ _ _ ____ __ ____ __ __ __ _ ____
2 | # / _\ / __)/ )( \ / __)/ \ ( ( \( __)( )/ __)/ )( \( _ \ / _\(_ _)( )/ \ ( ( \/ ___)
3 | # / \( (__ ) \/ ( ( (__( O )/ / ) _) )(( (_ \) \/ ( ) // \ )( )(( O )/ /\___ \
4 | # \_/\_/ \___)\____/ \___)\__/ \_)__)(__) (__)\___/\____/(__\_)\_/\_/(__) (__)\__/ \_)__)(____/
5 | # ACU configurations - Arch Linux Installer for ARM
6 | configurations:
7 |
8 | ## ACU Themes and Colors ##
9 |
10 | # available colors are $BLACK $GREY $RED $GREEN $YELLOW $ORANGE $BLUE $DKBLUE $MAGENTA $CYAN $WHITE $LTMAGENTA $LTBLUE $LTGREY $DKRED $DKGREEN $NC
11 | # NOTE: WARNING and DEBUG must not be same as THEME
12 |
13 | # ACU Theme
14 | # Theme Name displayed in ACU Settings (Optional)
15 | THEME_NAME: Installer
16 |
17 | # Theme Color
18 | THEME: $CYAN
19 |
20 | # Warning Messages Color
21 | #WARNING: $YELLOW
22 |
23 | # Debug Messages Color
24 | #DEBUG: $LTGREY
25 |
26 | # Theme with Background Color (Experimental)
27 | BACKGROUND: $BGWHITE
28 |
29 | ## ACU Configurable Variables ##
30 |
31 | # do not update (overwrite) this configuration file during an update
32 | # if you edited this configuration file, uncomment this to prevent ACU overwriting it during an update
33 | #no_config_update: 1
34 |
35 | # load device configuration determined by tags (e.g. radxa-rock-5b)
36 | #device_config: generic
37 |
38 | # do not confirm when installing a package using pacman -S / -U or makepkg -si
39 | #no_confirm: 1
40 |
41 | # do not synchronize package databases when using the install command
42 | #no_sync: 1
43 |
44 | # do not print warning ($WARNING) messages
45 | no_warning: 1
46 |
47 | # disable color or cursor position in output
48 | no_styling: 1
49 |
50 | # disable logo / title in output
51 | no_title: 1
52 |
53 | # do not clear terminal outputs
54 | #no_clear: 1
55 |
56 | # print debug ($DEBUG) messages
57 | #debug_log: 1
58 |
59 | # auto update (unset=1, 0: Do not check updates, 1: Auto check updates but do not install, 2: Auto check & install updates at launch)
60 | #auto_update: 1
61 |
62 | ## ACU Configurable Files and Path ##
63 |
64 | # directory for storing source files
65 | source_repo_dir: .acu/cache/sources
66 |
67 | # Repositories List
68 | # repositories_list - file (or url) to load repositories list
69 | # repositories_list_update - Sync local file from url when fetching updates (optional)
70 | repositories_list: .acu/config/repo.yaml
71 | repositories_list_update: https://raw.githubusercontent.com/kwankiu/archlinux-installer/main/config/repo.yaml
72 |
73 |
--------------------------------------------------------------------------------
/config/boot.yaml:
--------------------------------------------------------------------------------
1 | # ____ __ __ ____ ___ __ __ _ ____ __ ___
2 | # ( _ \ / \ / \(_ _) / __)/ \ ( ( \( __)( )/ __)
3 | # ) _ (( O )( O ) )( ( (__( O )/ / ) _) )(( (_ \
4 | # (____/ \__/ \__/ (__) \___)\__/ \_)__)(__) (__)\___/
5 | # Boot Config for each target device
6 | boot:
7 |
8 | # Example
9 | #- dtb: path to dtb directory or the dtb file
10 | # dtb_overlays:
11 | # - path to the dtb overlay file
12 | # cmdline: cmdline for kernel to boot
13 | # compatible:
14 | # - device tag
15 |
16 | # Generic
17 | - dtb: /dtbs
18 | dtb_overlays: null
19 | cmdline: rw loglevel=3 quiet splash
20 | compatible:
21 | - generic
22 |
23 | # Asahi (Apple Silicon)
24 | - dtb: /usr/lib/asahi-boot/dtb
25 | dtb_overlays: null
26 | cmdline: brcmfmac.feature_disable=0x82000 loglevel=3 quiet splash
27 | compatible:
28 | - asahi
29 | - apple*
30 |
31 | # Radxa RK3588 Family
32 | - dtb: /dtbs/%PKGBASE%
33 | dtb_overlays: null
34 | cmdline: earlycon=uart8250,mmio32,0xfeb50000 console=ttyFIQ0 console=tty1 consoleblank=0 loglevel=0 panic=10 rootwait rw init=/sbin/init rootfstype=ext4 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1 irqchip.gicv3_pseudo_nmi=0 switolb=1 coherent_pool=2M
35 | compatible:
36 | - radxa-rock-5*
37 | - radxa-cm5*
38 | - radxa-nx5*
39 |
40 | # Radxa Zero and Rock Series
41 | - dtb: /dtbs/%PKGBASE%
42 | dtb_overlays: null
43 | cmdline: console=ttyFIQ0,1500000n8 quiet splash loglevel=4 rw earlycon consoleblank=0 console=tty1 coherent_pool=2M irqchip.gicv3_pseudo_nmi=0 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1
44 | compatible:
45 | - radxa-zero*
46 | - radxa-rock-2*
47 | - radxa-rock-3*
48 | - radxa-rock-4*
49 | - radxa-rock-pi-4*
50 | - radxa-cm3*
51 |
52 | # Khadas Edge Series
53 | - dtb: /dtbs/%PKGBASE%
54 | dtb_overlays: null
55 | cmdline: earlycon=uart8250,mmio32,0xfeb50000 console=ttyFIQ0 console=tty0 quiet splash irqchip.gicv3_pseudo_nmi=0 lcd_panel=${lcd_panel} fan=auto consoleblank=0 loglevel=0 panic=10 rootwait rw init=/sbin/init rootfstype=ext4 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1 switolb=1 coherent_pool=2M
56 | compatible:
57 | - khadas-edge*
58 | - khadas-vim*
59 |
60 | # Orange Pi, Nano Pi & other generic SBCs
61 | - dtb: /dtbs/%PKGBASE%
62 | dtb_overlays: null
63 | cmdline: rw loglevel=3 quiet splash
64 | compatible:
65 | - orangepi*
66 | - nanopi*
67 | - nanopc*
68 | - indiedroid*
69 | - mixtile*
70 | - embedfire*
71 | - firefly*
72 | - turing*
73 | - armsom*
74 | - hinlink*
75 | - mekotronics*
76 | - stationpc*
77 | - fydetab*
78 | - buzztv*
79 |
--------------------------------------------------------------------------------
/config/desktop.yaml:
--------------------------------------------------------------------------------
1 | # ____ ____ ____ __ _ ____ __ ____ ____ __ _ _ _ __ ____ __ __ _ _ _ ____ __ _ ____
2 | # ( \( __)/ ___)( / )(_ _)/ \( _ \ ( __)( ( \/ )( \( )( _ \ / \ ( ( \( \/ )( __)( ( \(_ _)
3 | # ) D ( ) _) \___ \ ) ( )( ( O )) __/ ) _) / /\ \/ / )( ) /( O )/ // \/ \ ) _) / / )(
4 | # (____/(____)(____/(__\_) (__) \__/(__) (____)\_)__) \__/ (__)(__\_) \__/ \_)__)\_)(_/(____)\_)__) (__)
5 | # List of Desktop Environment
6 | desktop:
7 | ########################################################################
8 | # Minimum ACU Version
9 | - min_acu_verion: 0.0.7
10 | ########################################################################
11 | # Category List
12 | - categories:
13 | - category_name: Desktop
14 | category_description: Install a Desktop Environment
15 | ########################################################################
16 | # Desktop Environment List
17 | - items:
18 | ########################################################################
19 | # Items Usage / Examples
20 | # - package_name: Name to identify the package (small letter no space) (used for: acu install )
21 | # pretty_name: Name to be shown on the app list (can contain capital letter and space) (used for: acu apps)
22 | # category: Specific a category that this package belongs to from the category_name of the list above
23 | # description: Description of the package
24 | # compatible:
25 | # - Device tag list that this package is compatible with (this is optional when a package is suitable for any devices)
26 | # packages:
27 | # - Packages to be installed (this will be passed to acu install before running commands)
28 | # commands: |
29 | # # Commands to run when installing this packages
30 | # # This can be multiple lines
31 | # # This is mostly used for post install, which is optional
32 |
33 | # Gnome (Full)
34 | - package_name: gnome-full
35 | pretty_name: Gnome (Full)
36 | category: Desktop
37 | description: Comprehensive Gnome desktop with full suite
38 | compatible: null
39 | packages:
40 | - gnome
41 | commands: |
42 | sudo systemctl enable gdm
43 |
44 | # Gnome (Minimal)
45 | - package_name: gnome-minimal
46 | pretty_name: Gnome (Minimal)
47 | category: Desktop
48 | description: Comprehensive Gnome desktop with essentials only
49 | compatible: null
50 | packages:
51 | - gnome-shell
52 | - gnome-keyring
53 | - gnome-control-center
54 | - gnome-backgrounds
55 | - gnome-console
56 | - gnome-disk-utility
57 | - nautilus
58 | - xdg-user-dirs
59 | - gdm
60 | - librsvg
61 | commands: |
62 | sudo systemctl enable gdm
63 |
64 | # Phosh
65 | - package_name: phosh
66 | pretty_name: Phosh
67 | category: Desktop
68 | description: Experimental Phone shell based on the GNOME stack
69 | compatible: null
70 | packages:
71 | - phosh
72 | - gnome-keyring
73 | - gnome-control-center
74 | - gnome-backgrounds
75 | - gnome-console
76 | - gnome-disk-utility
77 | - nautilus
78 | - xdg-user-dirs
79 | - gdm
80 | - librsvg
81 | commands: |
82 | sudo systemctl enable gdm
83 |
84 | # KDE Plasma (Full)
85 | - package_name: plasma-full
86 | pretty_name: KDE Plasma (Full)
87 | category: Desktop
88 | description: KDE's comprehensive desktop with full suite
89 | compatible: null
90 | packages:
91 | - plasma-meta
92 | - sddm
93 | - kde-applications-meta
94 | commands: |
95 | sudo systemctl enable sddm
96 |
97 | # KDE Plasma (Minimal)
98 | - package_name: plasma-minimal
99 | pretty_name: KDE Plasma (Minimal)
100 | category: Desktop
101 | description: KDE's comprehensive desktop with essentials only
102 | compatible: null
103 | packages:
104 | - plasma-meta
105 | - sddm
106 | - konsole
107 | - dolphin
108 | commands: |
109 | sudo systemctl enable sddm
110 |
111 | # Budgie Desktop
112 | - package_name: budgie
113 | pretty_name: Budgie Desktop
114 | category: Desktop
115 | description: A lightweight Gnome-based desktop
116 | compatible: null
117 | packages:
118 | - budgie
119 | - arc-gtk-theme
120 | - papirus-icon-theme
121 | - gnome-keyring
122 | - gnome-console
123 | - gnome-disk-utility
124 | - nautilus
125 | - xdg-user-dirs
126 | - gdm
127 | - librsvg
128 | commands: |
129 | sudo systemctl enable gdm
130 |
131 | # Cutefish Desktop
132 | - package_name: cutefish
133 | pretty_name: Cutefish Desktop
134 | category: Desktop
135 | description: Elegant and uncluttered KDE-based desktop
136 | compatible: null
137 | packages:
138 | - plasma-desktop
139 | - sddm
140 | - cutefish
141 | commands: |
142 | sudo systemctl enable sddm
143 |
144 | # XFCE
145 | - package_name: xfce
146 | pretty_name: XFCE
147 | category: Desktop
148 | description: Lightweight GTK-based desktop
149 | compatible: null
150 | packages:
151 | - lightdm
152 | - lightdm-gtk-greeter
153 | - lightdm-gtk-greeter-settings
154 | - xorg-server
155 | - xfce4
156 | - xfce4-goodies
157 | - network-manager-applet
158 | - blueman
159 | - xdg-user-dirs
160 | - libmd
161 | - libbsd
162 | - librsvg
163 | commands: |
164 | sudo systemctl enable lightdm
165 | sudo systemctl enable accounts-daemon
166 |
167 | # LXQT
168 | - package_name: lxqt
169 | pretty_name: LXQT
170 | category: Desktop
171 | description: Lightweight Qt-based desktop
172 | compatible: null
173 | packages:
174 | - lxqt
175 | - breeze-icons
176 | - sddm
177 | commands: |
178 | sudo systemctl enable sddm
179 |
180 | # LXDE
181 | - package_name: lxde
182 | pretty_name: LXDE
183 | category: Desktop
184 | description: Lightweight X11 desktop
185 | compatible: null
186 | packages:
187 | - lxde
188 | - xscreensaver
189 | commands: |
190 | sudo systemctl enable lxdm
191 |
192 | # MATE
193 | - package_name: mate
194 | pretty_name: MATE
195 | category: Desktop
196 | description: Traditional Gnome 2-based desktop
197 | compatible: null
198 | packages:
199 | - mate
200 | - mate-extra
201 | - gdm
202 | - librsvg
203 | commands: |
204 | sudo systemctl enable gdm
205 |
206 | # Cinnamon
207 | - package_name: cinnamon
208 | pretty_name: Cinnamon
209 | category: Desktop
210 | description: Cinnamon Gnome-based desktop
211 | compatible: null
212 | packages:
213 | - cinnamon
214 | - cinnamon-translations
215 | - nemo-fileroller
216 | - nemo-image-converter
217 | - nemo-preview
218 | - xed
219 | - xreader
220 | - gnome-console
221 | - gdm
222 | - librsvg
223 | commands: |
224 | sudo systemctl enable gdm
225 |
226 | # Sway
227 | - package_name: sway
228 | pretty_name: Sway
229 | category: Desktop
230 | description: Tiling Wayland window manager
231 | compatible: null
232 | packages:
233 | - qt6-5compat
234 | - qt6-svg
235 | - sddm
236 | - sway
237 | - swayidle
238 | - swaylock
239 | - swaybg
240 | - swaync
241 | - waybar
242 | - rofi
243 | - xdg-desktop-portal-wlr
244 | - xdg-desktop-portal-gtk
245 | - xdg-user-dirs
246 | - polkit-gnome
247 | - foot
248 | - thunar
249 | - pass
250 | commands: |
251 | sudo systemctl enable sddm
252 | sudo mkdir -p /etc/sddm.conf.d
253 | sudo mkdir -p /usr/share/wayland-sessions
254 | #Sway Config
255 | sudo sed -i 's/set $menu /set $menu rofi -show drun #/g' /etc/sway/config
256 | sudo sed -i 's/bar {/exec waybar #/g' /etc/sway/config
257 | sudo sed -i 's/position top/#position top/g' /etc/sway/config
258 | mkdir -p /home/$(whoami)/.config/sway
259 | cp -r /etc/sway/config /home/$(whoami)/.config/sway/config
260 |
261 | # Hyprland
262 | - package_name: hyprland
263 | pretty_name: Hyprland
264 | category: Desktop
265 | description: Dynamic tiling Wayland window manager
266 | compatible: null
267 | packages:
268 | - qt6-5compat
269 | - qt6-svg
270 | - sddm
271 | - hyprland
272 | - hyprcursor
273 | - hyprpaper
274 | - hypridle
275 | - hyprlock
276 | - swaync
277 | - waybar
278 | - rofi
279 | - xdg-desktop-portal-hyprland
280 | - xdg-desktop-portal-gtk
281 | - xdg-user-dirs
282 | - polkit-gnome
283 | - alacritty
284 | - dolphin
285 | - pass
286 | commands: |
287 | sudo systemctl enable sddm
288 | sudo mkdir -p /etc/sddm.conf.d
289 | sudo mkdir -p /usr/share/wayland-sessions
290 | #Hyprland Config
291 | sudo sed -i 's/kitty/alacritty/g' /usr/share/hyprland/hyprland.conf
292 | sudo sed -i 's/wofi --show/rofi -show/g' /usr/share/hyprland/hyprland.conf
293 | sudo sed -i 's/# exec-once = waybar & hyprpaper & firefox/exec-once = waybar \& hyprpaper \& hypridle/g' /usr/share/hyprland/hyprland.conf
294 | mkdir -p /home/$(whoami)/.config/hypr
295 | cp -r /usr/share/hyprland/hyprland.conf /home/$(whoami)/.config/hypr/hyprland.conf
296 | #Hyprland Default Wallpaper
297 | echo -e "preload=/usr/share/hyprland/hyprland.png\nwallpaper=,contain:/usr/share/hyprland/hyprland.png" | sudo tee /home/$(whoami)/.config/hypr/hyprpaper.conf
298 |
299 | # Archcraft
300 | - package_name: archcraft
301 | pretty_name: Archcraft
302 | category: Desktop
303 | description: Archcraft DE with Openbox, Bspwm & i3wm
304 | compatible: null
305 | packages:
306 | - xorg-server
307 | - git
308 | commands: |
309 | echo "Installing Archcraft ARM ..."
310 | cd ~/.acu/cache
311 | sudo git clone --depth 1 https://github.com/archcraft-os/archcraft-arm
312 | cd archcraft-arm
313 | sudo curl -LO https://github.com/kwankiu/archlinux-installer/releases/download/kernel/0001-Config-for-installing-Archcraft-DE.patch
314 | sudo git apply 0001-Config-for-installing-Archcraft-DE.patch
315 | cd profile
316 | sudo ./install.sh
317 | # Fix permission issue
318 | sudo chown -R $(whoami) /home/$(whoami)
319 |
320 | ########################################################################
--------------------------------------------------------------------------------
/config/kernel.yaml:
--------------------------------------------------------------------------------
1 | # __ _ ____ ____ __ _ ____ __
2 | # ( / )( __)( _ \( ( \( __)( )
3 | # ) ( ) _) ) // / ) _) / (_/\
4 | # (__\_)(____)(__\_)\_)__)(____)\____/
5 | # List of available kernel and its drivers and packages
6 | kernel:
7 | # Kernel List
8 | - items:
9 | ########################################################################
10 | # #Items Usage / Examples
11 | # - base: Kernel base package
12 | # description: Description of the kernel package
13 | # version: Linux kernel version
14 | # repo:
15 | # - Repositories to be added to pacman, supported formats are
16 | # - REPO_NAME
17 | # - REPO_NAME,REPO_URL (Coming Soon)
18 | # - REPO_NAME,REPO_URL,GPG_KEY (Coming Soon)
19 | # compatible:
20 | # - Device tags that this package is compatible with (or set to null if none)
21 | # recommended:
22 | # - Device tags that this package is the recommended option for that device (or set to null if none)
23 | # experimental:
24 | # - Device tags that this package is experimentally compatible with (or set to null if none)
25 | # firmware:
26 | # - linux firmware packages to install
27 | # graphics:
28 | # - graphics acceleration packages to install
29 | # video:
30 | # - video acceleration packages to install
31 | # additional:
32 | # - other packages to install
33 |
34 | ## Maintained by: ALARM ##
35 | ## Compatible with: Generic / All ##
36 |
37 | # Linux Stable Kernel
38 | - base: linux-aarch64
39 | description: Linux Stable Kernel
40 | version: latest stable
41 | repo: null
42 | compatible:
43 | - generic
44 | - apple*
45 | - raspberrypi*
46 | recommended: null
47 | experimental:
48 | - radxa-zero*
49 | - radxa-rock-3*
50 | - radxa-rock-4*
51 | - radxa-rock-5*
52 | - khadas-vim*
53 | - khadas-edge*
54 | - xunlong-orangepi-5*
55 | - rockchip-rk3588-orangepi*
56 | - rockchip-rk3588s-orangepi*
57 | firmware: null
58 | graphics:
59 | - mesa
60 | video:
61 | - pipewire-jack
62 | - ffmpeg
63 | additional:
64 | - grub-fixup
65 |
66 | # Linux Mainline Kernel
67 | - base: linux-aarch64-rc
68 | description: Linux Mainline Kernel
69 | version: latest mainline
70 | repo: null
71 | compatible: null
72 | recommended: null
73 | experimental:
74 | - generic
75 | - apple*
76 | - raspberrypi*
77 | - radxa-zero*
78 | - radxa-rock-3*
79 | - radxa-rock-4*
80 | - radxa-rock-5*
81 | - khadas-vim*
82 | - khadas-edge*
83 | - xunlong-orangepi-5*
84 | - rockchip-rk3588-orangepi*
85 | - rockchip-rk3588s-orangepi*
86 | firmware: null
87 | graphics:
88 | - mesa
89 | video:
90 | - pipewire-jack
91 | - ffmpeg
92 | additional:
93 | - grub-fixup
94 |
95 | ## Compatible with: Raspberry Pi ##
96 |
97 | # Linux Raspberry Pi Kernel
98 | - base: linux-rpi
99 | description: Linux Raspberry Pi BSP Kernel
100 | version: 6.12
101 | repo: null
102 | compatible:
103 | - raspberrypi*
104 | recommended:
105 | - raspberrypi*
106 | experimental: null
107 | firmware: null
108 | graphics:
109 | - mesa
110 | video:
111 | - pipewire-jack
112 | - ffmpeg-rpi
113 | additional: null
114 |
115 | # Linux Raspberry Pi 16K Kernel
116 | - base: linux-rpi-16k
117 | description: (For bcm2712/RPi5 ONLY) Linux Raspberry Pi BSP 16k pagesize Kernel
118 | version: 6.12
119 | repo: null
120 | compatible:
121 | - raspberrypi*
122 | recommended:
123 | - raspberrypi*
124 | experimental: null
125 | firmware: null
126 | graphics:
127 | - mesa
128 | video:
129 | - pipewire-jack
130 | - ffmpeg-rpi
131 | additional: null
132 |
133 | ## Maintained by: Samuel (kwankiu) / Joske / Asahi Linux ##
134 | ## Compatible with: Asahi Linux / Apple Silicon ##
135 |
136 | # Linux Asahi Kernel
137 | - base: linux-asahi
138 | description: Linux Asahi Kernel
139 | version: 6.11
140 | repo:
141 | - asahi
142 | compatible:
143 | - apple*
144 | recommended:
145 | - apple*
146 | experimental: null
147 | firmware:
148 | - asahi-fwextract
149 | - asahi-configs
150 | graphics:
151 | - mesa-asahi
152 | video:
153 | - pipewire-jack
154 | - ardour
155 | - asahi-audio
156 | - alsa-ucm-conf-asahi
157 | - ffmpeg
158 | additional: null
159 |
160 | # Linux Asahi Kernel
161 | - base: linux-asahi
162 | description: Linux Asahi Kernel
163 | version: 6.14
164 | repo:
165 | - asahi-alarm
166 | compatible: null
167 | recommended: null
168 | experimental:
169 | - apple*
170 | firmware:
171 | - asahi-fwextract
172 | - asahi-configs
173 | graphics:
174 | - asahi-alarm/mesa
175 | video:
176 | - pipewire-jack
177 | - ardour
178 | - asahi-audio
179 | - alsa-ucm-conf-asahi
180 | - ffmpeg
181 | additional: null
182 |
183 | ## Maintained by: 7Ji-PKGBUILDs / Joshua-Riek ##
184 | ## Compatible with: Rockchip ##
185 |
186 | # Joshua's Rockchip 6.1 Kernel
187 | - base: linux-aarch64-rockchip-bsp6.1-joshua-git
188 | description: Joshua Linux Rockchip BSP Kernel
189 | version: 6.1-rkr3
190 | repo:
191 | - 7Ji
192 | compatible:
193 | - radxa-rock-3*
194 | - radxa-rock-4*
195 | - radxa-rock-5*
196 | - radxa-cm5*
197 | - radxa-nx5*
198 | - radxa-zero3*
199 | - khadas-edge*
200 | - xunlong-orangepi-5*
201 | - rockchip-rk3588-orangepi*
202 | - rockchip-rk3588s-orangepi*
203 | - rockchip-rk3588-armsom*
204 | - friendlyelec-nanopi-r6*
205 | - friendlyelec-nanopc-*
206 | - friendlyelec-cm*
207 | recommended:
208 | - radxa-rock-5*
209 | - radxa-cm5*
210 | - radxa-nx5*
211 | - radxa-zero3*
212 | - khadas-edge*
213 | - xunlong-orangepi-5*
214 | - rockchip-rk3588-orangepi*
215 | - rockchip-rk3588s-orangepi*
216 | - rockchip-rk3588-armsom*
217 | - friendlyelec-nanopi-r6*
218 | - friendlyelec-nanopc-*
219 | - friendlyelec-cm*
220 | experimental: null
221 | firmware:
222 | - linux-firmware-joshua-git
223 | graphics:
224 | - mesa
225 | video:
226 | - pipewire-jack
227 | - ffmpeg-mpp-git
228 | additional: null
229 |
230 | # Joshua's Rockchip 5.10 Kernel
231 | - base: linux-aarch64-rockchip-bsp5.10-joshua-git
232 | description: Joshua Linux Rockchip BSP Kernel
233 | version: 5.10-rkr8
234 | repo:
235 | - 7Ji
236 | compatible:
237 | - radxa-rock-3*
238 | - radxa-rock-4*
239 | - radxa-rock-5*
240 | - radxa-cm5*
241 | - radxa-nx5*
242 | - radxa-zero3*
243 | - khadas-edge*
244 | - xunlong-orangepi-5*
245 | - rockchip-rk3588-orangepi*
246 | - rockchip-rk3588s-orangepi*
247 | - rockchip-rk3588-armsom*
248 | - friendlyelec-nanopi-r6*
249 | - friendlyelec-nanopc-*
250 | - friendlyelec-cm*
251 | recommended: null
252 | experimental: null
253 | firmware:
254 | - linux-firmware-joshua-git
255 | graphics:
256 | - mesa-panfork-git
257 | - mali-valhall-g610-firmware
258 | - libmali-valhall-g610-x11-wayland-gbm
259 | video:
260 | - pipewire-jack
261 | - ffmpeg-mpp-git
262 | additional: null
263 |
264 | ## Maintained by: 7Ji-PKGBUILDs / Radxa ##
265 |
266 | # Radxa Rockchip 5.10 Kernel
267 | - base: linux-aarch64-rockchip-bsp5.10-radxa-git
268 | description: Radxa Linux Rockchip BSP Kernel
269 | version: 5.10-rkr4.1
270 | repo:
271 | - 7Ji
272 | compatible:
273 | - radxa-rock-2*
274 | - radxa-rock-3*
275 | - radxa-rock-4*
276 | - radxa-rock-5*
277 | - radxa-cm3*
278 | - radxa-cm5*
279 | - radxa-nx5*
280 | - radxa-zero3*
281 | recommended: null
282 | experimental: null
283 | firmware:
284 | - 8852bu-dkms-git
285 | - 8852be-dkms-git
286 | graphics:
287 | - mesa-panfork-git
288 | - mali-valhall-g610-firmware
289 | - libmali-valhall-g610-x11-wayland-gbm
290 | video:
291 | - pipewire-jack
292 | - ffmpeg-mpp-git
293 | additional: null
294 |
295 | # Radxa Rockchip 6.1 Kernel
296 | - base: linux-aarch64-rockchip-bsp6.1-radxa
297 | description: Radxa Linux Rockchip BSP Kernel
298 | version: 6.1-rkr1
299 | repo:
300 | - rockchip
301 | compatible:
302 | - radxa-rock-2*
303 | - radxa-rock-3*
304 | - radxa-rock-4*
305 | - radxa-rock-5*
306 | - radxa-cm3*
307 | - radxa-cm5*
308 | - radxa-nx5*
309 | - radxa-zero3*
310 | recommended: null
311 | experimental: null
312 | firmware:
313 | - 8852bu-dkms-git
314 | - 8852be-dkms-git
315 | graphics:
316 | - mesa
317 | video:
318 | - pipewire-jack
319 | - ffmpeg-mpp-git
320 | additional: null
321 |
322 | ## Maintained by: 7Ji-PKGBUILDs / Orange Pi ##
323 |
324 | # Orange Pi Rockchip 5.10 Kernel
325 | - base: linux-aarch64-rockchip-rk3588-bsp5.10-orangepi-git
326 | description: OrangePi Linux Rockchip BSP Kernel
327 | version: 5.10.160
328 | repo:
329 | - 7Ji
330 | compatible:
331 | - xunlong-orangepi-5*
332 | - rockchip-rk3588s-orangepi*
333 | - rockchip-rk3588-orangepi*
334 | recommended:
335 | - xunlong-orangepi-5*
336 | - rockchip-rk3588s-orangepi*
337 | - rockchip-rk3588-orangepi*
338 | experimental: null
339 | firmware:
340 | - linux-firmware-orangepi-git
341 | graphics:
342 | - mesa-panfork-git
343 | - mali-valhall-g610-firmware
344 | - libmali-valhall-g610-x11-wayland-gbm
345 | video:
346 | - pipewire-jack
347 | - ffmpeg-mpp-git
348 | additional: null
349 |
350 | ## Maintained by: Samuel (kwankiu) / Fyde Innovations ##
351 |
352 | # FydeTab Rockchip BSP6.1 Kernel
353 | - base: linux-aarch64-rockchip-bsp6.1-fydetab-git
354 | description: FydeTab's fork of Joshua Linux Rockchip BSP Kernel
355 | version: 6.1-rkr3
356 | repo:
357 | - 7Ji
358 | compatible:
359 | - rockchip-rk3588s-tablet-12c-linux
360 | - rockchip-rk3588s-tablet-fydetab-linux
361 | recommended: null
362 | experimental: null
363 | firmware:
364 | - linux-firmware-joshua-git
365 | graphics:
366 | - mesa
367 | video:
368 | - pipewire-jack
369 | - ffmpeg-mpp-git
370 | additional: null
371 |
372 | ## Maintained by: Samuel (kwankiu) / Armbian ##
373 |
374 | # Armbian Rockchip BSP6.1 Kernel
375 | - base: linux-aarch64-rockchip-bsp6.1-armbian-git
376 | description: Armbian Linux Rockchip BSP Kernel
377 | version: 6.1-rkr5
378 | repo:
379 | - rockchip
380 | compatible:
381 | - radxa-rock-3*
382 | - radxa-rock-4*
383 | - radxa-rock-5*
384 | - radxa-cm5*
385 | - radxa-nx5*
386 | - radxa-zero3*
387 | - khadas-edge*
388 | - xunlong-orangepi-5*
389 | - rockchip-rk3588-orangepi*
390 | - rockchip-rk3588s-orangepi*
391 | - rockchip-rk3588-armsom*
392 | - friendlyelec-nanopi-r6*
393 | - friendlyelec-nanopc-*
394 | - friendlyelec-cm*
395 | recommended: null
396 | experimental: null
397 | firmware:
398 | - linux-firmware-armbian-git
399 | graphics:
400 | - mesa
401 | video:
402 | - pipewire-jack
403 | - ffmpeg-mpp-git
404 | additional:
405 | - enable-panthor-overlay
406 |
407 | # Armbian Rockchip Kernel
408 | - base: linux-aarch64-rockchip-armbian-git
409 | description: Armbian Linux Mainline Kernel with rockchip support
410 | version: 6.15.y
411 | repo:
412 | - rockchip
413 | compatible:
414 | - radxa-rock-3*
415 | - radxa-rock-4*
416 | - radxa-rock-5*
417 | #- radxa-cm5*
418 | #- radxa-nx5*
419 | - radxa-zero3*
420 | - khadas-edge*
421 | - xunlong-orangepi-5*
422 | - rockchip-rk3588-orangepi*
423 | - rockchip-rk3588s-orangepi*
424 | - rockchip-rk3588-armsom*
425 | - friendlyelec-nanopi-r6*
426 | - friendlyelec-nanopc-*
427 | - friendlyelec-cm*
428 | recommended: null
429 | experimental: null
430 | firmware:
431 | - linux-firmware-armbian-git
432 | graphics:
433 | - mesa
434 | video:
435 | - pipewire-jack
436 | - ffmpeg-mpp-git
437 | additional: null
438 |
439 | ## Maintained by: 7Ji-PKGBUILDs ##
440 |
441 | # Flippy's Kernel for Amlogic
442 | - base: linux-aarch64-flippy-git
443 | description: Flippy's Kernel aiming to increase usability for Amlogic
444 | version: 6.6
445 | repo:
446 | - 7Ji
447 | compatible:
448 | - khadas-vim*
449 | - radxa-zero
450 | - radxa-zero2
451 | recommended:
452 | - khadas-vim*
453 | - radxa-zero
454 | - radxa-zero2
455 | experimental: null
456 | firmware:
457 | - linux-aarch64-flippy-git-dtb-amlogic
458 | - linux-firmware-amlogic-ophub-git
459 | graphics:
460 | - mesa
461 | video:
462 | - pipewire-jack
463 | - ffmpeg
464 | additional:
465 | - ampart-git
466 |
467 | # Flippy's Kernel for Allwinner
468 | - base: linux-aarch64-flippy-git
469 | description: Flippy's Kernel aiming to increase usability for Allwinner
470 | version: 6.6
471 | repo:
472 | - 7Ji
473 | compatible:
474 | - friendlyarm-nanopi-neo*
475 | - xunlong-orangepi-zero*
476 | recommended:
477 | - friendlyarm-nanopi-neo*
478 | - xunlong-orangepi-zero*
479 | experimental: null
480 | firmware:
481 | - linux-aarch64-flippy-git-dtb-allwinner
482 | graphics:
483 | - mesa
484 | video:
485 | - pipewire-jack
486 | - ffmpeg
487 | additional: null
488 |
489 | # 7Ji's Mainline Kernel
490 | - base: linux-aarch64-7ji
491 | description: 7Ji Linux Mainline Kernel with patches for Amlogic & RK3588
492 | version: lastest stable
493 | repo:
494 | - 7Ji
495 | compatible:
496 | - khadas-vim*
497 | - khadas-edge
498 | - radxa-zero*
499 | - radxa-rock-3*
500 | - radxa-rock-4*
501 | recommended: null
502 | experimental:
503 | - radxa-rock-5*
504 | - khadas-edge2
505 | - xunlong-orangepi-5*
506 | - rockchip-rk3588-orangepi*
507 | - rockchip-rk3588s-orangepi*
508 | - rockchip-rk3588-armsom*
509 | firmware: null
510 | graphics:
511 | - mesa
512 | video:
513 | - pipewire-jack
514 | - ffmpeg-mpp-git
515 | additional: null
516 |
517 | ########################################################################
518 |
--------------------------------------------------------------------------------
/config/language.yaml:
--------------------------------------------------------------------------------
1 | # __ __ __ _ ___ _ _ __ ___ ____ ____
2 | # ( ) / _\ ( ( \ / __)/ )( \ / _\ / __)( __)/ ___)
3 | # / (_/\/ \/ /( (_ \) \/ (/ \( (_ \ ) _) \___ \
4 | # \____/\_/\_/\_)__) \___/\____/\_/\_/ \___/(____)(____/
5 | # List of all locales / language code
6 | languages:
7 |
8 | ########################################################################
9 | # Sort by Languages
10 | langopt: Chinese
11 | langopt: English
12 | langopt: Spanish
13 | langopt: French
14 | langopt: German
15 | langopt: Arabic
16 | langopt: Others
17 |
18 | # Chinese
19 | langchi: cmn_TW (Taiwan)
20 | langchi: zh_CN (China)
21 | langchi: zh_HK (Hong Kong)
22 | langchi: zh_TW (Taiwan)
23 | langchi: zh_MO (Macau)
24 | langchi: zh_SG (Singapore)
25 | langchi: zu_ZA (South Africa)
26 | langchi: yue_HK (Hong Kong)
27 | langchi: hak_TW (Taiwan)
28 |
29 | # English
30 | langeng: en_AG (Antigua and Barbuda)
31 | langeng: en_AU (Australia)
32 | langeng: en_BW (Botswana)
33 | langeng: en_CA (Canada)
34 | langeng: en_DK (Denmark)
35 | langeng: en_GB (United Kingdom)
36 | langeng: en_HK (Hong Kong)
37 | langeng: en_IE (Ireland)
38 | langeng: en_IL (Israel)
39 | langeng: en_IN (India)
40 | langeng: en_NG (Nigeria)
41 | langeng: en_NZ (New Zealand)
42 | langeng: en_PH (Philippines)
43 | langeng: en_SC (Seychelles)
44 | langeng: en_SG (Singapore)
45 | langeng: en_US (United States)
46 | langeng: en_ZA (South Africa)
47 | langeng: en_ZM (Zambia)
48 | langeng: en_ZW (Zimbabwe)
49 |
50 | # Spanish
51 | langspa: es_AR (Argentina)
52 | langspa: es_BO (Bolivia)
53 | langspa: es_CL (Chile)
54 | langspa: es_CO (Colombia)
55 | langspa: es_CR (Costa Rica)
56 | langspa: es_CU (Cuba)
57 | langspa: es_DO (Dominican Republic)
58 | langspa: es_EC (Ecuador)
59 | langspa: es_ES (Spain)
60 | langspa: es_GT (Guatemala)
61 | langspa: es_HN (Honduras)
62 | langspa: es_MX (Mexico)
63 | langspa: es_NI (Nicaragua)
64 | langspa: es_PA (Panama)
65 | langspa: es_PE (Peru)
66 | langspa: es_PR (Puerto Rico)
67 | langspa: es_PY (Paraguay)
68 | langspa: es_SV (El Salvador)
69 | langspa: es_US (United States)
70 | langspa: es_UY (Uruguay)
71 | langspa: es_VE (Venezuela)
72 |
73 | # French
74 | langfre: fr_BE (Belgium)
75 | langfre: fr_CA (Canada)
76 | langfre: fr_CH (Switzerland)
77 | langfre: fr_FR (France)
78 | langfre: fr_LU (Luxembourg)
79 |
80 | # German
81 | langger: de_AT (Austria)
82 | langger: de_BE (Belgium)
83 | langger: de_CH (Switzerland)
84 | langger: de_DE (Germany)
85 | langger: de_IT (Italy)
86 | langger: de_LI (Liechtenstein)
87 | langger: de_LU (Luxembourg)
88 |
89 | # Arabic
90 | langara: ar_AE (United Arab Emirates)
91 | langara: ar_BH (Bahrain)
92 | langara: ar_DZ (Algeria)
93 | langara: ar_EG (Egypt)
94 | langara: ar_IN (India)
95 | langara: ar_IQ (Iraq)
96 | langara: ar_JO (Jordan)
97 | langara: ar_KW (Kuwait)
98 | langara: ar_LB (Lebanon)
99 | langara: ar_LY (Libya)
100 | langara: ar_MA (Morocco)
101 | langara: ar_OM (Oman)
102 | langara: ar_QA (Qatar)
103 | langara: ar_SA (Saudi Arabia)
104 | langara: ar_SD (Sudan)
105 | langara: ar_SS (South Sudan)
106 | langara: ar_SY (Syria)
107 | langara: ar_TN (Tunisia)
108 | langara: ar_YE (Yemen)
109 |
110 | ########################################################################
111 | # Sort by Contenients
112 | langcon: Asia
113 | langcon: Europe
114 | langcon: Americas
115 | langcon: Africa
116 | langcon: Others
117 |
118 | # Asia
119 | langconas: az_AZ (Azerbaijan)
120 | langconas: az_IR (Iran)
121 | langconas: as_IN (India)
122 | langconas: bhb_IN (India)
123 | langconas: bho_IN (India)
124 | langconas: bho_NP (Nepal)
125 | langconas: bo_CN (China)
126 | langconas: bo_IN (India)
127 | langconas: dz_BT (Bhutan)
128 | langconas: fa_IR (Iran)
129 | langconas: hi_IN (India)
130 | langconas: he_IL (Israel)
131 | langconas: id_ID (Indonesia)
132 | langconas: ja_JP (Japan)
133 | langconas: ka_GE (Georgia)
134 | langconas: kk_KZ (Kazakhstan)
135 | langconas: km_KH (Cambodia)
136 | langconas: kn_IN (India)
137 | langconas: ko_KR (Korea)
138 | langconas: th_TH (Thailand)
139 | langconas: ta_SG (Singapore)
140 | langconas: vi_VN (Vietnam)
141 | langconas: saq_KE (Kenya)
142 | langconas: ml_IN (India)
143 | langconas: ug_CN (China)
144 | langconas: or_IN (India)
145 | langconas: sw_KE (Kenya)
146 | langconas: ta_MY (Malaysia)
147 | langconas: ta_IN (India)
148 | langconas: brx_IN (India)
149 | langconas: pa_IN (India)
150 | langconas: ug_IR (Iran)
151 | langconas: pa_PK (Pakistan)
152 | langconas: ur_PK (Pakistan)
153 |
154 | # Europe
155 | langconeu: bg_BG (Bulgaria)
156 | langconeu: ca_IT (Italy)
157 | langconeu: ca_AD (Andorra)
158 | langconeu: ca_ES (Spain)
159 | langconeu: ast_ES (Spain)
160 | langconeu: ca_FR (France)
161 | langconeu: br_FR (France)
162 | langconeu: oc_FR (France)
163 | langconeu: cs_CZ (Czech Republic)
164 | langconeu: csb_PL (Poland)
165 | langconeu: da_DK (Denmark)
166 | langconeu: dsb_DE (Germany)
167 | langconeu: el_GR (Greece)
168 | langconeu: el_CY (Cyprus)
169 | langconeu: et_EE (Estonia)
170 | langconeu: eu_ES (Spain)
171 | langconeu: fi_FI (Finland)
172 | langconeu: fur_IT (Italy)
173 | langconeu: fy_NL (Netherlands)
174 | langconeu: fy_DE (Germany)
175 | langconeu: ga_IE (Ireland)
176 | langconeu: gl_ES (Spain)
177 | langconeu: hr_HR (Croatia)
178 | langconeu: hsb_DE (Germany)
179 | langconeu: ia_FR (France)
180 | langconeu: is_IS (Iceland)
181 | langconeu: it_CH (Switzerland)
182 | langconeu: it_IT (Italy)
183 | langconeu: lv_LV (Latvia)
184 | langconeu: mk_MK (North Macedonia)
185 | langconeu: mt_MT (Malta)
186 | langconeu: nb_NO (Norway)
187 | langconeu: nl_BE (Belgium)
188 | langconeu: nl_NL (Netherlands)
189 | langconeu: nn_NO (Norway)
190 | langconeu: no_NO (Norway)
191 | langconeu: pl_PL (Poland)
192 | langconeu: pt_PT (Portugal)
193 | langconeu: ro_RO (Romania)
194 | langconeu: sk_SK (Slovakia)
195 | langconeu: sl_SI (Slovenia)
196 | langconeu: sq_AL (Albania)
197 | langconeu: sv_FI (Finland)
198 | langconeu: sv_SE (Sweden)
199 | langconeu: tr_TR (Turkey)
200 | langconeu: uk_UA (Ukraine)
201 | langconeu: crh_UA (Ukraine)
202 | langconeu: gd_GB (United Kingdom)
203 | langconeu: gv_GB (United Kingdom)
204 | langconeu: cy_GB (United Kingdom)
205 | langconeu: se_NO (Norway)
206 |
207 | # Americas
208 | langconam: ayc_PE (Peru)
209 | langconam: qu_PE (Peru)
210 | langconam: chr_US (United States)
211 | langconam: iu_CA (Canada)
212 | langconam: pt_BR (Brazil)
213 | langconam: hif_FJ (Fiji)
214 | langconam: ik_CA (Canada)
215 |
216 | # Africa
217 | langconaf: aa_DJ (Djibouti)
218 | langconaf: aa_ER (Eritrea)
219 | langconaf: aa_ET (Ethiopia)
220 | langconaf: ber_DZ (Algeria)
221 | langconaf: ber_MA (Morocco)
222 | langconaf: gez_ER (Eritrea)
223 | langconaf: gez_ET (Ethiopia)
224 | langconaf: am_ET (Ethiopia)
225 | langconaf: kab_DZ (Algeria)
226 | langconaf: sid_ET (Ethiopia)
227 | langconaf: sn_ZW (Zimbabwe)
228 | langconaf: so_SO (Somalia)
229 | langconaf: shi_MA (Morocco)
230 | langconaf: shi_Tfng_MA (Morocco)
231 | langconaf: rw_RW (Rwanda)
232 | langconaf: nso_ZA (South Africa)
233 | langconaf: yo_NG (Nigeria)
234 | langconaf: xog_UG (Uganda)
235 |
236 | # Others
237 | langconother: ru_RU (Russia)
238 | langconother: cv_RU (Russia)
239 | langconother: ta_LK (Sri Lanka)
240 | langconother: ak_GH (Ghana)
241 | langconother: si_LK (Sri Lanka)
242 | langconother: dv_MV (Maldives)
243 | langconother: uz_UZ (Uzbekistan)
244 | langconother: sr_RS (Serbia)
245 | langconother: tk_TM (Turkmenistan)
246 | langconother: bi_VU (Vanuatu)
247 | langconother: sw_TZ (Tanzania)
248 | langconother: ce_RU (Russia)
249 | langconother: sah_RU (Russia)
250 | langconother: sr_CS (Serbia and Montenegro)
251 | langconother: tg_TJ (Tajikistan)
252 | langconother: ps_AF (Afghanistan)
253 | langconother: me_ME (Montenegro)
254 | langconother: ckb_IQ (Iraq)
255 | langconother: be_BY (Belarus)
256 | langconother: kl_GL (Greenland)
257 | langconother: bs_BA (Bosnia and Herzegovina)
258 | langconother: ug_UZ (Uzbekistan)
259 |
--------------------------------------------------------------------------------
/config/postinstall.yaml:
--------------------------------------------------------------------------------
1 | # ____ __ ____ ____ __ __ _ ____ ____ __ __ __
2 | # ( _ \ / \ / ___)(_ _) ( )( ( \/ ___)(_ _)/ _\ ( ) ( )
3 | # ) __/( O )\___ \ )( )( / /\___ \ )( / \/ (_/\/ (_/\
4 | # (__) \__/ (____/ (__) (__)\_)__)(____/ (__)\_/\_/\____/\____/
5 | # Post Installation for SBCs
6 | postinstall:
7 | ########################################################################
8 | # Minimum ACU Version
9 | - min_acu_verion: 0.0.7
10 | ########################################################################
11 | # Category List
12 | - categories:
13 | - category_name: Post-Install
14 | category_description: Post Installation for SBCs
15 | ########################################################################
16 | # Post Install List
17 | - items:
18 | ########################################################################
19 | # Items Usage / Examples
20 | # - package_name: Name to identify the package (small letter no space) (used for: acu install )
21 | # pretty_name: Name to be shown on the app list (can contain capital letter and space) (used for: acu apps)
22 | # category: Specific a category that this package belongs to from the category_name of the list above
23 | # description: Description of the package
24 | # compatible:
25 | # - Device tag list that this package is compatible with (this is optional when a package is suitable for any devices)
26 | # packages:
27 | # - Packages to be installed (this will be passed to acu install before running commands)
28 | # commands: |
29 | # # Commands to run when installing this packages
30 | # # This can be multiple lines
31 | # # This is mostly used for post install, which is optional
32 |
33 | # Disable Suspend
34 | - package_name: disable-suspend
35 | pretty_name: Disable Suspend
36 | category: Post-Install
37 | description: Disable System Suspend
38 | compatible:
39 | - radxa-rock-5*
40 | - radxa-cm5*
41 | - radxa-nx5*
42 | - xunlong-orangepi-5*
43 | - rockchip-rk3588s-orangepi*
44 | - rockchip-rk3588-orangepi*
45 | commands: |
46 | echo "Disable suspend ..."
47 | sudo mkdir -p /usr/lib/systemd/system/sleep.conf.d
48 | echo -e "[Sleep]\nAllowSuspend=no\nAllowHibernation=no\nAllowSuspendThenHibernate=no\nAllowHybridSleep=no" | sudo tee /usr/lib/systemd/system/sleep.conf.d/nosuspend.conf
49 |
50 | # FAN control for Khadas Edge 2
51 | - package_name: khadas-edges-fan-control
52 | pretty_name: Khadas Fan Control
53 | category: Post-Install
54 | description: FAN control for Khadas Edge 2
55 | compatible:
56 | - khadas-edge*
57 | commands: |
58 | echo "Installing FAN control for Edge 2 ..."
59 | curl -LJO https://raw.githubusercontent.com/khadas/fenix/master/archives/filesystem/special/Edge2/usr/local/bin/fan.sh
60 | sudo chmod +x fan.sh
61 | sudo mv fan.sh /usr/local/bin/fan.sh
62 | echo "Creating FAN control service ..."
63 | echo -e "[Unit]\nDescription=FAN control\nDefaultDependencies=no\nAfter=local-fs.target\n\n[Service]\nExecStart=/usr/bin/sudo /usr/local/bin/fan.sh\nRemainAfterExit=no\n\n[Install]\nWantedBy=sysinit.target" | sudo tee /usr/lib/systemd/system/fan.service
64 | sudo systemctl enable fan.service
65 |
66 | # AP6275P Fixup
67 | - package_name: ap6275p-fixup
68 | pretty_name: AP6275P Fixup
69 | category: Post-Install
70 | description: Fix networkmanager & enable bluetooth for AP6275P
71 | compatible:
72 | - khadas-edge*
73 | - xunlong-orangepi-5*
74 | - rockchip-rk3588s-orangepi*
75 | - rockchip-rk3588-orangepi*
76 | - rockchip-rk3588-armsom*
77 | - rockchip-rk3588s-tablet-12c-linux
78 | - rockchip-rk3588s-tablet-fydetab-linux
79 | commands: |
80 | #1 Switch Network Manager to iwd
81 | echo "Switch WiFi backend to iwd ..."
82 | sudo mkdir -p /etc/NetworkManager/conf.d
83 | echo -e "[device]\nwifi.backend=iwd" | sudo tee /etc/NetworkManager/conf.d/wifi_backend.conf
84 | sudo rm -rf /etc/netctl/*
85 | #2 Enable AP6275P bluetooth
86 | echo "Enable AP6275P Bluetooth ..."
87 | curl -LJO https://github.com/kwankiu/archlinux-installer/releases/download/kernel/brcm_patchram_plus
88 | sudo chmod +x brcm_patchram_plus
89 | sudo mv brcm_patchram_plus /usr/bin/brcm_patchram_plus
90 | echo -e '[Unit]\nDescription=AP6275P Bluetooth service\nAfter=bluetooth.target\n\n[Service]\nType=forking\nExecStartPre=/usr/sbin/rfkill unblock all\nExecStart=/usr/bin/brcm_patchram_plus --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /lib/firmware/ap6275p/BCM4362A2.hcd /dev/ttyS9\nTimeoutSec=0\nRemainAfterExit=yes\n[Install]\nWantedBy=multi-user.target' | sudo tee /usr/lib/systemd/system/bt_ap6275p.service
91 | sudo systemctl enable bt_ap6275p.service
92 |
93 | # Asahi mkinitpcio conf
94 | - package_name: asahi-mkinitcpio-conf
95 | pretty_name: Asahi mkinitpcio conf
96 | category: Post-Install
97 | description: Add asahi hook and modules to mkinitcpio conf
98 | compatible:
99 | - apple*
100 | commands: |
101 | echo "Add asahi hook and modules to mkinitcpio conf ..."
102 | sudo sed -i 's/MODULES=()/MODULES=(ext4 btrfs usbhid xhci_hcd)/g' /etc/mkinitcpio.conf
103 | sudo sed -i 's/HOOKS=(base /HOOKS=(base asahi /g' /etc/mkinitcpio.conf
104 | echo "Rebuilding initramfs ..."
105 | sudo mkinitcpio -P
106 |
107 | # RK3588 USB2 HOST
108 | - package_name: rk3588-usb2-host
109 | pretty_name: RK3588 USB2 Host
110 | category: Post-Install
111 | description: Set RK3588 USB2.0 OTG mode to host
112 | compatible:
113 | - xunlong-orangepi-5*
114 | - rockchip-rk3588s-orangepi*
115 | - rockchip-rk3588-orangepi*
116 | commands: |
117 | echo "Enable the USB 2.0 port ..."
118 | echo -e "[Unit]\nDescription=Enable the USB 2.0 port\n\n[Service]\nExecStart=/usr/bin/sh -c \\"echo host > /sys/kernel/debug/usb/fc000000.usb/mode\\"\nType=oneshot\n\n[Install]\nWantedBy=default.target" | sudo tee /usr/lib/systemd/system/enable-usb2.service
119 | sudo systemctl enable enable-usb2
120 |
121 | # Enable Panthor DT Overlay
122 | - package_name: enable-panthor-overlay
123 | pretty_name: Enable Panthor
124 | category: Post-Install
125 | description: Enable Panthor DT Overlay
126 | compatible: null
127 | commands: |
128 | echo "Add Panthor DT Overlay to boot config ..."
129 | acu update-boot-config --dtoverlay=rockchip-rk3588-panthor-gpu.dtbo
130 |
131 | # Grub ALARM Kernel Fixup
132 | - package_name: grub-fixup
133 | pretty_name: Grub Fixup
134 | category: Post-Install
135 | description: Grub ALARM Kernel Fixup
136 | compatible: null
137 | commands: |
138 | echo "Installing grub fixup ..."
139 | sudo pacman -S misc/grub --noconfirm
140 | echo "Updating boot config ..."
141 | acu update-boot-config
142 |
143 | ########################################################################
144 |
--------------------------------------------------------------------------------
/config/repo.yaml:
--------------------------------------------------------------------------------
1 | # __ ___ _ _ ____ ____ ____ __ ____ __ ____ __ ____ __ ____ ____
2 | # / _\ / __)/ )( \ ( _ \( __)( _ \ / \ / ___)( )(_ _)/ \( _ \( )( __)/ ___)
3 | # / \( (__ ) \/ ( ) / ) _) ) __/( O )\___ \ )( )( ( O )) / )( ) _) \___ \
4 | # \_/\_/ \___)\____/ (__\_)(____)(__) \__/ (____/(__) (__) \__/(__\_)(__)(____)(____/
5 | # List of package repositories managed by acu
6 | repositories:
7 |
8 | #- repo_name: example
9 | # repo_type: git #available types are acu, agr and git.
10 | # repo_url: https://example.com #url format PROTOCOL://HOST/SUBTREE:BRANCH
11 |
12 | - repo_name: apps
13 | repo_type: acu
14 | repo_url: https://raw.githubusercontent.com/kwankiu/acu/main/examples/apps.yaml
15 |
16 | - repo_name: desktop
17 | repo_type: acu
18 | repo_url: https://raw.githubusercontent.com/kwankiu/archlinux-installer/main/config/desktop.yaml
19 |
20 | - repo_name: postinstall
21 | repo_type: acu
22 | repo_url: https://raw.githubusercontent.com/kwankiu/archlinux-installer/main/config/postinstall.yaml
23 |
24 | - repo_name: AUR
25 | repo_type: git
26 | repo_url: https://aur.archlinux.org
27 |
28 |
29 |
--------------------------------------------------------------------------------
/create-installation-media:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #################################################################
4 | # _ _ _ #
5 | # /\ | | | | (_) #
6 | # / \ _ __ ___| |__ | | _ _ __ _ ___ __ #
7 | # / /\ \ | '__/ __| '_ \| | | | '_ \| | | \ \/ / #
8 | # / ____ \| | | (__| | | | |____| | | | | |_| |> < #
9 | # /_/ \_\_| \___|_| |_|______|_|_| |_|\__,_/_/\_\ __ #
10 | # _____ _ _ _ ( __)/ \( _ \ #
11 | # |_ _| | | | | | ) _)( O )) / #
12 | # | | _ __ ___| |_ __ _| | | ___ _ __ (__) \__/(__\_) #
13 | # | | | '_ \/ __| __/ _` | | |/ _ \ '__| /__\ ( _ \( \/ ) #
14 | # _| |_| | | \__ \ || (_| | | | __/ | / \ ) // \/ \ #
15 | # |_____|_| |_|___/\__\__,_|_|_|\___|_| \_/\_/(__\_)\_)(_/ #
16 | # #
17 | # Installation Media Tool #
18 | #################################################################
19 |
20 | # Define variables
21 | # Define main / dev branch
22 | branch=main
23 |
24 | # Arch Linux Rootfs URL
25 | rootfs_url="http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz"
26 |
27 | # Custom Binary Repo URL for building the installer or images
28 | adrepo_url="https://api.github.com/repos/kwankiu/archlinux-installer/releases/tags/kernel"
29 |
30 | # Required ACU version
31 | acuver=0.1.6
32 |
33 | ################################################################
34 | # Tools
35 | system_arch=$(uname -m)
36 |
37 | # Define terminal color codes
38 | RED='\033[0;31m'
39 | GREEN='\033[0;32m'
40 | YELLOW='\033[0;33m'
41 | BLUE='\033[0;36m'
42 | NC='\033[0m' # No Color
43 |
44 | # Option Picker
45 | function select_option {
46 |
47 | # Little helpers for terminal print control and key input
48 | ESC=$( printf "\033")
49 | cursor_blink_on() { printf "$ESC[?25h"; }
50 | cursor_blink_off() { printf "$ESC[?25l"; }
51 | cursor_to() { printf "$ESC[$1;${2:-1}H"; }
52 | print_option() { printf " $1 "; }
53 | print_selected() { printf " $ESC[7m $1 $ESC[27m"; }
54 | get_cursor_row() { IFS=';' read -sdR -p $'\E[6n' ROW COL; echo ${ROW#*[}; }
55 | key_input() { read -s -n3 key 2>/dev/null >&2
56 | if [[ $key = $ESC[A ]]; then echo up; fi
57 | if [[ $key = $ESC[B ]]; then echo down; fi
58 | if [[ $key = "" ]]; then echo enter; fi; }
59 |
60 | # Initially print empty new lines (scroll down if at bottom of screen)
61 | for opt; do printf "\n"; done
62 |
63 | # Determine current screen position for overwriting the options
64 | local lastrow=`get_cursor_row`
65 | local startrow=$(($lastrow - $#))
66 |
67 | # Ensure cursor and input echoing back on upon a ctrl+c during read -s
68 | trap "cursor_blink_on; stty echo; printf '\n'; exit" 2
69 | cursor_blink_off
70 |
71 | local selected=0
72 | while true; do
73 | # Print options by overwriting the last lines
74 | local idx=0
75 | local max_width=$(tput cols)
76 | for opt; do
77 | cursor_to $(($startrow + $idx))
78 | local formatted_opt="$((idx + 1)) \t $opt"
79 | local formatted_opt=$(echo "$formatted_opt" | cut -c1-$((max_width - 3)))
80 | if [ $idx -eq $selected ]; then
81 | print_selected "$formatted_opt"
82 | else
83 | print_option "$formatted_opt"
84 | fi
85 | ((idx++))
86 | done
87 |
88 | # User key control
89 | case `key_input` in
90 | enter) break;;
91 | up) ((selected--));
92 | if [ $selected -lt 0 ]; then selected=$(($# - 1)); fi;;
93 | down) ((selected++));
94 | if [ $selected -ge $# ]; then selected=0; fi;;
95 | esac
96 | done
97 |
98 | # Cursor position back to normal
99 | cursor_to $lastrow
100 | printf "\n"
101 | cursor_blink_on
102 |
103 | return $selected
104 | }
105 |
106 | # Echo with colors
107 | colorecho() {
108 | color="$1"
109 | text="$2"
110 | echo -e "${color}${text}${NC}"
111 | }
112 |
113 | # Title / Heading
114 | title() {
115 | clear
116 | echo "---------------------------------------------------------------------"
117 | colorecho "$BLUE" "Arch Linux Installer - Create Installation Media"
118 | echo "---------------------------------------------------------------------"
119 | }
120 |
121 | ################################################################
122 | # Functions for Selecting disk to install and creating new image
123 |
124 | # get list of available disks for WSL (Windows)
125 | wsl_disks() {
126 | local i
127 | k=1
128 | wsl_drive=()
129 | for i in "${output[@]}"; do
130 | # Split the data
131 | IFS=" " read -r part1 part2 part3 <<<"$i"
132 |
133 | # Calculate storage size in GB
134 | part2="$((part2 / 1024 / 1024 / 1024)) GB"
135 |
136 | # Trim leading and trailing whitespace from part3
137 | part3=$(echo "$part3" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
138 |
139 | # Construct the option string
140 | option="${part1} - ${part3} (${part2})"
141 |
142 | # Add to Drive List
143 | wsl_drive+=("${part1}")
144 |
145 | # Add the option to the options array
146 | options+=("${k}) $option")
147 | k=$((k + 1))
148 | done
149 | }
150 |
151 | # List available disks for WSL (Windows)
152 | list_wsl() {
153 | options=()
154 |
155 | # For WSL
156 | if [ ! -z "$WSL_DISTRO_NAME" ]; then
157 | # Get USB Device List from PowerShell
158 | IFS=$'\n' read -d '' -ra output <<<"$(powershell.exe 'GET-CimInstance -query "SELECT MODEL,SIZE from Win32_DiskDrive"')"
159 | output=("${output[@]:3:${#output[@]}-5}")
160 |
161 | wsl_disks
162 | # set i to k and adjust i to match below
163 | i=$((k * 3 - 1))
164 | else
165 | disks=($(lsblk -rdno NAME,SIZE,MODEL | awk -F' ' '{ if (NF == 2) { $3 = "Unknown" } }1'))
166 | for ((i = 0; i < ${#disks[@]}; i += 3)); do
167 | model=${disks[i + 2]//\\x20/ } # Replace escaped spaces with actual spaces
168 | options+=("$((i / 3 + 1))) /dev/${disks[i]} - $model (${disks[i + 1]})")
169 | done
170 | fi
171 |
172 | options+=("Skip (if you want to create an image or already mounted a disk)")
173 | select_option "${options[@]}"
174 | choice=$?
175 | choice=$((choice + 1))
176 |
177 | if [[ $choice =~ ^[0-99]+$ && $choice -ge 1 && $choice -le $((i / 3 + 2)) ]]; then
178 | if [[ $choice -le $((i / 3)) ]]; then
179 | # For WSL
180 | if [ ! -z "$WSL_DISTRO_NAME" ]; then
181 | colorecho "$GREEN" "Selected $((choice - 1)) Disk ${wsl_drive[(choice - 1)]}"
182 | powershell.exe 'if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; } wsl --mount '${wsl_drive[(choice - 1)]}
183 | fi
184 | selected_disk="/dev/${disks[((choice - 1) * 3)]}"
185 | fi
186 | else
187 | colorecho "$RED" "Invalid choice $choice. Please select a valid option."
188 | fi
189 | }
190 |
191 | # List available disks
192 | list_disks() {
193 | options=()
194 | disks=($(lsblk -rdno NAME,SIZE,MODEL | awk -F' ' '{ if (NF == 2) { $3 = "Unknown" } }1'))
195 | for ((i = 0; i < ${#disks[@]}; i += 3)); do
196 | model=${disks[i + 2]//\\x20/ } # Replace escaped spaces with actual spaces
197 | options+=("$((i / 3 + 1))) /dev/${disks[i]} - $model (${disks[i + 1]})")
198 | done
199 | options+=("$((i / 3 + 1))) Create an (.img) image")
200 | options+=("$((i / 3 + 2))) Enter disk path manually")
201 |
202 | select_option "${options[@]}"
203 | choice=$?
204 | choice=$((choice + 1))
205 |
206 | if [[ $choice =~ ^[0-9]+$ && $choice -ge 1 && $choice -le $((i / 3 + 2)) ]]; then
207 | if [[ $choice -le $((i / 3)) ]]; then
208 | selected_disk="/dev/${disks[((choice - 1) * 3)]}"
209 | elif [[ $choice -eq $((i / 3 + 1)) ]]; then
210 | # Create Image
211 | read -p "Image Name (default=archlinux-installer.img): " selected_disk
212 | if [ -z "$selected_disk" ]; then
213 | selected_disk="archlinux-installer.img"
214 | else
215 | selected_disk="$selected_disk"
216 | fi
217 | create_img
218 |
219 | else
220 | read -p "Enter the disk path: " selected_disk
221 | colorecho "$YELLOW" "Manually entered disk path $selected_disk."
222 | fi
223 | else
224 | colorecho "$RED" "Invalid choice $choice. Please select a valid option."
225 | fi
226 | }
227 |
228 | # Create a disk image
229 | create_img() {
230 |
231 | if [ ! -d "out" ]; then
232 | mkdir out
233 | fi
234 |
235 | if [ -z "$argsize" ]; then
236 | img_size="4G"
237 | else
238 | img_size=$argsize
239 | fi
240 |
241 | if [ ! -z "$argimg" ]; then
242 | selected_disk=$argimg
243 | fi
244 |
245 | # if $argmountimg is not set, create a disk image, else use the specified image as base
246 | if [ -z "$argmountimg" ]; then
247 | # Check if out/$selected_disk exists and generate a unique name if needed
248 | if [ -e "out/$selected_disk" ]; then
249 | counter=0
250 | base_name="${selected_disk%.img}"
251 | new_name="${base_name}.img"
252 |
253 | while [ -e "out/$new_name" ]; do
254 | counter=$((counter + 1))
255 | new_name="${base_name}-${counter}.img"
256 | done
257 |
258 | selected_disk="$new_name"
259 | echo "Renamed to $selected_disk as file already exists."
260 | fi
261 | selected_disk="out/$selected_disk"
262 | sudo truncate -s $img_size $selected_disk
263 | colorecho "$GREEN" "Image created at $selected_disk"
264 | is_img=$selected_disk
265 | if [ -z "$argdisk" ]; then
266 | img_mount=$(sudo losetup -fP --show $(pwd)/$selected_disk)
267 | else
268 | img_mount=$argdisk
269 | sudo losetup -P $img_mount $(pwd)/$selected_disk
270 | fi
271 | selected_disk=$img_mount
272 | else
273 | img_mount=$(sudo losetup -fP --show $argimg)
274 | is_img=$argimg
275 | selected_disk=$img_mount
276 | fi
277 | colorecho "$GREEN" "Image mounted on $selected_disk"
278 | }
279 |
280 | # Confirm selected disk
281 | confirm_disk() {
282 | drive=$selected_disk
283 | colorecho "$GREEN" "Selected disk $drive."
284 | colorecho "$YELLOW" "Confirm to install Arch Linux on $drive ?"
285 | colorecho "$RED" "WARNING : all data on the disk will be deleted"
286 |
287 | options=("Confirm" "Select another disk" "Exit Installer")
288 | select_option "${options[@]}"
289 | answer=$?
290 |
291 | if [ "$answer" = 1 ]; then
292 | title
293 | colorecho "$GREEN" "Select a disk to install or create an image:"
294 | list_disks
295 | title
296 | confirm_disk
297 | elif [ "$answer" = 2 ]; then
298 | echo "Aborted. Exiting ..."
299 | exit 1
300 | fi
301 | }
302 |
303 | ################################################################
304 | # Functions to Get Packages
305 |
306 | # Download additional packages to $compiled_pkg_folder
307 | add_pkg() {
308 | local pkgtoadd=$1
309 | local pkgrepo=$2
310 | colorecho "$GREEN" "Downloading $pkgtoadd ..."
311 |
312 | if [ -z "$pkgrepo" ] || [ "$pkgrepo" = "adrepo" ]; then
313 | echo -e "y" | ghrel_packages $pkgtoadd
314 | pkg_tar=($(echo -e "n" | ghrel_packages $pkgtoadd | grep .*pkg.*))
315 | else
316 | echo -e "y" | archarm_packages $pkgtoadd $pkgrepo
317 | pkg_tar=($(echo -e "n" | archarm_packages $pkgtoadd $pkgrepo | grep .*pkg.*))
318 | fi
319 |
320 | for pkg in "${pkg_tar[@]}"; do
321 | sudo cp -r "$pkg" "${root_mount_dir}${compiled_pkg_dir}"
322 | done
323 |
324 | # Clean up
325 | sudo rm -rf "${pkg_tar[@]}"
326 | }
327 |
328 | # Install the linux kernel (manually)
329 | install_kernel() {
330 | kernel_name=$1
331 | pkg_tar_dir=$(mktemp -d)
332 | colorecho "$GREEN" "Downloading $kernel_name ..."
333 | echo -e "y" | ghrel_packages $kernel_name
334 |
335 | pkg_tar=($(echo -e "n" | ghrel_packages $kernel_name | grep .*pkg.*))
336 | non_pkg=($(echo -e "n" | ghrel_packages $kernel_name | grep $kernel_name | grep -v .*pkg.*))
337 |
338 | # Extract kernel
339 | colorecho "$GREEN" "Extracting $kernel_name ..."
340 |
341 | # Create folder in pkg_tar_dir
342 | sudo mkdir $pkg_tar_dir/Kernel
343 | sudo mkdir $pkg_tar_dir/Kernel/linux
344 | sudo mkdir $pkg_tar_dir/Kernel/linux/boot
345 |
346 | # Manually install Kernel package
347 | for pkg in "${pkg_tar[@]}"; do
348 | sudo tar -xf "$pkg" -C "$pkg_tar_dir/Kernel/linux/"
349 | done
350 |
351 | # Copy initramfs and vmlinuz
352 | sudo cp -r initramfs-${kernel_name}.img $pkg_tar_dir/Kernel/linux/boot/initramfs-${kernel_name}.img
353 | sudo cp -r $pkg_tar_dir/Kernel/linux/usr/lib/modules/*/vmlinuz $pkg_tar_dir/Kernel/linux/boot/vmlinuz-${kernel_name}
354 |
355 | # set Boot source dir
356 | boot_image=$pkg_tar_dir/Kernel/linux/boot
357 |
358 | # Clean up
359 | sudo rm -rf "${pkg_tar[@]}" "${non_pkg[@]}"
360 | }
361 |
362 | # Download Packages from a GitHub Release Repo
363 | ghrel_packages() {
364 |
365 | if [ -z "$1" ]; then
366 | colorecho "$RED" "Error: No package specified."
367 | exit 1
368 | else
369 | dgpkg=$1
370 | fi
371 |
372 | repo_url=("$adrepo_url")
373 | dgpkg_list=()
374 |
375 | for which_url in "${repo_url[@]}"; do
376 | colorecho "$GREEN" "Fetching $which_url ..."
377 | dgpkg_list+=($(curl -s "$which_url" | grep -v '.sig' | grep -B 1 ${dgpkg} | grep -oP '"browser_download_url": "\K[^"]+'))
378 | done
379 |
380 | echo ""
381 | colorecho "$BLUE" "The following packages will be downloaded:"
382 | echo ""
383 | for url in "${dgpkg_list[@]}"; do
384 | selection=$(basename "$url")
385 | echo "$selection"
386 | done
387 | echo ""
388 | echo -ne $"${BLUE}Are you sure to download the packages (y/n)?${NC}"
389 | read answer
390 |
391 | if [ "$answer" = "y" ]; then
392 | for url in "${dgpkg_list[@]}"; do
393 | selection=$(basename "$url")
394 | echo "Downloading $selection"
395 | curl -LJO "$url"
396 |
397 | if [ ! -z "$2" ]; then
398 | sudo cp -r $selection $2/$selection
399 | sudo rm -rf $selection
400 | fi
401 |
402 | done
403 | fi
404 |
405 | }
406 |
407 | # Download Packages from Arch Linux ARM Repo
408 | archarm_packages() {
409 |
410 | if [ -z "$1" ]; then
411 | colorecho "$RED" "Error: No package specified."
412 | exit 1
413 | else
414 | dgpkg=$1
415 | fi
416 |
417 | repo_url=("http://mirror.archlinuxarm.org/aarch64/$2")
418 | dgpkg_list=()
419 |
420 | for which_url in "${repo_url[@]}"; do
421 | colorecho "$GREEN" "Fetching $which_url ..."
422 | dgpkg_list=$(curl -sL "$which_url" | grep -v '.sig' | grep -o 'href="[^"]*"' | sed 's/href="//;s/"$//' | grep -o "^${dgpkg}.*")
423 | done
424 |
425 | echo ""
426 | colorecho "$BLUE" "The following packages will be downloaded:"
427 | echo ""
428 | for url in "${dgpkg_list[@]}"; do
429 | selection=$(basename "$url")
430 | echo "$selection"
431 | done
432 | echo ""
433 | echo -ne $"${BLUE}Are you sure to download the packages (y/n)?${NC}"
434 | read answer
435 |
436 | if [ "$answer" = "y" ]; then
437 | for url in "${dgpkg_list[@]}"; do
438 | selection=$url
439 | echo "Downloading $selection"
440 | curl -LJO "$which_url/$url"
441 |
442 | if [ ! -z "$3" ]; then
443 | sudo cp -r $selection $3/$selection
444 | sudo rm -rf $selection
445 | fi
446 |
447 | done
448 | fi
449 | }
450 |
451 | ################################################################
452 | # Loop through the arguments
453 | for arg in "$@"; do
454 | case "$arg" in
455 | -h | --help)
456 | colorecho "$BLUE" "Arch Linux Installation Tool for Rock 5 / RK3588 ($branch)"
457 | echo "Usage: create-installation-media "
458 |
459 | colorecho "$GREEN" "Options"
460 | echo "-h / --help : Usage and Infomation of this Installation Tool."
461 | echo "-d / --dev : Use latest dev version of this Installation Tool."
462 | echo "-i / --image : Create a disk image with default image name (-archlinux-.) at out folder."
463 | echo "-k / --kernel : Create Arch Linux using default kernel option."
464 | echo "-b / --bootpart : Create Arch Linux with a seperated boot partition."
465 | echo "-e / --esppart : Create Arch Linux with a seperated EFI system partition (ESP)."
466 | echo "NOTE THAT --bootpart and --esppart MAY NOT be used together."
467 | echo "-c / --compress : Compress the Disk Image to .img.xz"
468 | echo "-m / --mtimg : Skip partitioning and use an image instead. (When this argument is used, --image= will become the image to be used)"
469 | echo "--image= : Create a disk image with the specified image name at out folder."
470 | echo "--vmimages= : Generate Virtual Machine images, check qemu-img for supported formats, you may specify more than one format separated by comma."
471 | echo "--size= : Set disk image size (default is 4G)."
472 | echo "--disk= : Create Arch Linux on the specified disk path (or the image mount point when used with -i or --image which is /dev/loop1 by default)."
473 | echo "--kernel= : Set kernel package to get from repo."
474 | echo "--addpkg= : Get extra packages from repo (same as where it gets kernel packages) that is installed during first boot, you may specify multiple packages seperated by comma."
475 | echo "--adrepourl= : Use a custom binary repo instead of the default one, it overrides the default adrepo_url, used for building the installer or images."
476 | echo "--model= : Set a device model to generate boot config for."
477 | echo "--bootfirmware= : Flash a boot firmware to the target disk or image. The specified path must be .img file or a directory that contains idbloader.img and uboot.itb"
478 | echo "--bootloader= : Set which bootloader to use for config, available options are extlinux and grub (default is extlinux)."
479 | echo "--bootpartstart= : Set Boot/Config Partition Start Sector (default is 16MiB)."
480 | echo "--bootpartend= : Set Boot/Config Partition End Sector (default is 32MiB for Config or 500MiB for Boot)."
481 | echo "--installer= : Set which Installer to use (options: installer (default))."
482 | echo "--script= : Run an additional script in chroot."
483 | exit 1
484 | ;;
485 | -d | --dev)
486 | echo "Getting the latest installation script from dev ..."
487 | bash <(curl -fsSL https://raw.githubusercontent.com/kwankiu/archlinux-installer/dev/archlinux-installer) ${@:2}
488 | exit 1
489 | ;;
490 | --get-pkg)
491 | colorecho "$RED" "For debug only."
492 | ghrel_packages $2 $3
493 | exit 1
494 | ;;
495 | --arch-pkg)
496 | colorecho "$RED" "For debug only."
497 | archarm_packages $2 $3
498 | exit 1
499 | ;;
500 | --installer=*)
501 | arginstaller="${arg#*=}"
502 | ;;
503 | --script=*)
504 | argscripts="${arg#*=}"
505 | ;;
506 | --image=*)
507 | argimg="${arg#*=}"
508 | ;;
509 | --vmimages=*)
510 | IFS=',' read -r -a argvmimgs <<< "${arg#*=}"
511 | ;;
512 | --disk=*)
513 | argdisk="${arg#*=}"
514 | ;;
515 | --size=*)
516 | argsize="${arg#*=}"
517 | ;;
518 | --kernel=*)
519 | argkrl="${arg#*=}"
520 | colorecho "$GREEN" "Build image with kernel: ${argkrl}"
521 | ;;
522 | --model=* | --sbc=*)
523 | argmodel="${arg#*=}"
524 | colorecho "$GREEN" "Build image for target device: ${argmodel}"
525 | ;;
526 | --addpkg=*)
527 | argaddpkg="${arg#*=}"
528 | colorecho "$GREEN" "Get extra packages that matches: ${argaddpkg}"
529 | ;;
530 | --adrepourl=*)
531 | adrepo_url="${arg#*=}"
532 | colorecho "$RED" "Using custom package repo at ${adrepo_url}"
533 | ;;
534 | --bootfirmware=*)
535 | argbootfw="${arg#*=}"
536 | colorecho "$GREEN" "Build image with boot firmware from ${argbootfw}"
537 | ;;
538 | --bootloader=*)
539 | argbootld="${arg#*=}"
540 | colorecho "$GREEN" "Build image with bootloader ${argbootld}"
541 | ;;
542 | --bootpartstart=*)
543 | argbootptst="${arg#*=}"
544 | ;;
545 | --bootpartend=*)
546 | argbootpted="${arg#*=}"
547 | ;;
548 | -i | --image)
549 | argimg="aarch64-archlinux-installer.img"
550 | ;;
551 | -k | --kernel)
552 | argkrl="linux"
553 | ;;
554 | -b | --bootpart)
555 | argbootpt=1
556 | ;;
557 | -e | --esppart)
558 | argesppt=1
559 | ;;
560 | -c | --compress)
561 | argxz=1
562 | ;;
563 | -m | --mtimg)
564 | argmountimg=1
565 | ;;
566 | -*)
567 | colorecho "$RED" "Invalid command or argument."
568 | exit 1
569 | ;;
570 | esac
571 | done
572 |
573 | ################################################################
574 | # Main Program
575 | title
576 |
577 | # Check if system is WSL (Windows)
578 | if [ ! -z "$WSL_DISTRO_NAME" ]; then
579 | colorecho "$YELLOW" "Warning: Running on WSL2 is experimental."
580 | if [ -f /etc/lsb-release ] || [ -x "$(command -v apt-get)" ] || [ -x "$(command -v apt)" ]; then
581 | colorecho "$YELLOW" "Make sure this is your default WSL distro, else it wont works."
582 | else
583 | colorecho "$RED" "Error: Only Debian / Ubuntu Based Distro on WSL2 are supported. Disk listed below will NOT work."
584 | colorecho "$GREEN" "However, you can still create an image."
585 | fi
586 | fi
587 |
588 | # Check if parted is installed
589 | if ! [ -x "$(command -v parted)" ]; then
590 | # Check Linux distribution
591 | colorecho "$YELLOW" "Parted is not found, trying to install..."
592 | if [ -f /etc/lsb-release ] || [ -x "$(command -v apt-get)" ]; then
593 | # Debian/Ubuntu-based
594 | sudo apt-get update
595 | sudo apt-get install -y parted
596 | elif [ -f /etc/redhat-release ]; then
597 | # Red Hat-based
598 | sudo yum update
599 | sudo yum install -y parted
600 | elif [ -f /etc/arch-release ]; then
601 | # Arch Linux
602 | sudo pacman -S parted --noconfirm
603 | elif [ -x "$(command -v apk)" ]; then
604 | # Alphine-based
605 | apk add parted
606 | else
607 | colorecho "$RED" "Error : We cant find or install parted on your system. Exiting..."
608 | exit 1
609 | fi
610 | fi
611 |
612 | # Check if bsdtar is installed
613 | if ! [ -x "$(command -v bsdtar)" ]; then
614 | # Check Linux distribution
615 | colorecho "$YELLOW" "bsdtar command not found, trying to install..."
616 | if [ -f /etc/lsb-release ] || [ -x "$(command -v apt-get)" ]; then
617 | # Debian/Ubuntu-based
618 | sudo apt-get update
619 | sudo apt-get install -y libarchive-tools
620 | elif [ -f /etc/redhat-release ]; then
621 | # Red Hat-based
622 | sudo yum update
623 | sudo yum install -y libarchive-tools
624 | elif [ -x "$(command -v apk)" ]; then
625 | # Alphine-based
626 | apk add libarchive-tools
627 | else
628 | colorecho "$RED" "Error : We cant find or install bsdtar on your system. Exiting..."
629 | exit 1
630 | fi
631 | fi
632 |
633 | # Check if mkfs.vat is installed
634 | if ! [ -x "$(command -v mkfs.vfat)" ]; then
635 | # Check Linux distribution
636 | colorecho "$YELLOW" "mkfs.vat command not found, trying to install..."
637 | if [ -f /etc/lsb-release ] || [ -x "$(command -v apt-get)" ]; then
638 | # Debian/Ubuntu-based
639 | sudo apt-get update
640 | sudo apt-get install -y dosfstools
641 | elif [ -f /etc/redhat-release ]; then
642 | # Red Hat-based
643 | sudo yum update
644 | sudo yum install -y dosfstools
645 | elif [ -f /etc/arch-release ]; then
646 | # Arch Linux
647 | sudo pacman -S dosfstools --noconfirm
648 | elif [ -x "$(command -v apk)" ]; then
649 | # Alphine-based
650 | apk add parted dosfstools
651 | else
652 | colorecho "$RED" "Error : We cant find or install dosfstools (mkfs.vfat) on your system. Exiting..."
653 | exit 1
654 | fi
655 | fi
656 |
657 | echo "System is $system_arch"
658 | # Check qemu-aarch64-static is installed if x86_64
659 | if [ "$system_arch" == "x86_64" ]; then
660 | # Check if qemu-aarch64-static is installed
661 | if ! [ -e "/usr/bin/qemu-aarch64-static" ]; then
662 | # Check Linux distribution
663 | colorecho "$YELLOW" "qemu-aarch64-static is not found, trying to install..."
664 | if [ -f /etc/lsb-release ] || [ -x "$(command -v apt-get)" ]; then
665 | # Debian/Ubuntu-based
666 | sudo apt-get update
667 | sudo apt-get install -y qemu-user-static
668 | elif [ -f /etc/redhat-release ]; then
669 | # Red Hat-based
670 | sudo yum update
671 | sudo yum install -y qemu-user-static
672 | elif [ -f /etc/arch-release ]; then
673 | # Arch Linux
674 | sudo pacman -S qemu-user-static --noconfirm
675 | elif [ -x "$(command -v apk)" ]; then
676 | # Alphine-based
677 | apk add qemu-user-static
678 | else
679 | colorecho "$RED" "Error : qemu-aarch64-static is not installed."
680 | fi
681 | fi
682 |
683 | S1=':qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7'
684 | S2=':\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-static:CF'
685 | echo -n $S1$S2 | sudo tee /lib/binfmt.d/05-local-qemu-aarch64-static.conf
686 | echo
687 | sudo systemctl restart systemd-binfmt.service
688 | fi
689 |
690 | # Check if arch-install-scripts is installed
691 | if [ -z "$(command -v arch-chroot)" ]; then
692 | # Check Linux distribution
693 | colorecho "$YELLOW" "arch-chroot is not found, trying to install arch-install-scripts ..."
694 | if [ -f /etc/lsb-release ] || [ -x "$(command -v apt-get)" ]; then
695 | # Debian/Ubuntu-based
696 | sudo apt-get install -y arch-install-scripts
697 | elif [ -f /etc/arch-release ]; then
698 | # Arch Linux
699 | sudo pacman -S arch-install-scripts --noconfirm
700 | else
701 | colorecho "$RED" "Error : arch-install-scripts is not installed."
702 | fi
703 | fi
704 |
705 | ################################################################
706 | # Show interactive menu if no corresponding arguments were set
707 |
708 | # Choose drive to install / create .img image
709 | if [ -z "$argimg" ] && [ -z "$argdisk" ]; then
710 | if [ ! -z "$WSL_DISTRO_NAME" ]; then
711 | colorecho "$GREEN" "Mount a Disk to Continue:"
712 | list_wsl
713 | colorecho "$GREEN" "If you sees an error, it is normal when your disk doesnt have a windows supported partiton."
714 | colorecho "$GREEN" "Just Pick the disk that we just mounted."
715 | colorecho "$GREEN" "Select a disk to install or create an image:"
716 | list_disks
717 | else
718 | colorecho "$GREEN" "Select a disk to install or create an image:"
719 | list_disks
720 | fi
721 |
722 | # Confirm Disk
723 | title
724 | confirm_disk
725 | elif [ -z "$argimg" ]; then
726 | drive=$argdisk
727 | else
728 | create_img
729 | drive=$selected_disk
730 | fi
731 |
732 | # Install boot partition and kernel
733 | if [ -z "$argkrl" ]; then
734 | title
735 | colorecho "$GREEN" "Select a kernel to install:"
736 | options=("linux-aarch64 - Linux Aarch64 Mainline Kernel")
737 | options+=("Enter a kernel package (from adrepo)")
738 | select_option "${options[@]}"
739 | answer=$?
740 | else
741 | answer=99
742 | fi
743 |
744 | if [ "$answer" = 0 ] || [ "$argkrl" = "linux" ]; then
745 | echo "Using mainline kernel"
746 | argkrl="linux"
747 | else
748 | if [ -z "$argkrl" ]; then
749 | read -p "Enter kernel package name:" answer
750 | else
751 | answer=$argkrl
752 | fi
753 | install_kernel $answer
754 | fi
755 |
756 | ################################################################
757 | # Start creating the installation media
758 | title
759 | root_mount_dir=$(mktemp -d) #create tmp dir for rootfs partition
760 |
761 | # if boot part argument is set, make a boot partition, else we will use the /boot of rootfs
762 | if [ "$argbootpt" = 1 ]; then
763 | boot_mount_dir=$(mktemp -d) #create tmp dir for boot partition
764 | fi
765 |
766 | # if esp part argument is set, make a esp partition, else we will use the /boot/EFI of rootfs
767 | if [ "$argesppt" = 1 ]; then
768 | esp_mount_dir=$(mktemp -d) #create tmp dir for esp partition
769 | fi
770 |
771 | # if $argmountimg is not set, format and partition the image/disk, else use the specified image as base
772 | if [ -z "$argmountimg" ]; then
773 | # Unmount all partitions of the specified drive
774 | colorecho "$GREEN" "Unmounting disk ..."
775 | partitions=$(ls ${drive}* 2>/dev/null)
776 | if [ "$partitions" ]; then
777 | for partition in $partitions; do
778 | sudo umount $partition 2>/dev/null || true
779 | done
780 | fi
781 |
782 | # Create GPT table and partitions
783 | colorecho "$GREEN" "Creating Partition Table ..."
784 | echo -e "Yes" | sudo parted $drive mklabel gpt ---pretend-input-tty
785 |
786 | # Pack boot firmware
787 | if [ -n "$argbootfw" ]; then
788 | colorecho "$GREEN" "Flashing boot firmware ..."
789 |
790 | if [[ "$argbootfw" == *".img" ]]; then
791 | sudo dd if="$argbootfw" of="$drive" conv=notrunc
792 | echo -e "OK\nFix" | sudo parted $drive print ---pretend-input-tty
793 | elif [ -f "$argbootfw/idbloader.img" ] && [ -f "$argbootfw/u-boot.itb" ]; then
794 | sudo dd if="$argbootfw/idbloader.img" of="$drive" seek=64 conv=notrunc
795 | sudo dd if="$argbootfw/u-boot.itb" of="$drive" seek=16384 conv=notrunc
796 | elif [ -f "$argbootfw/idblock.bin" ] && [ -f "$argbootfw/uboot.img" ]; then
797 | sudo dd if="$argbootfw/idblock.bin" of="$drive" seek=64 conv=notrunc
798 | sudo dd if="$argbootfw/uboot.img" of="$drive" seek=16384 conv=notrunc
799 | elif [ -f "$argbootfw/idbloader.img" ] && [ -f "$argbootfw/uboot.img" ]; then
800 | sudo dd if="$argbootfw/idbloader.img" of="$drive" seek=64 conv=notrunc
801 | sudo dd if="$argbootfw/uboot.img" of="$drive" seek=16384 conv=notrunc
802 | elif [ -f "$argbootfw/tpl-spl.img" ] && [ -f "$argbootfw/u-boot.itb" ]; then
803 | sudo dd if="$argbootfw/tpl-spl.img" of="$drive" seek=64 conv=notrunc
804 | sudo dd if="$argbootfw/u-boot.itb" of="$drive" seek=16384 conv=notrunc
805 | else
806 | colorecho "$RED" "Error: Required u-boot files does not exist. Skipped."
807 | fi
808 |
809 | # Trust Firmware, needed for platforms like rockchip rk33xx
810 | if [ -f "$argbootfw/trust.img" ]; then
811 | sudo dd if="$argbootfw/trust.img" of="$drive" seek=24576 conv=notrunc
812 | #if not specified, change boot part start sector to 24MiB
813 | if [ -z "$argbootptst" ]; then
814 | argbootptst="24MiB"
815 | fi
816 | fi
817 |
818 | sync
819 | fi
820 |
821 | # Create system partitions
822 | colorecho "$GREEN" "Partitioning disk ..."
823 | if [ -z "$argbootptst" ]; then
824 | argbootptst="16MiB"
825 | fi
826 |
827 | if [ -z "$argbootpted" ]; then
828 | if [ "$argbootpt" = 1 ]; then
829 | argbootpted="500MiB"
830 | else
831 | argbootpted="32MiB"
832 | fi
833 | fi
834 |
835 | # Find the first partition number after boot firmware
836 | num_of_part="$(sudo partx -g $drive | wc -l)"
837 | if [ -n "$num_of_part" ] && [ "$num_of_part" -gt 0 ]; then
838 | first_part=$((num_of_part + 1))
839 | else
840 | first_part=1
841 | fi
842 | echo "Index of first partition after boot firmware (if exist) is $first_part"
843 |
844 | if [ "$argbootpt" = 1 ]; then
845 | sudo parted $drive mkpart boot fat32 $argbootptst $argbootpted
846 | sudo parted $drive mkpart rootfs ext4 $argbootpted 100%
847 | sudo parted $drive set $first_part boot on
848 | sudo parted $drive set $first_part esp on
849 | elif [ "$argesppt" = 1 ]; then
850 | sudo parted $drive mkpart primary fat32 $argbootptst $argbootpted
851 | sudo parted $drive mkpart rootfs ext4 $argbootpted 100%
852 | sudo parted $drive set $first_part esp on
853 | else
854 | sudo parted $drive mkpart config fat32 $argbootptst $argbootpted
855 | sudo parted $drive mkpart rootfs ext4 $argbootpted 100%
856 | sudo parted $drive set $((first_part + 1)) boot on
857 | fi
858 |
859 | # Find the partitions
860 | if [ -e $drive"1" ]; then
861 | root_partition=$drive"$((first_part + 1))"
862 | boot_partition=$drive"$first_part"
863 | else
864 | root_partition=$drive"p$((first_part + 1))"
865 | boot_partition=$drive"p$first_part"
866 | fi
867 | echo "Boot / Config Part: $boot_partition"
868 | echo "Rootfs Part: $root_partition"
869 |
870 | # Format the partitions
871 | echo -e 'y' | sudo mkfs.ext4 $root_partition
872 | sudo mkfs.vfat -F32 $boot_partition
873 | else
874 | # Find the partitions
875 | if [ -e $drive"1" ]; then
876 | root_partition=$drive"2"
877 | boot_partition=$drive"1"
878 | else
879 | root_partition=$drive"p2"
880 | boot_partition=$drive"p1"
881 | fi
882 | fi
883 |
884 | title
885 | # Mount the partitions
886 | colorecho "$GREEN" "Mounting partition for install ..."
887 | sudo mount -o rw $root_partition $root_mount_dir
888 |
889 | if [ "$argbootpt" = 1 ]; then
890 | sudo mount $boot_partition $boot_mount_dir
891 | fi
892 |
893 | if [ "$argesppt" = 1 ]; then
894 | sudo mount $boot_partition $esp_mount_dir
895 | fi
896 |
897 | # Download and extract the latest ArchLinux tarball
898 | colorecho "$GREEN" "Downloading Arch Linux rootfs ..."
899 | curl -LJO $rootfs_url
900 |
901 | colorecho "$GREEN" "Copying Arch Linux rootfs ..."
902 | sudo bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C $root_mount_dir
903 |
904 | # Copy kernel files
905 | if [ "$argkrl" = "linux" ]; then
906 |
907 | # Install / Update to Latest Kernel
908 | colorecho "$GREEN" "Installing latest linux-aarch64 ..."
909 | sudo arch-chroot $root_mount_dir /bin/bash </dev/null
1015 | echo " " | sudo tee -a "$boot_mount_dir/extlinux/extlinux.conf" >/dev/null
1016 | echo "label %PKGBASE%" | sudo tee -a "$boot_mount_dir/extlinux/extlinux.conf" >/dev/null
1017 | if [ -f "$boot_mount_dir/vmlinuz-$argkrl" ]; then
1018 | echo " kernel /vmlinuz-%PKGBASE%" | sudo tee -a "$boot_mount_dir/extlinux/extlinux.conf" >/dev/null
1019 | elif [ -f "$boot_mount_dir/Image" ]; then
1020 | echo " kernel /Image" | sudo tee -a "$boot_mount_dir/extlinux/extlinux.conf" >/dev/null
1021 | fi
1022 | echo " initrd /initramfs-%PKGBASE%.img" | sudo tee -a "$boot_mount_dir/extlinux/extlinux.conf" >/dev/null
1023 |
1024 | if [ -n "$bootdtb" ] && [ "$bootdtb" != "null" ]; then
1025 | if [[ "$bootdtb" == *".dtb" ]]; then
1026 | echo " fdt $bootdtb" | sudo tee -a "$boot_mount_dir/extlinux/extlinux.conf" >/dev/null
1027 | else
1028 | echo " devicetreedir $bootdtb" | sudo tee -a "$boot_mount_dir/extlinux/extlinux.conf" >/dev/null
1029 | fi
1030 | fi
1031 | if [ -n "$bootdtboverlays" ] && [ "$bootdtboverlays" != "null" ]; then
1032 | echo " fdtoverlays $bootdtboverlays" | sudo tee -a "$boot_mount_dir/extlinux/extlinux.conf" >/dev/null
1033 | fi
1034 | echo " append root=${root_uuid} $bootcmdline" | sudo tee -a "$boot_mount_dir/extlinux/extlinux.conf" >/dev/null
1035 |
1036 | # Update pkgbase for extlinux.conf
1037 | sudo sed -i "s|%PKGBASE%|$argkrl|" $boot_mount_dir/extlinux/extlinux.conf
1038 |
1039 | if [ ! "$argbootpt" = 1 ]; then
1040 | sudo sed -i "s| /vmlinuz| /boot/vmlinuz|" $boot_mount_dir/extlinux/extlinux.conf
1041 | sudo sed -i "s| /Image| /boot/Image|" $boot_mount_dir/extlinux/extlinux.conf
1042 | sudo sed -i "s| /initramfs| /boot/initramfs|" $boot_mount_dir/extlinux/extlinux.conf
1043 | sudo sed -i "s| /initrd| /boot/initrd|" $boot_mount_dir/extlinux/extlinux.conf
1044 | sudo sed -i "s| /dtbs| /boot/dtbs|" $boot_mount_dir/extlinux/extlinux.conf
1045 | sudo sed -i "s| /dtbo| /boot/dtbo|" $boot_mount_dir/extlinux/extlinux.conf
1046 | fi
1047 |
1048 | # fix rockchip overlay directory name
1049 | if [ -e "$boot_mount_dir/dtbs/$argkrl/rockchip/overlay" ]; then
1050 | sudo sed -i "s|/rockchip/overlays|/rockchip/overlay|" $boot_mount_dir/extlinux/extlinux.conf
1051 | fi
1052 |
1053 | # Print extlinux.conf for debugging
1054 | cat $boot_mount_dir/extlinux/extlinux.conf
1055 | else
1056 | colorecho "$RED" "Invalid --bootloader argument"
1057 | fi
1058 | else
1059 | colorecho "$GREEN" "boot config skipped"
1060 | fi
1061 |
1062 | title
1063 | # Download Installer
1064 | colorecho "$GREEN" "Downloading Installer ..."
1065 |
1066 | if [ "$arginstaller" == "installer" ] || [ -z "$arginstaller" ]; then
1067 | installer_name="arch-installer"
1068 | compiled_pkg_dir="/usr/lib/installer/packages"
1069 | curl -LJO https://raw.githubusercontent.com/kwankiu/archlinux-installer/$branch/$installer_name
1070 | # Download and Copy ACU
1071 | curl -LJO https://raw.githubusercontent.com/kwankiu/acu/$acuver/acu
1072 | sudo chmod +x acu
1073 | sudo cp -r acu "$root_mount_dir/usr/bin/acu"
1074 | sudo rm -rf acu
1075 | # Download and Copy ACU Config for TUI Installer
1076 | curl -LJO https://raw.githubusercontent.com/kwankiu/archlinux-installer/$branch/config/acu_config.yaml
1077 | sudo mkdir -p "$root_mount_dir/usr/lib/installer/.acu/config"
1078 | sudo cp -r acu_config.yaml "$root_mount_dir/usr/lib/installer/.acu/config/config.yaml"
1079 | sudo rm -rf acu_config.yaml
1080 | fi
1081 |
1082 | # Copy Installer
1083 | colorecho "$GREEN" "Copying Installer ..."
1084 | sudo chmod +x $installer_name
1085 | sudo cp -r "$installer_name" "$root_mount_dir/usr/bin/installer"
1086 | #if [ -n "$argmodel" ]; then
1087 | #sudo sed -i "s/^#install_target=\".*\"/install_target=\"$argmodel\"/g" "$root_mount_dir/usr/bin/installer" # (optional)
1088 | #fi
1089 |
1090 | if [ ! -z "$is_img" ]; then
1091 | colorecho "$GREEN" "Downloading growpart ..."
1092 | curl -LJO https://raw.githubusercontent.com/canonical/cloud-utils/main/bin/growpart
1093 | colorecho "$GREEN" "Copying growpart ..."
1094 | sudo chmod +x growpart
1095 | sudo cp -r "growpart" "$root_mount_dir/usr/bin/growpart"
1096 | fi
1097 |
1098 | # Copy Script
1099 | if [ -n "$argscripts" ]; then
1100 | colorecho "$GREEN" "Copying Script ..."
1101 | sudo chmod +x "$argscripts"
1102 | sudo cp -r "$argscripts" "$root_mount_dir/usr/bin/script.sh"
1103 | fi
1104 |
1105 | # Download drivers and installer deps
1106 | sudo mkdir -p "${root_mount_dir}${compiled_pkg_dir}"
1107 | add_pkg wpa_supplicant-2 core
1108 | add_pkg dialog core
1109 | add_pkg pcsclite extra
1110 | add_pkg duktape extra
1111 | add_pkg polkit-1 extra
1112 | add_pkg glibc-2 core
1113 | add_pkg "sudo" core
1114 | add_pkg rate-mirrors
1115 | if [ -n "$argaddpkg" ]; then
1116 | # Split the input by commas
1117 | IFS=',' read -r -a argaddpkg <<< "$argaddpkg"
1118 | # Loop through each package
1119 | for pkg in "${argaddpkg[@]}"; do
1120 | pkg=$(echo "$pkg" | xargs) # Trim whitespace
1121 | add_pkg "$pkg"
1122 | done
1123 | fi
1124 | ls "${root_mount_dir}${compiled_pkg_dir}" #DEBUG
1125 | # Remove the temporary directory
1126 | sudo rm -rf "$pkg_tar_dir"
1127 | sudo rm -rf $installer_name
1128 |
1129 | # Run installer as a system service at first boot
1130 | if [ -n "$argscripts" ]; then
1131 | colorecho "$GREEN" "Chroot into system ..."
1132 | sudo arch-chroot $root_mount_dir /bin/bash < <
6 | # /_/ \_\_| \___|_| |_|______|_|_| |_|\__,_/_/\_\ __
7 | # _____ _ _ _ ( __)/ \( _ \
8 | # |_ _| | | | | | ) _)( O )) /
9 | # | | _ __ ___| |_ __ _| | | ___ _ __ (__) \__/(__\_)
10 | # | | | '_ \/ __| __/ _` | | |/ _ \ '__| /__\ ( _ \( \/ )
11 | # _| |_| | | \__ \ || (_| | | | __/ | / \ ) // \/ \
12 | # |_____|_| |_|___/\__\__,_|_|_|\___|_| \_/\_/(__\_)\_)(_/
13 | #
14 | # Installation File - Arch Linux Installer for ARM
15 | install:
16 |
17 | # Config
18 | target: generic
19 | # Localization
20 | language: en_US
21 | # User Account
22 | username: user
23 | password: 1234
24 | disable_root_account: 1
25 | # System / Packages
26 | hostname: alarm
27 | parallel_downloads: 50
28 | sort_mirrors: fastest
29 | kernel: linux-aarch64
30 | graphics: mesa
31 | video: ffmpeg
32 | desktop_environment: gnome-minimal
33 | additional_packages:
34 | - networkmanager
35 | - iw
36 | - iwd
37 | - bluez
38 | - noto-fonts
39 | - noto-fonts-cjk
40 | - noto-fonts-emoji
41 | enable_services:
42 | - NetworkManager.service
43 | - bluetooth.service
44 | start_services:
45 | - NetworkManager.service
46 | - bluetooth.service
47 |
--------------------------------------------------------------------------------
/scripts/README.md:
--------------------------------------------------------------------------------
1 | ## Useful Scripts for the Installer and Tools
2 |
3 | This directory contains various scripts that enhance the functionality of the Arch Linux Installer. Below is a description of each script:
4 |
5 | ### Scripts Overview
6 |
7 | - **`asahi/`**
8 | Contains a customized Asahi Installer specifically for setting up the Arch Linux Installer on Apple Silicon Macs.
9 | This is essential for users who do not already have Asahi Linux installed.
10 |
11 | - **`get-installer`**
12 | A utility script that automatically fetches, downloads, and flashes the latest prebuilt image or setup the installer for your device. Simplifies the setup process for supported devices.
13 |
14 | - **`arch-bootstrap-chroot`**
15 | This script enables the creation of an Arch Linux chroot environment in your working directory. It works seamlessly across both x86 and ARM64 hosts, making it highly versatile.
16 |
17 | - **`init-setup.sh`**
18 | A script designed to perform initial setup tasks during the first boot. It updates the `fstab`, expands the system partition and filesystem, and performs any necessary installation cleanup.
19 |
20 | Feel free to suggest improvements or contribute additional scripts to enhance installer functionality!
--------------------------------------------------------------------------------
/scripts/arch-bootstrap-chroot:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ################################################################
4 | # Tools for formatting / styling
5 |
6 | # Define terminal color codes
7 | RED='\033[0;31m'
8 | GREEN='\033[0;32m'
9 | YELLOW='\033[0;33m'
10 | BLUE='\033[0;36m'
11 | NC='\033[0m' # No Color
12 |
13 | # Echo with colors
14 | colorecho() {
15 | color="$1"
16 | text="$2"
17 | echo -e "${color}${text}${NC}"
18 | }
19 | ################################################################
20 |
21 | rootfs_url="http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz" # Aarch64
22 | rootfs_dir="rootfs"
23 | rootfs_user="user"
24 |
25 | system_arch=$(uname -m)
26 | colorecho "$GREEN" "System is $system_arch"
27 |
28 | # Loop through the arguments
29 | for arg in "$@"; do
30 | case "$arg" in
31 | --rootfs=*)
32 | colorecho "$GREEN" "Create rootfs using ${arg#*=}"
33 | if [ "${arg#*=}" = "x86_64" ] || [ "${arg#*=}" = "amd64" ]; then
34 | rootfs_url="http://mirrors.kernel.org/archlinux/iso/latest/archlinux-bootstrap-x86_64.tar.gz"
35 | elif [[ "${arg#*=}" = "http://"* ]] || [[ "${arg#*=}" = "https://"* ]]; then
36 | rootfs_url="${arg#*=}"
37 | elif [ "${arg#*=}" != "aarch64" ] && [ "${arg#*=}" != "arm64" ]; then
38 | colorecho "$RED" "Invalid rootfs type or url."
39 | exit 1
40 | fi
41 | ;;
42 | --dir=*)
43 | colorecho "$GREEN" "Create rootfs in ${arg#*=}"
44 | rootfs_dir="${arg#*=}"
45 | ;;
46 | --user=*)
47 | rootfs_user="${arg#*=}"
48 | ;;
49 | -*)
50 | colorecho "$RED" "Invalid command or argument."
51 | exit 1
52 | ;;
53 | esac
54 | done
55 |
56 | if [ "$system_arch" == "x86_64" ] && [[ "$rootfs_url" = *"aarch64"* ]]; then
57 | # Check if qemu-aarch64-static is installed
58 | if ! [ -e "/usr/bin/qemu-aarch64-static" ]; then
59 | # Check Linux distribution
60 | colorecho "$YELLOW" "qemu-aarch64-static is not found, trying to install..."
61 | if [ -f /etc/lsb-release ] || [ -x "$(command -v apt-get)" ]; then
62 | # Debian/Ubuntu-based
63 | sudo apt-get update
64 | sudo apt-get install -y qemu-user-static
65 | elif [ -f /etc/arch-release ]; then
66 | # Arch Linux
67 | sudo pacman -S qemu-user-static --noconfirm
68 | else
69 | colorecho "$RED" "Error : qemu-aarch64-static is not installed."
70 | exit 1
71 | fi
72 | fi
73 | fi
74 |
75 | # Check if arch-install-scripts is installed
76 | if [ -z "$(command -v arch-chroot)" ]; then
77 | # Check Linux distribution
78 | colorecho "$YELLOW" "arch-chroot is not found, trying to install arch-install-scripts ..."
79 | if [ -f /etc/lsb-release ] || [ -x "$(command -v apt-get)" ]; then
80 | # Debian/Ubuntu-based
81 | sudo apt-get update
82 | sudo apt-get install -y arch-install-scripts
83 | elif [ -x "$(command -v apk)" ]; then
84 | # Alphine-based
85 | apk add arch-install-scripts
86 | elif [ -f /etc/arch-release ]; then
87 | # Arch Linux
88 | sudo pacman -S arch-install-scripts --noconfirm
89 | else
90 | colorecho "$RED" "Error : arch-install-scripts is not installed."
91 | exit 1
92 | fi
93 | fi
94 |
95 | # Check if bsdtar is installed
96 | if ! [ -x "$(command -v bsdtar)" ]; then
97 | # Check Linux distribution
98 | colorecho "$YELLOW" "bsdtar command not found, trying to install..."
99 | if [ -f /etc/lsb-release ] || [ -x "$(command -v apt-get)" ]; then
100 | # Debian/Ubuntu-based
101 | sudo apt-get update
102 | sudo apt-get install -y libarchive-tools
103 | elif [ -x "$(command -v apk)" ]; then
104 | # Alphine-based
105 | apk add libarchive-tools
106 | elif [ -f /etc/arch-release ]; then
107 | # Arch Linux
108 | sudo pacman -S libarchive --noconfirm
109 | else
110 | colorecho "$RED" "Error : We cant find or install bsdtar on your system. Exiting..."
111 | exit 1
112 | fi
113 | fi
114 |
115 | # Create directory and get rootfs
116 | if [ ! -d $rootfs_dir ]; then
117 | sudo mkdir -p $rootfs_dir
118 | # Download and extract the latest ArchLinux tarball
119 | colorecho "$GREEN" "Downloading Arch Linux rootfs ..."
120 | curl -LJO $rootfs_url
121 | colorecho "$GREEN" "Extracting Arch Linux rootfs ..."
122 | sudo bsdtar -xpf $(basename $rootfs_url) -C $rootfs_dir
123 | sudo rm -rf $(basename $rootfs_url)
124 | run_post_install=1
125 | fi
126 |
127 | if [ "$system_arch" == "x86_64" ]; then
128 | S1=':qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7'
129 | S2=':\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-static:CF'
130 | echo -n $S1$S2| sudo tee /lib/binfmt.d/05-local-qemu-aarch64-static.conf
131 | echo
132 | sudo systemctl restart systemd-binfmt.service
133 | fi
134 |
135 | if [ "$run_post_install" = 1 ] && [[ "$rootfs_url" = *"aarch64"* ]]; then
136 | colorecho "$GREEN" "Running Post Install Setup ..."
137 | sudo arch-chroot $rootfs_dir /bin/bash <> /etc/sudoers
140 | usermod -aG wheel root
141 |
142 | # Disable CheckSpace to prevent chroot issues
143 | sed -i "s|CheckSpace|#CheckSpace|" /etc/pacman.conf
144 | # Speed up pacman downloads
145 | sed -i "s|#ParallelDownloads = 5|ParallelDownloads = 100|" /etc/pacman.conf
146 | # Setup Pacman Keys
147 | echo "Setting up alarm pacman key ..."
148 | pacman-key --init
149 | pacman-key --populate archlinuxarm
150 |
151 | echo "Install sudo and Perform Full System Upgrade ..."
152 | pacman -Syu sudo --needed --noconfirm
153 |
154 | echo "Installing ACU (Configuration Utility) ..."
155 | curl -o /usr/bin/acu -L "https://raw.githubusercontent.com/kwankiu/acu/main/acu"
156 | chmod +x /usr/bin/acu
157 |
158 | echo "Removing default alarm account"
159 | acu user remove alarm
160 |
161 | echo "Setting up user account ..."
162 | acu user add user 1234
163 | acu user manage user sudopw
164 | END
165 | colorecho "$GREEN" "Created a user account with username: user / password: 1234"
166 | elif [ "$run_post_install" = 1 ]; then
167 | colorecho "$GREEN" "Running Post Install Setup ..."
168 | sudo arch-chroot $rootfs_dir /bin/bash <> /etc/sudoers
171 | usermod -aG wheel root
172 |
173 | # Disable CheckSpace to prevent chroot issues
174 | sed -i "s|CheckSpace|#CheckSpace|" /etc/pacman.conf
175 | # Speed up pacman downloads
176 | sed -i "s|#ParallelDownloads = 5|ParallelDownloads = 100|" /etc/pacman.conf
177 | # Setup Pacman Keys
178 | echo "Setting up pacman key ..."
179 | pacman-key --init
180 | pacman-key --populate archlinux
181 |
182 | echo "Install sudo and Perform Full System Upgrade ..."
183 | pacman -Syu sudo --needed --noconfirm
184 |
185 | echo "Installing ACU (Configuration Utility) ..."
186 | curl -o /usr/bin/acu -L "https://raw.githubusercontent.com/kwankiu/acu/main/acu"
187 | chmod +x /usr/bin/acu
188 |
189 | echo "Setting up user account ..."
190 | acu user add user 1234
191 | acu user manage user sudopw
192 | END
193 | colorecho "$GREEN" "Created a user account with username: user / password: 1234"
194 | fi
195 |
196 | colorecho "$GREEN" "Starting chroot as user: $rootfs_user ..."
197 |
198 | if [ -z "$1" ] || [[ "$1" = "-"* ]]; then
199 | sudo arch-chroot -u $rootfs_user $rootfs_dir
200 | else
201 | sudo cp -r $1 $rootfs_dir/usr/bin/script.sh
202 | sudo chmod +x $rootfs_dir/usr/bin/script.sh
203 | sudo arch-chroot -u $rootfs_user $rootfs_dir /bin/bash </dev/null; then
23 | echo "Your version of cURL is too old. This usually means your macOS is very out"
24 | echo "of date. Installing Asahi Linux requires at least macOS version 13.5."
25 | exit 1
26 | fi
27 |
28 | #TMP="$(mktemp -d)"
29 | TMP=/tmp/asahi-install
30 |
31 | export VERSION_FLAG=https://cdn.asahilinux.org/installer/latest
32 | export INSTALLER_BASE=https://cdn.asahilinux.org/installer
33 | export INSTALLER_DATA=https://raw.githubusercontent.com/kwankiu/archlinux-installer/refs/heads/${branch}/scripts/asahi/installer_data.json
34 | export REPO_BASE=http://localhost:8000
35 | export REPORT=https://stats.asahilinux.org/report
36 | export REPORT_TAG=alx-prod
37 |
38 | echo
39 | echo "Bootstrapping installer:"
40 |
41 | if [ -e "$TMP" ]; then
42 | mv "$TMP" "$TMP-$(date +%Y%m%d-%H%M%S)"
43 | fi
44 |
45 | mkdir -p "$TMP"
46 | cd "$TMP"
47 |
48 | echo " Checking version..."
49 |
50 | PKG_VER="$(curl --no-progress-meter -L "$VERSION_FLAG")"
51 | echo " Version: $PKG_VER"
52 |
53 | PKG="installer-$PKG_VER.tar.gz"
54 |
55 | echo " Downloading Asahi Installer..."
56 |
57 | curl --no-progress-meter -L -o "$PKG" "$INSTALLER_BASE/$PKG"
58 | if ! curl --no-progress-meter -L -O "$INSTALLER_DATA"; then
59 | echo " Error downloading installer_data.json. GitHub might be blocked in your network."
60 | echo " Please consider using a VPN if you experience issues."
61 | echo " Trying workaround..."
62 | curl --no-progress-meter -L -O "$INSTALLER_DATA_ALT"
63 | fi
64 |
65 | echo " Extracting Asahi Installer..."
66 |
67 | tar xf "$PKG"
68 |
69 | echo " Creating OS Package..."
70 | mkdir -p os
71 | cd os
72 | echo " Downloading Source Package..."
73 | curl -LO https://github.com/kwankiu/archlinux-installer/releases/download/${release_tag}/asahi-archlinux-installer-uefi.img.xz
74 | echo " Running OS Package Tool..."
75 | curl https://raw.githubusercontent.com/kwankiu/archlinux-installer/refs/heads/${branch}/scripts/asahi/os-package-tool | sh
76 | cd ..
77 | echo " Initializing Local Web Server..."
78 | python3 -m http.server &
79 | echo
80 |
81 | if [ "$USER" != "root" ]; then
82 | echo "The installer needs to run as root."
83 | echo "Please enter your sudo password if prompted."
84 | exec caffeinate -dis sudo -E ./install.sh "$@"
85 | else
86 | exec caffeinate -dis ./install.sh "$@"
87 | fi
88 | fi
--------------------------------------------------------------------------------
/scripts/asahi/installer_data.json:
--------------------------------------------------------------------------------
1 | {
2 | "os_list": [
3 | {
4 | "name": "Arch Linux ARM Installer",
5 | "default_os_name": "Arch Linux",
6 | "boot_object": "m1n1.bin",
7 | "next_object": "m1n1/boot.bin",
8 | "package": "asahi-archlinux-installer-uefi.zip",
9 | "supported_fw": [
10 | "12.3",
11 | "12.3.1",
12 | "13.5"
13 | ],
14 | "partitions": [
15 | {
16 | "name": "EFI",
17 | "type": "EFI",
18 | "size": "500MB",
19 | "format": "fat",
20 | "copy_firmware": true,
21 | "copy_installer_data": true,
22 | "source": "esp"
23 | },
24 | {
25 | "name": "Root",
26 | "type": "Linux",
27 | "size": "4083154944B",
28 | "expand": true,
29 | "image": "root.img"
30 | }
31 | ]
32 | },
33 | {
34 | "name": "Tethered boot (m1n1, for development)",
35 | "default_os_name": "m1n1 proxy",
36 | "expert": true,
37 | "boot_object": "m1n1.bin",
38 | "external_boot": true,
39 | "partitions": []
40 | }
41 | ]
42 | }
43 |
--------------------------------------------------------------------------------
/scripts/asahi/os-package-tool:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Extract the image
4 | echo " Extracting Source Image..."
5 | unxz asahi-archlinux-installer-uefi.img.xz
6 |
7 | # Attach the image without mounting and get the partition identifier
8 | echo " Attaching Source Image..."
9 | PARTITION_ID=$(hdiutil attach asahi-archlinux-installer-uefi.img -nomount | grep "Linux Filesystem" | awk '{print $1}')
10 |
11 | # Check if the partition ID was found
12 | if [ -z "$PARTITION_ID" ]; then
13 | echo "Error: Could not find the Linux Filesystem partition."
14 | exit 1
15 | fi
16 |
17 | # Extract the partition
18 | echo " Extracting Root Image..."
19 | sudo dd if="$PARTITION_ID" of=root.img bs=1m
20 |
21 | # Detach the image (detaching the whole disk)
22 | echo " Detaching Source Image..."
23 | hdiutil detach $(echo "$PARTITION_ID" | sed 's/s[0-9]*$//') # Detach the base disk
24 |
25 | echo " Removing Source Image..."
26 | rm asahi-archlinux-installer-uefi.img
27 |
28 | echo " Downloading ESP Image..."
29 | curl -LO https://github.com/kwankiu/archlinux-installer/releases/download/kernel/asahi-esp.zip
30 |
31 | echo " Extracting ESP Image..."
32 | unzip asahi-esp.zip
33 | rm asahi-esp.zip
34 |
35 | echo " Creating OS Package..."
36 | zip -r asahi-archlinux-installer-uefi.zip root.img esp
37 |
38 | echo " Cleaning up..."
39 | rm -rf esp root.img __MACOSX .DS_Store
40 |
--------------------------------------------------------------------------------
/scripts/get-installer:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ################################################################
4 | # Tools for formatting / styling
5 |
6 | # Define terminal color codes
7 | RED='\033[0;31m'
8 | GREEN='\033[0;32m'
9 | YELLOW='\033[0;33m'
10 | BLUE='\033[0;36m'
11 | NC='\033[0m' # No Color
12 |
13 | # Echo with colors
14 | colorecho() {
15 | color="$1"
16 | text="$2"
17 | printf "${color}${text}${NC}\n"
18 | }
19 |
20 | # Sudo override
21 | sudo () {
22 | local command=$@
23 | if [ "$(id -u)" -eq 0 ]; then
24 | #echo "Running in root."
25 | command "$@"
26 | else
27 | #echo "Running with sudo."
28 | command sudo "$@"
29 | fi
30 | }
31 |
32 | ################################################################
33 | # Configure variables
34 | gh_repo="kwankiu/archlinux-installer"
35 | file_prefix=""
36 | file_suffix="-archlinux-installer"
37 | file_extension=".img.xz"
38 |
39 | ################################################################
40 | # Loop through the arguments
41 | for arg in "$@"; do
42 | case "$arg" in
43 | -h | --help)
44 | colorecho "$BLUE" "Get Installer"
45 | echo "Usage: $0 "
46 |
47 | colorecho "$GREEN" "Options"
48 | echo "-h / --help : Usage and Infomation of this Tool."
49 | echo "--tag : Specify a release tag for image downloads."
50 | echo "--device : Specify a target device for image downloads."
51 | exit 1
52 | ;;
53 | --tag=*)
54 | release_tag="${arg#*=}"
55 | ;;
56 | --device=*)
57 | install_target="${arg#*=}"
58 | ;;
59 | --disk=*)
60 | install_disk="${arg#*=}"
61 | ;;
62 | -*)
63 | colorecho "$RED" "Invalid command or argument."
64 | exit 1
65 | ;;
66 | esac
67 | done
68 |
69 | ################################################################
70 | # Get latest release tag
71 | if [ -z "$release_tag" ]; then
72 | release_tag="$(curl -s "https://api.github.com/repos/${gh_repo}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')"
73 | fi
74 | # Auto detect install target from devicetree
75 | if [ -z "$install_target" ]; then
76 | if [ -f "/proc/device-tree/compatible" ]; then
77 | install_target="$(sed 's/\x00/ /g; s/,/ /g' /proc/device-tree/compatible | awk '{print $1, $2}' | tr ' ' '-' | head -n 1)"
78 | fi
79 | fi
80 | ################################################################
81 |
82 | if [ -n "$install_target" ]; then
83 | # Download target image
84 | colorecho "$GREEN" "Looking for the latest image for $install_target ..."
85 | case $install_target in
86 | radxa-*)
87 | ;;
88 | khadas-*)
89 | install_target="$(echo "${install_target}" | awk -F'-' '{print substr($2,1)}')-khadas"
90 | ;;
91 | rockchip-rk3588*)
92 | install_target="${install_target#*-*-}"
93 | case "$install_target" in
94 | *12c*|*fydetab*)
95 | install_target="fydetab-duo"
96 | ;;
97 | esac
98 | ;;
99 | friendlyelec*)
100 | install_target="${install_target#*-}"
101 | ;;
102 | *)
103 | colorecho "$RED" "Unable to determine target device"
104 | exit 1
105 | ;;
106 | esac
107 | case "$release_tag" in
108 | UEFI*)
109 | image_url="https://github.com/${gh_repo}/releases/download/${release_tag}/${install_target}${file_suffix}-UEFI${file_extension}"
110 | ;;
111 | *)
112 | image_url="https://github.com/${gh_repo}/releases/download/${release_tag}/${install_target}${file_suffix}${file_extension}"
113 | ;;
114 | esac
115 | curl -LO $image_url
116 | elif [ -n "$install_disk" ]; then
117 | # Download generic image
118 | colorecho "$GREEN" "Unable to retrieve device model, looking for the latest generic image ..."
119 | install_target="generic"
120 | image_url="https://github.com/${gh_repo}/releases/download/UEFI-${release_tag}/${install_target}${file_suffix}-UEFI${file_extension}"
121 | curl -LO $image_url
122 | elif command -v bash >/dev/null; then
123 | # Download the Installer to current root
124 | colorecho "$GREEN" "Downloading the Installer to current root ..."
125 | colorecho "$GREEN" "Tips: To start the installer, run 'installer' (as root)."
126 | # Download growpart
127 | sudo curl -L https://raw.githubusercontent.com/canonical/cloud-utils/main/bin/growpart -o /usr/bin/growpart
128 | sudo chmod +x /usr/bin/growpart
129 | # Download the Installer
130 | curl https://raw.githubusercontent.com/kwankiu/archlinux-installer/${release_tag}/arch-installer | bash -s -- --reinstall
131 | else
132 | colorecho "$GREEN" "Error bash is not available on your system."
133 | fi
134 |
135 | if [ -f "/opt/oowow" ]; then
136 | # Get downloaded image name
137 | image_name="$(basename $image_url)"
138 | # Flash with OOWOW
139 | colorecho "$GREEN" "Flashing image $image_name using OOWOW"
140 | image_write2emmc $image_name
141 | elif [ -n "$install_disk" ]; then
142 | # Get downloaded image name
143 | image_name="$(basename $image_url)"
144 | # Flash to disk
145 | colorecho "$GREEN" "Extracting image $image_name ..."
146 | unxz $image_name
147 | colorecho "$GREEN" "Flashing image ${image_name%.xz} to $install_disk"
148 | sudo dd if="${image_name%.xz}" of="$install_disk" bs=1M
149 | fi
--------------------------------------------------------------------------------
/scripts/init-setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | add_boot_part_fstab() {
4 | echo "Updating fstab ..."
5 | boot_partition=$(fdisk -l "$rootfs_disk" | grep "$rootfs_disk" | awk 'NR==2{print $1}')
6 |
7 | # Check if the boot_partition is not empty
8 | if [ -z "$boot_partition" ]; then
9 | echo "Unable to determine boot partition on $rootfs_disk"
10 | exit 1
11 | fi
12 |
13 | # Add the line to /etc/fstab
14 | new_line="$boot_partition /boot vfat dmask=000,fmask=0111,user 0 0"
15 |
16 | # Check if the line already exists in /etc/fstab
17 | if grep -qF "/boot vfat dmask=000,fmask=0111,user 0 0" /etc/fstab; then
18 | echo "boot partition seems already configured in /etc/fstab to manage by system."
19 | else
20 | # Add the line to /etc/fstab
21 | echo "$new_line" >> /etc/fstab
22 | # Check if the addition was successful
23 | if [ $? -eq 0 ]; then
24 | cat /etc/fstab
25 | echo "Line added to /etc/fstab successfully"
26 | else
27 | echo "Error adding line to /etc/fstab"
28 | fi
29 | fi
30 | }
31 |
32 | init_setup() {
33 |
34 | echo "Running Initial System Setup ..."
35 |
36 | # Check if the script is being run with root privileges
37 | if [[ $EUID -ne 0 ]]; then
38 | echo "Error : Initial System Setup must be run as root"
39 | exit 1
40 | fi
41 |
42 | # Get rootfs partition from the current mount point "/"
43 | rootfs_partition=$(mount | grep "on / " | awk '{print $1}')
44 |
45 | # Get disk path using rootfs partition path
46 | rootfs_disk=$(echo "$rootfs_partition" | sed 's/[0-9]*$//')
47 | rootfs_disk="${rootfs_disk%p*}"
48 |
49 | if [ ! -e "/boot/extlinux/extlinux.conf" ]; then
50 | add_boot_part_fstab
51 | fi
52 |
53 | echo "Resizing File System ..."
54 | growpart $rootfs_disk 2
55 | resize2fs $rootfs_partition
56 |
57 | if [ -e "/etc/systemd/system/init-setup.service" ]; then
58 | systemctl disable init-setup.service
59 | rm -rf /etc/systemd/system/init-setup.service
60 | fi
61 |
62 | rm -rf /usr/bin/installer
63 |
64 | echo "System will reboot now."
65 | if ! reboot --force; then
66 | echo "Unable to reboot automatically, please reboot your device manually."
67 | fi
68 | }
69 |
70 | init_setup
--------------------------------------------------------------------------------
/tools/README.md:
--------------------------------------------------------------------------------
1 | # deprecated
--------------------------------------------------------------------------------
/tools/arch-rock-config:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ################################################################
4 | # #
5 | # Arch Rock Configuration Utility #
6 | # #
7 | ################################################################
8 | # This is like armbian-config or raspi-config or rsetup but for Arch Linux running on Rock 5 / RK3588
9 | ################################################################
10 | # Define variables
11 |
12 | # Version of this script
13 | # (For developer : Update whenever there is a change in this file or its related files)
14 | # format of Version Number is YYMMDDN which N is 1-9 count on updates commited on the same day)
15 | utilver=2404271
16 |
17 | # Define main / dev branch
18 | branch=main
19 |
20 | # Initialize variables
21 | update_available=false
22 |
23 | # URL of the directory containing u-boot images
24 | uboot_url="https://dl.radxa.com/rock5/sw/images/loader/rock-5b/release/"
25 | uboot_debug_url="https://dl.radxa.com/rock5/sw/images/loader/rock-5b/debug/"
26 | edk2_url="https://api.github.com/repos/edk2-porting/edk2-rk3588/releases/latest"
27 | zero_url="https://dl.radxa.com/rock5/sw/images/others/zero.img.gz"
28 | armbian_url="https://github.com/huazi-yg/rock5b/releases/download/rock5b/rkspi_loader.img"
29 |
30 | # URL of Arch Linux ARM Archive
31 | alaa_url="https://alaa.ad24.cz/"
32 |
33 | adrepo_url="https://api.github.com/repos/kwankiu/archlinux-installer/releases/tags/kernel"
34 |
35 | # Directory for storing source files
36 | source_repo_dir="source-repo-dir"
37 |
38 | ################################################################
39 | # Tools for formatting / styling
40 |
41 | # Define terminal color codes
42 | RED='\033[0;31m'
43 | GREEN='\033[0;32m'
44 | YELLOW='\033[0;33m'
45 | BLUE='\033[0;36m'
46 | NC='\033[0m' # No Color
47 |
48 | # Option Picker
49 | function select_option {
50 |
51 | # little helpers for terminal print control and key input
52 | ESC=$( printf "\033")
53 | cursor_blink_on() { printf "$ESC[?25h"; }
54 | cursor_blink_off() { printf "$ESC[?25l"; }
55 | cursor_to() { printf "$ESC[$1;${2:-1}H"; }
56 | print_option() { printf " $1 "; }
57 | print_selected() { printf " $ESC[7m $1 $ESC[27m"; }
58 | get_cursor_row() { IFS=';' read -sdR -p $'\E[6n' ROW COL; echo ${ROW#*[}; }
59 | key_input() { read -s -n3 key 2>/dev/null >&2
60 | if [[ $key = $ESC[A ]]; then echo up; fi
61 | if [[ $key = $ESC[B ]]; then echo down; fi
62 | if [[ $key = "" ]]; then echo enter; fi; }
63 |
64 | # initially print empty new lines (scroll down if at bottom of screen)
65 | for opt; do printf "\n"; done
66 |
67 | # determine current screen position for overwriting the options
68 | local lastrow=`get_cursor_row`
69 | local startrow=$(($lastrow - $#))
70 |
71 | # ensure cursor and input echoing back on upon a ctrl+c during read -s
72 | trap "cursor_blink_on; stty echo; printf '\n'; exit" 2
73 | cursor_blink_off
74 |
75 | local selected=0
76 | while true; do
77 | # print options by overwriting the last lines
78 | local idx=0
79 | for opt; do
80 | cursor_to $(($startrow + $idx))
81 | if [ $idx -eq $selected ]; then
82 | print_selected "$opt"
83 | else
84 | print_option "$opt"
85 | fi
86 | ((idx++))
87 | done
88 |
89 | # user key control
90 | case `key_input` in
91 | enter) break;;
92 | up) ((selected--));
93 | if [ $selected -lt 0 ]; then selected=$(($# - 1)); fi;;
94 | down) ((selected++));
95 | if [ $selected -ge $# ]; then selected=0; fi;;
96 | esac
97 | done
98 |
99 | # cursor position back to normal
100 | cursor_to $lastrow
101 | printf "\n"
102 | cursor_blink_on
103 |
104 | return $selected
105 | }
106 |
107 | # Echo with colors
108 | colorecho() {
109 | color="$1"
110 | text="$2"
111 | echo -e "${color}${text}${NC}"
112 | }
113 |
114 | # Title / Heading
115 | title() {
116 | clear
117 | text="$1"
118 | echo "---------------------------------------------------------------------"
119 | colorecho "$BLUE" "${text}"
120 | echo "---------------------------------------------------------------------"
121 | }
122 |
123 | ################################################################
124 | # Version updates handling
125 |
126 | # Check updates
127 | check_util_updates() {
128 | remote_utilver=$(curl -s "https://raw.githubusercontent.com/kwankiu/archlinux-installer/$branch/tools/arch-rock-config" | grep -o 'utilver=[0-9]*' | cut -d= -f2)
129 | if [ "$remote_utilver" -gt "$utilver" ]; then
130 | update_available=true
131 | fi
132 | }
133 |
134 | # Install / Update Utility to PATH
135 | update_util() {
136 | if [ "$update_available" = true ] || [ "$1" = "--install" ]; then
137 | title "Arch Rock Configuration Utility"
138 | colorecho "$GREEN" "Installing / Updating Arch Rock Configuration Utility ..."
139 | if ! [ -x "$(command -v wget)" ]; then
140 | sudo pacman -Sy wget --noconfirm
141 | fi
142 |
143 | sudo rm -rf /usr/bin/arch-rock-config
144 | sudo wget -N -P /usr/bin/ https://raw.githubusercontent.com/kwankiu/archlinux-installer/$branch/tools/arch-rock-config
145 | sudo chmod +x /usr/bin/arch-rock-config
146 | if ! [ -x "$(command -v arcu)" ]; then
147 | add_alias "arcu"
148 | fi
149 | arch-rock-config
150 | fi
151 | }
152 |
153 | add_alias() {
154 | # Path to the directory where the alias script will be created
155 | ALIAS_SCRIPT_DIR="/usr/bin"
156 |
157 | # Alias name
158 | ALIAS_NAME=$1
159 |
160 | # Command to run
161 | if [ -z "$CUSTOM_CMD_TO_RUN" ]; then
162 | COMMAND_TO_RUN="arch-rock-config"
163 | else
164 | COMMAND_TO_RUN=$CUSTOM_CMD_TO_RUN
165 | fi
166 |
167 | # Create the alias script
168 | sudo bash -c "echo '#!/bin/bash' > $ALIAS_SCRIPT_DIR/$ALIAS_NAME"
169 | sudo bash -c "echo '$COMMAND_TO_RUN \"\$@\"' >> $ALIAS_SCRIPT_DIR/$ALIAS_NAME"
170 | sudo chmod +x $ALIAS_SCRIPT_DIR/$ALIAS_NAME
171 | colorecho "$GREEN" "Command '$ALIAS_NAME' has been created."
172 | }
173 |
174 | ################################################################
175 | # Packages Install Tools
176 |
177 | install_from_source() {
178 |
179 | cpwd=$(pwd)
180 |
181 | # Install required package
182 | if ! [ -x "$(command -v git)" ]; then
183 | sudo pacman -S git --noconfirm
184 | fi
185 |
186 | sudo pacman -S --needed base-devel --noconfirm
187 |
188 | # Ensure folder doesn't exist
189 | sudo rm -rf ~/"$source_repo_dir"
190 |
191 | # Get the repository URL from the argument
192 | repo_url="$1"
193 |
194 | # If the URL starts with 'aur://', modify the URL to use AUR repository
195 | if [[ "$repo_url" == aur://* ]]; then
196 | package_name="${repo_url#aur://}"
197 | repo_url="https://aur.archlinux.org/$package_name.git"
198 | # If the URL starts with 'gh://', modify the URL to use GitHub repository
199 | elif [[ "$repo_url" == gh://* ]]; then
200 | ghrepo_name="${repo_url#gh://}"
201 | repo_url="https://github.com/$ghrepo_name.git"
202 | fi
203 |
204 | # Clone repo
205 | colorecho "$GREEN" "Cloning Package from source ..."
206 | cd ~/
207 | git clone "$repo_url" "$source_repo_dir"
208 |
209 | # Compile & Install
210 | cd "$source_repo_dir"
211 |
212 | if [ ! -z "$2" ] && [ "$2" != "--noinstall" ]; then
213 | cd "$2"
214 | fi
215 |
216 | colorecho "$GREEN" "Compiling & Installing Package from source ..."
217 | makepkg -sA --noconfirm
218 |
219 | if [ "$2" != "--noinstall" ] && [ "$3" != "--noinstall" ]; then
220 | sudo pacman -U --overwrite \* *.pkg.tar.* --noconfirm
221 |
222 | # Clean Up
223 | cd "$cpwd"
224 | sudo rm -rf ~/"$source_repo_dir"
225 | fi
226 |
227 | }
228 |
229 | # Install Single Packages from any URL
230 | install_pkg_from_url() {
231 | colorecho "$GREEN" "Downloading package from $1 ..."
232 | curl -LJO $1
233 | ipkgname=$(basename $1)
234 | colorecho "$GREEN" "Installing package $ipkgname ..."
235 | sudo pacman -U --overwrite \* $ipkgname --noconfirm
236 | rm -rf $ipkgname
237 | }
238 |
239 | # Download Packages from a GitHub Release Repo
240 | install_ghrel_packages() {
241 |
242 | if [ -z "$1" ]; then
243 | colorecho "$RED" "Error: No package specified."
244 | exit 1
245 | else
246 | dgpkg=$1
247 | fi
248 |
249 | ghrel_url=("$adrepo_url")
250 | dgpkg_list=()
251 |
252 | for which_url in "${ghrel_url[@]}"; do
253 | colorecho "$GREEN" "Fetching $which_url ..."
254 | dgpkg_list+=($(curl -s "$which_url" | grep -v '.sig' | grep -B 1 ${dgpkg} | grep -oP '"browser_download_url": "\K[^"]+'))
255 | done
256 |
257 | echo ""
258 | colorecho "$BLUE" "The following packages will be downloaded:"
259 | echo ""
260 | for url in "${dgpkg_list[@]}"; do
261 | selection=$(basename "$url")
262 | echo "$selection"
263 | done
264 | echo ""
265 | echo -ne $"${BLUE}Are you sure to download the packages (y/n)?${NC}"
266 | read answer
267 |
268 | if [ "$answer" = "y" ]; then
269 | for url in "${dgpkg_list[@]}"; do
270 | selection=$(basename "$url")
271 | echo "Downloading and Installing $selection ..."
272 | install_pkg_from_url "$url"
273 |
274 | if [ ! -z "$2" ]; then
275 | sudo cp -r $selection $2/$selection
276 | sudo rm -rf $selection
277 | fi
278 |
279 | done
280 | fi
281 |
282 | }
283 |
284 | ################################################################
285 | # Functions for Install Kernel
286 |
287 | install_rkbsp5_bin() {
288 |
289 | title "Arch Rock Configuration Utility - Install linux-radxa-rkbsp5-bin"
290 |
291 | # remove old kernel files, else the package may not install.
292 | sudo rm -rf /usr/bin/libmali
293 | sudo rm -rf /usr/bin/libmaliw
294 | sudo rm -rf /usr/lib/libmali
295 | sudo rm -rf /usr/lib/modules
296 | sudo rm -rf /usr/lib/firmware/mali_csffw.bin
297 | sudo rm -rf /usr/src/linux-*
298 |
299 | install_from_source "aur://linux-radxa-rkbsp5-bin"
300 | colorecho "$GREEN" "Installed linux-radxa-rkbsp5"
301 | install_completed_reboot
302 |
303 | }
304 |
305 | install_rkbsp5_git() {
306 |
307 | title "Arch Rock Configuration Utility - Install linux-radxa-rkbsp5-git"
308 |
309 | # remove old kernel files, else the package may not install.
310 | sudo rm -rf /usr/bin/libmali
311 | sudo rm -rf /usr/bin/libmaliw
312 | sudo rm -rf /usr/lib/libmali
313 | sudo rm -rf /usr/lib/modules
314 | sudo rm -rf /usr/lib/firmware/mali_csffw.bin
315 | sudo rm -rf /usr/src/linux-*
316 |
317 | install_from_source "aur://linux-radxa-rkbsp5-git"
318 | colorecho "$GREEN" "Installed linux-radxa-rkbsp5"
319 | install_completed_reboot
320 |
321 | }
322 |
323 | install_rkbsp() {
324 |
325 | title "Arch Rock Configuration Utility - Install linux-radxa-rkbsp5"
326 |
327 | colorecho "$GREEN" "Downloading pre-compiled packages ..."
328 | # Download pre-compiled packages
329 | curl -LJO $rkbsp_url
330 |
331 | # Extract pre-compiled packages
332 | colorecho "$GREEN" "Extracting pre-compiled packages ..."
333 | pkg_tar_dir=$(mktemp -d)
334 | sudo tar -xf "compiled-pkg-rkbsp-latest.tar.xz" -C "$pkg_tar_dir"
335 | sudo chmod -R 755 $pkg_tar_dir/*
336 |
337 | # remove old kernel files, else the package will not install.
338 | colorecho "$YELLOW" "Removing existing kernel files ..."
339 | sudo rm -rf /usr/bin/libmali
340 | sudo rm -rf /usr/bin/libmaliw
341 | sudo rm -rf /usr/lib/libmali
342 | sudo rm -rf /usr/lib/modules
343 | sudo rm -rf /usr/lib/firmware/mali_csffw.bin
344 | sudo rm -rf /usr/src/linux-*
345 | sudo rm -rf /boot/*
346 |
347 | colorecho "$GREEN" "Installing Linux Kernel ..."
348 | sudo pacman -U $pkg_tar_dir/Kernel/*/*.pkg.tar.xz
349 |
350 | # apply new extlinux.conf
351 | colorecho "$GREEN" "Updating extlinux.conf ..."
352 | sudo mv /boot/extlinux/extlinux.arch.template /boot/extlinux/extlinux.conf
353 |
354 | # Get rootfs partition from the current mount point "/"
355 | rootfs_partition=$(mount | grep "on / " | awk '{print $1}')
356 |
357 | # Find the UUIDs of the root partition
358 | root_uuid=$(sudo blkid $rootfs_partition | awk '{print $2}' | tr -d '"')
359 | echo "Root partition UUID: $root_uuid"
360 |
361 | # Change UUID for extlinux.conf
362 | sudo sed -i "s|UUID=\\*\\*CHANGEME\\*\\*|$root_uuid|" /boot/extlinux/extlinux.conf
363 | sudo sed -i "s|UUID=CHANGEME|$root_uuid|" /boot/extlinux/extlinux.conf
364 |
365 | colorecho "$GREEN" "Installed linux-rkbsp5-git"
366 |
367 | colorecho "$GREEN" "Installing Panfork ..."
368 |
369 | sudo pacman -Rns mesa-pancsf-git-debug
370 | sudo pacman -U $pkg_tar_dir/GPU/*/*.pkg.tar.xz
371 | sudo pacman -U $pkg_tar_dir/GPU/*/*/*.pkg.tar.xz
372 |
373 | colorecho "$GREEN" "Installed Panfork ..."
374 | sudo rm -rf $pkg_tar_dir
375 | install_completed_reboot
376 | }
377 |
378 | install_midstream() {
379 |
380 | title "Arch Rock Configuration Utility - Install linux-rk3588-midstream"
381 |
382 | colorecho "$GREEN" "Downloading pre-compiled packages ..."
383 | # Download pre-compiled packages
384 | curl -LJO $midstream_url
385 |
386 | # Extract pre-compiled packages
387 | colorecho "$GREEN" "Extracting pre-compiled packages ..."
388 | pkg_tar_dir=$(mktemp -d)
389 | sudo tar -xf "compiled-pkg-midstream-latest.tar.xz" -C "$pkg_tar_dir"
390 | sudo chmod -R 755 $pkg_tar_dir/*
391 |
392 | colorecho "$GREEN" "Installing Linux Kernel ..."
393 | sudo pacman -U $pkg_tar_dir/Kernel/*/*.pkg.tar.xz
394 |
395 | # apply new extlinux.conf
396 | colorecho "$GREEN" "Updating extlinux.conf ..."
397 | sudo mv /boot/extlinux/extlinux.arch.template /boot/extlinux/extlinux.conf
398 |
399 | # Get rootfs partition from the current mount point "/"
400 | rootfs_partition=$(mount | grep "on / " | awk '{print $1}')
401 |
402 | # Find the UUIDs of the root partition
403 | root_uuid=$(sudo blkid $rootfs_partition | awk '{print $2}' | tr -d '"')
404 | echo "Root partition UUID: $root_uuid"
405 |
406 | # Change UUID for extlinux.conf
407 | sudo sed -i "s|UUID=\\*\\*CHANGEME\\*\\*|$root_uuid|" /boot/extlinux/extlinux.conf
408 | sudo sed -i "s|UUID=CHANGEME|$root_uuid|" /boot/extlinux/extlinux.conf
409 |
410 | # Install mali_csffw.bin
411 | colorecho "$GREEN" "Installing mali_csffw.bin ..."
412 | if ! [ -x "$(command -v wget)" ]; then
413 | sudo pacman -Sy wget --noconfirm
414 | fi
415 | sudo wget -P /lib/firmware https://github.com/JeffyCN/mirrors/raw/488f49467f5b4adb8ae944221698e9a4f9acb0ed/firmware/g610/mali_csffw.bin
416 | colorecho "$GREEN" "Installed linux-rk3588-midstream"
417 |
418 | colorecho "$GREEN" "Installing Pancsf ..."
419 | sudo pacman -Rns mesa-panfork-git-debug
420 | sudo pacman -U $pkg_tar_dir/GPU/*/*.pkg.tar.xz
421 | colorecho "$GREEN" "Installed Pancsf ..."
422 | sudo rm -rf $pkg_tar_dir
423 | install_completed_reboot
424 | }
425 |
426 | install_midstream_git() {
427 |
428 | title "Arch Rock Configuration Utility - Install linux-rk3588-midstream"
429 |
430 | install_from_source "https://github.com/hbiyik/hw_necromancer.git" "rock5b/linux-rk3588-midstream"
431 |
432 | # apply new extlinux.conf
433 | colorecho "$GREEN" "Updating extlinux.conf ..."
434 | sudo mv /boot/extlinux/extlinux.arch.template /boot/extlinux/extlinux.conf
435 |
436 | # Get rootfs partition from the current mount point "/"
437 | rootfs_partition=$(mount | grep "on / " | awk '{print $1}')
438 |
439 | # Find the UUIDs of the root partition
440 | root_uuid=$(sudo blkid $rootfs_partition | awk '{print $2}' | tr -d '"')
441 | echo "Root partition UUID: $root_uuid"
442 |
443 | # Change UUID for extlinux.conf
444 | sudo sed -i "s|UUID=\\*\\*CHANGEME\\*\\*|$root_uuid|" /boot/extlinux/extlinux.conf
445 | sudo sed -i "s|UUID=CHANGEME|$root_uuid|" /boot/extlinux/extlinux.conf
446 |
447 | # Install mali_csffw.bin
448 | colorecho "$GREEN" "Installing mali_csffw.bin ..."
449 | if ! [ -x "$(command -v wget)" ]; then
450 | sudo pacman -Sy wget --noconfirm
451 | fi
452 | sudo wget -P /lib/firmware https://github.com/JeffyCN/mirrors/raw/488f49467f5b4adb8ae944221698e9a4f9acb0ed/firmware/g610/mali_csffw.bin
453 | colorecho "$GREEN" "Installed linux-rk3588-midstream"
454 | install_completed_reboot
455 |
456 | }
457 |
458 | install_completed_reboot() {
459 | colorecho "$GREEN" "Installation completed."
460 |
461 | # Prompt user if they want to reboot
462 | read -t 5 -p "Changes have been made. We will reboot your system in 5 seconds. Do you want to reboot now? (y/n): " reboot_choice
463 |
464 | if [[ "$reboot_choice" == "n" || "$reboot_choice" == "N" ]]; then
465 | echo "You can manually reboot later to apply the changes."
466 | else
467 | echo "Rebooting..."
468 | sudo reboot
469 | fi
470 | }
471 |
472 | ################################################################
473 | # Utility Main Menu
474 |
475 | config_options() {
476 | title "Arch Rock Configuration Utility is now deprecated !"
477 | echo
478 | colorecho "$NC" "Arch Rock Configuration Utility is now replaced by ACU (A Configuration Utility for Arch Linux ARM), would you like to replace arch-rock-config with ACU?"
479 | echo
480 | options=("Replace arch-rock-config with ACU (Recommended)" "Install the last release of arch-rock-config (There will not be any updates in the future)")
481 | options+=("Exit Configuration Utility")
482 | select_option "${options[@]}"
483 | choice=$?
484 |
485 | # Choice
486 | case $choice in
487 | 0)
488 | colorecho "$GREEN" "Removing arch-rock-config ..."
489 | sudo rm -rf /usr/bin/arch-rock-config /usr/bin/arcu
490 | colorecho "$GREEN" "Installing ACU ..."
491 | bash <(curl -fsSL https://raw.githubusercontent.com/kwankiu/acu/$branch/acu) -u
492 | exit 0
493 | ;;
494 | 1)
495 | colorecho "$GREEN" "Installing arch-rock-config ..."
496 | bash <(curl -fsSL https://raw.githubusercontent.com/kwankiu/archlinux-installer/9cd93887bc851a114f5d4ad07a4d0db14cfccc1d/tools/arch-rock-config)
497 | colorecho "$GREEN" "Disable arch-rock-config updates ..."
498 | sudo sed -i "s/utilver=2403122/utilver=9999999/g" /usr/bin/arch-rock-config
499 | exit 0
500 | ;;
501 | *)
502 | exit 0
503 | ;;
504 | esac
505 |
506 | }
507 |
508 | ################################################################
509 | # System Maintenance
510 |
511 | # System Maintenance Main Menu
512 | system_maintenance() {
513 | title "Arch Rock Configuration Utility - System Maintenance"
514 | options=("Package Updates - Check & Perform Selective / Full System Upgrade")
515 | options+=("Update SPI Bootloader - Flash Latest Radxa U-Boot")
516 | options+=("Build & Install Kernel - Install other Linux Kernel from source")
517 | #options+=("Move Arch Linux - Copy Arch Linux to another disk.")
518 | options+=("Return to Main Menu")
519 | select_option "${options[@]}"
520 | choice=$?
521 |
522 | # Choice
523 | case $choice in
524 | 0)
525 | system_update
526 | ;;
527 | 1)
528 | flash_uboot
529 | ;;
530 | 2)
531 | install_kernel
532 | ;;
533 | #3)
534 | #move_system
535 | #;;
536 | *)
537 | config_options
538 | ;;
539 | esac
540 |
541 | }
542 |
543 | # System Update
544 | system_update() {
545 |
546 | title "Arch Rock Configuration Utility - Package Updates"
547 |
548 | if [ "$1" = "--select" ]; then
549 | local selected_option="${poptions[$2]}"
550 |
551 | if [[ " ${selection[*]} " == *" $selected_option "* ]]; then
552 | options[$2]="[ ] ${selected_option}"
553 | selection=("${selection[@]/$selected_option}")
554 | else
555 | options[$2]="[x] ${selected_option}"
556 | selection+=("$selected_option")
557 | fi
558 | else
559 | selection=()
560 | options=("Return to Main Menu" "Upgrade All Packages" "Upgrade Selected Packages")
561 | options+=("$GREEN----------------------------------------------------" "$GREEN Upgradable Packages (Press enter to select/deselect): " "$GREEN----------------------------------------------------" "Refresh / Reset $NC")
562 | poptions=("${options[@]}")
563 |
564 | if [ -x "$(command -v yay)" ]; then
565 | update_list=($(yay -Qu))
566 | if [ -z "$update_list" ]; then
567 | options[6]="Refresh / Reset $NC (All packages are up-to-date)"
568 | else
569 | for ((i=0; i<${#update_list[@]}; i+=4)); do
570 | options+=("[ ] ${update_list[i]}")
571 | poptions+=("${update_list[i]}")
572 | done
573 | options[6]="Refresh / Reset $NC (Using yay)"
574 | fi
575 | else
576 | update_list=($(pacman -Qu | awk -F' ' '{ if (NF == 4) { $5 = "[]" } }1'))
577 | if [ -z "$update_list" ]; then
578 | options[6]="Refresh / Reset $NC (All packages are up-to-date)"
579 | else
580 | for ((i=0; i<${#update_list[@]}; i+=5)); do
581 | options+=("[ ] ${update_list[i]}")
582 | poptions+=("${update_list[i]}")
583 | done
584 | options[6]="Refresh / Reset $NC (Using pacman)"
585 | fi
586 | fi
587 | fi
588 |
589 | select_option "${options[@]}"
590 | choice=$?
591 |
592 | if [ "$choice" = "0" ]; then
593 | config_options
594 | elif [ "$choice" = "1" ]; then
595 | if [ -x "$(command -v yay)" ]; then
596 | yay -Syyu
597 | else
598 | sudo pacman -Syyu
599 | fi
600 | elif [ "$choice" = "2" ]; then
601 | if [ -x "$(command -v yay)" ]; then
602 | yay -S ${selection[*]}
603 | else
604 | sudo pacman -S ${selection[*]}
605 | fi
606 | elif [ "$choice" = "3" ] || [ "$choice" = "4" ] || [ "$choice" = "5" ] || [ "$choice" = "6" ]; then
607 | system_update
608 | else
609 | system_update --select $choice
610 | fi
611 |
612 | }
613 |
614 | # Update SPI Bootloader
615 | flash_uboot() {
616 |
617 | if [ ! -e /dev/mtdblock0 ]; then
618 | colorecho "$RED" "Error : SPI Flash not found"
619 | sleep 1
620 | exit 1
621 | else
622 | if [ -z "$1" ]; then
623 | title "Arch Rock Configuration Utility - Update SPI Bootloader"
624 | colorecho "$GREEN" "Select an option to confirm"
625 | colorecho "$RED" "Warning : The SPI NOR flash will be cleared."
626 | echo ""
627 | options=("Install Radxa U-Boot" "Install Radxa U-Boot (Debug Version)" "Install EDK2 Bootloader for Rock 5A (UEFI)" "Install EDK2 Bootloader for Rock 5B (UEFI)" "Install Armbian Bootloader" "Exit")
628 | select_option "${options[@]}"
629 | choice=$?
630 | else
631 | case $1 in
632 | "radxa")
633 | choice=0
634 | ;;
635 | "radxa-debug")
636 | choice=1
637 | ;;
638 | "edk2-rock5a")
639 | choice=2
640 | ;;
641 | "edk2-rock5b")
642 | choice=3
643 | ;;
644 | "armbian")
645 | choice=4
646 | ;;
647 | *)
648 | colorecho "$RED" "Invalid Option, Exiting ..."
649 | exit 1
650 | ;;
651 | esac
652 | fi
653 |
654 | # Choice
655 | case $choice in
656 | 0)
657 | # Fetch the HTML content of the URL and extract the latest image filename
658 | which_url=$uboot_url
659 | colorecho "$GREEN" "Fetching latest Radxa U-Boot Image ..."
660 | latest_image=$(curl -s "$which_url" | grep -o 'rock-5b-spi-image-[a-z0-9-]*\.img' | head -n 1)
661 | ;;
662 | 1)
663 | # Fetch the HTML content of the URL and extract the latest image filename
664 | which_url=$uboot_debug_url
665 | colorecho "$GREEN" "Fetching latest Radxa U-Boot (Debug Version) Image ..."
666 | latest_image=$(curl -s "$which_url" | grep -o 'rock-5b-spi-image-[a-z0-9-]*\-debug.img' | head -n 1)
667 | ;;
668 | 2)
669 | # Fetch the HTML content of the URL and extract the latest image filename
670 | which_url=$edk2_url
671 | colorecho "$GREEN" "Fetching EDK2 Bootloader (UEFI) ..."
672 | latest_image=$(curl -s "$which_url" | grep -wo "https.*rock-5a.*\.img" | head -n 1)
673 | which_url="$(dirname "$latest_image")/"
674 | latest_image=$(basename "$latest_image")
675 | ;;
676 | 3)
677 | # Fetch the HTML content of the URL and extract the latest image filename
678 | which_url=$edk2_url
679 | colorecho "$GREEN" "Fetching EDK2 Bootloader (UEFI) ..."
680 | latest_image=$(curl -s "$which_url" | grep -wo "https.*rock-5b.*\.img" | head -n 1)
681 | which_url="$(dirname "$latest_image")/"
682 | latest_image=$(basename "$latest_image")
683 | ;;
684 | 4)
685 | # Fetch the HTML content of the URL and extract the latest image filename
686 | which_url=$armbian_url
687 | colorecho "$GREEN" "Fetching Armbian Bootloader ..."
688 | latest_image=$(basename "$which_url")
689 | which_url="$(dirname "$which_url")/"
690 | ;;
691 | *)
692 | exit 1
693 | ;;
694 | esac
695 | fi
696 |
697 | ###
698 | colorecho "$GREEN" "Install bootloader to the SPI NOR flash ..."
699 |
700 |
701 | colorecho "$GREEN" "Downloading Zero Image ..."
702 | curl -LJO ${zero_url}
703 |
704 | if ! [ -x "$(command -v gzip)" ]; then
705 | sudo pacman -Sy gzip --noconfirm
706 | fi
707 |
708 | colorecho "$GREEN" "Extracting Zero Image ..."
709 | gzip -d zero.img.gz
710 |
711 | colorecho "$GREEN" "Flashing Zero Image to SPI NOR flash ..."
712 | sudo dd if=zero.img of=/dev/mtdblock0
713 |
714 | # Remove zero.img
715 | sudo rm -rf zero.img
716 |
717 | if [ -n "$latest_image" ]; then
718 | # Download the latest image using wget
719 | colorecho "$GREEN" "Downloading SPI U-Boot Image from ${which_url}${latest_image} ..."
720 | curl -LJO ${which_url}${latest_image}
721 | else
722 | colorecho "$RED" "Fetch Error : No image found."
723 | sleep 1
724 | exit 1
725 | fi
726 |
727 | colorecho "$GREEN" "Flashing SPI U-Boot Image ${latest_image} to SPI NOR flash ..."
728 | sudo dd if=${latest_image} of=/dev/mtdblock0
729 | sync
730 | colorecho "$GREEN" "Installed bootloader to SPI NOR flash"
731 |
732 | # Remove u-boot image file
733 | sudo rm -rf ${latest_image}
734 |
735 | }
736 |
737 | # Re-install Kernel
738 | install_kernel() {
739 |
740 | title "Arch Rock Configuration Utility - Build & Install Kernel"
741 |
742 | if [ -z "$1" ]; then
743 | colorecho "$GREEN" "Select a kernel package to install:"
744 | echo ""
745 | options=("linux-radxa-rkbsp5-bin (AUR) - Install Radxa BSP Kernel (Linux 5.10) from Binary Package")
746 | options+=("linux-radxa-rkbsp5-git (AUR) - Install Radxa BSP Kernel (Linux 5.10) from Source Code")
747 | options+=("linux-rk3588-midstream (GitHub) - Install Googulator's Experimental Midstream kernel (Linux 6.2) from Source Code")
748 | #options+=("linux-rk3588-collabora (GitHub) - Install Collabora's Experimental Upstream kernel (Linux 6.5) from Source Code")
749 | options+=("Return to Main Menu")
750 | select_option "${options[@]}"
751 | choice=$?
752 | fi
753 |
754 | # Choice
755 | if [ "$choice" = 0 ] || [ "$1" = "rkbsp-bin" ]; then
756 | install_rkbsp5_bin
757 | elif [ "$choice" = 1 ] || [ "$1" = "rkbsp-git" ]; then
758 | install_rkbsp5_git
759 | elif [ "$choice" = 2 ] || [ "$1" = "midstream-git" ]; then
760 | install_midstream_git
761 | else
762 | config_options
763 | fi
764 | }
765 |
766 | # Move Arch Linux
767 | move_system() {
768 | echo "Not implemented"
769 | }
770 |
771 | ################################################################
772 | # Manage Packages
773 |
774 | # Manage Packages Main Menu
775 | manage_packages() {
776 | title "Arch Rock Configuration Utility - Manage Packages"
777 | options=("Install / Update Software - Install Basic Software / RK3588 Specified / Customized Packages")
778 | options+=("Downgrade Packages - Install / Downgrade any Arch Linux Packages from Archive")
779 | options+=("Add Pacman Repo - Add a repository to archlinux system's package manager (pacman).")
780 | options+=("Return to Main Menu")
781 | select_option "${options[@]}"
782 | choice=$?
783 |
784 | # Choice
785 | case $choice in
786 | 0)
787 | install_packages
788 | ;;
789 | 1)
790 | downgrade_packages
791 | ;;
792 | 2)
793 | add_repo
794 | ;;
795 | *)
796 | config_options
797 | ;;
798 | esac
799 |
800 | }
801 |
802 | # Install Packages
803 | install_packages() {
804 |
805 | if [ "$launch_as_installer" = 1 ]; then
806 | title "Install Additional Packages"
807 | else
808 | title "Arch Rock Configuration Utility - Install / Update Software"
809 | fi
810 |
811 | category=("Web - Surf the Internet" "Communication - Connect with friends, family, teams" "Suites - Office & Productivity Software" "Multimedia - Audio, Video, Graphics Software" "Gaming / Emulation / Virtualization Software" "Development Tools - Editors, IDEs, Build Tools" "Misc - Firmware Driver, other Tools and Software")
812 |
813 | if [ "$launch_as_installer" = 1 ]; then
814 | options=("Finish Installation")
815 | else
816 | options=("Return to Main Menu")
817 | fi
818 |
819 | options+=("$GREEN----------------------------------------------------" "$GREEN Install / Update Software (Press enter to select/deselect): " "$GREEN----------------------------------------------------$GREEN")
820 | options+=("${category[@]}$NC")
821 |
822 | select_option "${options[@]}"
823 | choice=$?
824 |
825 | if [ "$choice" = "0" ]; then
826 | if [ "$launch_as_installer" = 1 ]; then
827 | colorecho "$GREEN" "Finishing installation ..."
828 | else
829 | config_options
830 | fi
831 | elif [ "$choice" = "1" ] || [ "$choice" = "2" ] || [ "$choice" = "3" ]; then
832 | install_packages
833 | else
834 | install_pkg_category $choice
835 | fi
836 |
837 | }
838 |
839 | install_pkg_category() {
840 |
841 | if [ "$1" = "--select" ]; then
842 | local selected_option="${poptions[$2]}"
843 |
844 | if [[ " ${selection[*]} " == *" $selected_option "* ]]; then
845 | options[$2]="[ ] ${selected_option}"
846 | selection=("${selection[@]/$selected_option}")
847 | else
848 | options[$2]="[x] ${selected_option}"
849 | selection+=("$selected_option")
850 | fi
851 | else
852 | selection=()
853 | options=("Return to Category" "Install Selected Packages")
854 | options+=("$GREEN Deselect All $NC")
855 | poptions=("${options[@]}")
856 |
857 | case $1 in
858 | 4)
859 | categorytitle="Arch Rock Configuration Utility - Install Web"
860 | update_list=("firefox" "chromium" "ungoogled-chromium" "openssh" "nodejs" "nvm" "wget")
861 | ;;
862 | 5)
863 | categorytitle="Arch Rock Configuration Utility - Install Communication"
864 | update_list=("telegram-desktop" "teams" "discord" "signal" "silos")
865 | ;;
866 | 6)
867 | categorytitle="Arch Rock Configuration Utility - Install Suites"
868 | update_list=("libreoffice" "wps-office-cn" "abiword" "gnumeric" "gnucash" "glabels" "glom" "dia")
869 | ;;
870 | 7)
871 | categorytitle="Arch Rock Configuration Utility - Install Multimedia"
872 | update_list=("kodi" "vlc" "lollypop" "rhythmbox" "gimp" "inkscape" "krita" "audacity" "ardour" "blender")
873 | ;;
874 | 8)
875 | categorytitle="Arch Rock Configuration Utility - Install Gaming / Emulation / Virtualization"
876 | if [ "$branch" = "dev" ]; then
877 | update_list=("box64" "box86" "steam" "malior-droid" "wine64" "qemu-full")
878 | else
879 | update_list=("box64" "qemu-full")
880 | fi
881 | ;;
882 | 9)
883 | categorytitle="Arch Rock Configuration Utility - Install Development Tools"
884 | update_list=("code" "sublime-text-4" "gedit" "vim" "gnome-terminal" "konsole" "xterm" "git" "python-pipx" "python2")
885 | ;;
886 | 10)
887 | categorytitle="Arch Rock Configuration Utility - Install Misc"
888 | update_list=("intel-ax210-fw" "yay" "neofetch" "screenfetch" "s-tui" "stress")
889 | ;;
890 | esac
891 |
892 | for ((i=0; i<${#update_list[@]}; i++)); do
893 | options+=("[ ] ${update_list[i]}")
894 | poptions+=("${update_list[i]}")
895 | done
896 | fi
897 |
898 | title "$categorytitle"
899 |
900 | select_option "${options[@]}"
901 | choice=$?
902 |
903 | if [ "$choice" = "0" ]; then
904 | install_packages
905 | elif [ "$choice" = "1" ]; then
906 | install_selected_pkg
907 | install_packages
908 | elif [ "$choice" = "2" ]; then
909 | install_pkg_category
910 | else
911 | install_pkg_category --select $choice
912 | fi
913 |
914 | }
915 |
916 | install_selected_pkg() {
917 |
918 | for ((i=0; i<${#selection[@]}; i++)); do
919 | echo " Install ${selection[i]}"
920 | case ${selection[i]} in
921 | "chromium")
922 | if sudo pacman -Ssy "^chromium-mpp$" &> /dev/null; then
923 | sudo pacman -S chromium-mpp
924 | sudo systemctl enable --now libv4l-rkmpp-setup.service
925 | # Check if the file /etc/chromium-browser exists
926 | if [ ! -e "/etc/chromium-browser" ]; then
927 | # Create the directory /etc/chromium-browser
928 | sudo mkdir -p "/etc/chromium-browser"
929 | fi
930 | echo -e "# Default settings for chromium-browser. This file is sourced by /bin/sh from\n# /usr/bin/chromium-browser\n\n# Options to pass to chromium-browser\nLD_LIBRARY_PATH=/usr/lib/mali-valhall-g610/x11-wayland-gbm\nCHROMIUM_FLAGS=\"--use-gl=egl\"" | sudo tee /etc/chromium-browser/default >/dev/null
931 | else
932 | sudo pacman -S chromium --noconfirm
933 | fi
934 | ;;
935 | "nvm")
936 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
937 | export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
938 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
939 | source ~/.bashrc
940 | ;;
941 | "teams")
942 | install_from_source "aur://teams-for-linux"
943 | ;;
944 | "discord")
945 | install_from_source "aur://armcord-bin"
946 | ;;
947 | "signal")
948 | install_from_source "aur://fpm"
949 | install_from_source "aur://signal-desktop-arm"
950 | ;;
951 | "wine64")
952 | colorecho "$RED" "Warning: This is experimental."
953 | installWine64
954 | ;;
955 | "box86")
956 | colorecho "$YELLOW" "This is experimental."
957 | echo "Package Not Available, try update to latest utility."
958 | ;;
959 | "steam")
960 | arch-rock-config install box86
961 | colorecho "$YELLOW" "Make sure you installed box86 before installing Steam. This is experimental."
962 | installSteam
963 | ;;
964 | "malior-droid")
965 | colorecho "$RED" "Warning: This is experimental."
966 | installMaliorDroid
967 | ;;
968 | "code")
969 | install_from_source "aur://visual-studio-code-bin"
970 | ;;
971 | "radxa-imager")
972 | install_from_source "gh://rock5-images-repo/radxa-imager"
973 | ;;
974 | "kodi")
975 | if sudo pacman -Ssy "^kodi-nexus-mpp-git$" &> /dev/null; then
976 | sudo pacman -S kodi-nexus-mpp-git --noconfirm
977 | if ! sudo pacman -Qs kodi-nexus-mpp-git > /dev/null ; then
978 | sudo pacman -S kodi-nexus-mpp-git
979 | fi
980 | fi
981 | ;;
982 | "intel-ax210-fw")
983 | #wifi
984 | sudo wget -P /lib/firmware https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/iwlwifi-ty-a0-gf-a0-59.ucode
985 | sudo mv /lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm /lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm.bak
986 | #bt
987 | sudo wget -P /lib/firmware/intel https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/intel/ibt-0041-0041.sfi
988 | sudo wget -P /lib/firmware/intel https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/intel/ibt-0041-0041.ddc
989 | ;;
990 | "yay")
991 | install_from_source "aur://yay-git"
992 | ;;
993 | *)
994 | if [[ "${selection[i]}" == *"://"* ]]; then
995 | colorecho "$GREEN" "Installing package from ${selection[i]} ..."
996 | install_from_source "${selection[i]}"
997 | elif sudo pacman -Ssy "^${selection[i]}$" &> /dev/null; then
998 | colorecho "$GREEN" "Installing ${selection[i]} with pacman ..."
999 | sudo pacman -S ${selection[i]} --noconfirm
1000 | elif pkg_tar=($(echo -e "n" | install_ghrel_packages "${selection[i]}" | grep '.*pkg.*')); then
1001 | colorecho "$GREEN" "Installing ${selection[i]} from adrepo ..."
1002 | install_ghrel_packages "${selection[i]}"
1003 | else
1004 | colorecho "$GREEN" "Compling and Installing ${selection[i]} from AUR ..."
1005 | install_from_source "aur://${selection[i]}"
1006 | fi
1007 | ;;
1008 | esac
1009 | done
1010 | }
1011 |
1012 | # Install Packages from Archive
1013 | downgrade_packages() {
1014 | title "Arch Rock Configuration Utility - Downgrade Packages"
1015 |
1016 | if [ -z "$1" ]; then
1017 | read -p "Enter package to downgrade: " dgpkg
1018 | else
1019 | dgpkg=$1
1020 | fi
1021 |
1022 | if [ -z "$2" ]; then
1023 | nopkg=15
1024 | else
1025 | nopkg=$2
1026 | fi
1027 |
1028 |
1029 | dgpkgfb=$(echo $dgpkg | cut -b 1)
1030 | which_url="${alaa_url}packages/${dgpkgfb}/${dgpkg}/"
1031 | colorecho "$GREEN" "Fetching $which_url ..."
1032 | #latest_image=$(curl -s "$which_url" | grep -o '*-aarch64.pkg.tar.xz' | head -n 1)
1033 | dgpkg_list=$(curl -s "$which_url" | grep -v '.sig' | grep -o 'href="[^"]*"' | sed 's/href="//;s/"$//' | grep -o ${dgpkg}.*-aarch64.pkg.tar.xz)
1034 | dgpkg_date=$(curl -s "$which_url" | grep -v '.sig' | grep -o "${dgpkg}.*-aarch64.pkg.tar.xz.*.* | " | grep -o ".* | " | awk -F'| | ' '{print $2}')
1035 |
1036 | #paste -d ' ' <(echo "$dgpkg_list") <(echo "$dgpkg_date") | sort -k 2,2 -r
1037 | dgpkg_list=($(paste -d ' ' <(echo "$dgpkg_list") <(echo "$dgpkg_date") | sort -k 2,2 -r | awk '{print $1}' | head -n $nopkg))
1038 | select_option "${dgpkg_list[@]}"
1039 | choice=$?
1040 |
1041 | install_pkg_from_url ${which_url}${dgpkg_list[choice]}
1042 | }
1043 |
1044 | add_repo() {
1045 | if [ -z "$1" ]; then
1046 | title "Arch Rock Configuration Utility - Add Pacman Repo"
1047 | read -p "Enter repo name: " repo_name
1048 | read -p "Enter server URL for $repo_name repo: " server_url
1049 | read -p "Do you want to add a GPG key for $repo_name repo? [Y/n]: " add_gpg_key
1050 | if [[ $add_gpg_key == [Yy]* ]]; then
1051 | read -p "Enter GPG key for $repo_name repo: " gpg_key
1052 | fi
1053 | elif [ "$1" = "7Ji" ]; then
1054 | server_url="https://github.com/7Ji/archrepo/releases/download/\$arch"
1055 | gpg_key="BA27F219383BB875"
1056 | elif [ "$1" = "BredOS" ]; then
1057 | server_url="https://github.com/BredGang/bred-repo/raw/main/\$repo/\$arch"
1058 | else
1059 | colorecho "$RED" "Invalid repo name. Aborting."
1060 | return 1
1061 | fi
1062 |
1063 | if [ -z "$repo_name" ]; then
1064 | repo_name="$1"
1065 | fi
1066 |
1067 | colorecho "$GREEN" "Adding $repo_name to pacman.conf ..."
1068 |
1069 | if [ -z "$gpg_key" ]; then
1070 | echo -e "[$repo_name]\nServer = $server_url" | sudo tee -a /etc/pacman.conf
1071 | else
1072 | echo -e "[$repo_name]\nSigLevel = Never\nServer = $server_url" | sudo tee -a /etc/pacman.conf
1073 | colorecho "$GREEN" "Adding GPG keys ..."
1074 | sudo pacman-key --recv-keys "$gpg_key"
1075 | sudo pacman-key --lsign "$gpg_key"
1076 | fi
1077 |
1078 | colorecho "$GREEN" "Updating repo ..."
1079 | sudo pacman -Syy --noconfirm
1080 | colorecho "$GREEN" "Done"
1081 | }
1082 |
1083 | ################################################################
1084 | # Credits to NicoD https://github.com/NicoD-SBC/armbian-gaming/blob/main/armbian-gaming.sh
1085 |
1086 | installWinex86() {
1087 |
1088 | sudo rm /usr/local/bin/wine
1089 | sudo rm /usr/local/bin/wine64
1090 | sudo rm /usr/local/bin/wineserver
1091 | sudo rm /usr/local/bin/winecfg
1092 | sudo rm /usr/local/bin/wineboot
1093 | sudo rm -r ~/.wine/
1094 | sudo rm -r ~/wine/
1095 | sudo cp wine /usr/local/bin/
1096 | sudo chmod +x /usr/local/bin/wine
1097 | echo "Copied wine to /usr/local/bin/ and given rights "
1098 |
1099 | sudo cp wineserver /usr/local/bin/
1100 | sudo chmod +x /usr/local/bin/wineserver
1101 | echo "Copied wineserver to /usr/local/bin/ and given rights "
1102 |
1103 |
1104 | sudo cp winetricks /usr/local/bin/
1105 | sudo chmod +x /usr/local/bin/winetricks
1106 | echo "Copied winetricks to /usr/local/bin/ and given rights "
1107 |
1108 | cp wine-config.desktop ~/.local/share/applications/
1109 | cp wine-desktop.desktop ~/.local/share/applications/
1110 | echo "Copied wine-config.desktop and wine-desktop.desktop to ~/.local/share/applications/ "
1111 | echo " "
1112 |
1113 | mkdir ~/wine/
1114 | mkdir ~/wine/lib/
1115 | cp libwine.so ~/wine/lib/
1116 | cp libwine.so.1 ~/wine/lib/
1117 | echo "Created wine folder and copied libwine.so and libwine.so.1 "
1118 | echo " "
1119 |
1120 | cd ~/wine/
1121 | curl -LJO https://github.com/Kron4ek/Wine-Builds/releases/download/7.15/wine-7.15-x86.tar.xz
1122 | sudo apt -y install xz-utils tar
1123 | xz -d wine-7.15-x86.tar.xz
1124 | tar -xf wine-7.15-x86.tar
1125 | cd wine-7.15-x86/
1126 | cp -R * ~/wine
1127 | sudo ln -s ~/wine/bin/wine /usr/local/bin/wine
1128 | sudo ln -s ~/wine/bin/winecfg /usr/local/bin/winecfg
1129 | sudo ln -s ~/wine/bin/wineserver /usr/local/bin/wineserver
1130 |
1131 | }
1132 |
1133 | installWine64() {
1134 | sudo rm -r ~/.wine/
1135 | sudo rm -r ~/wine/
1136 | cd ~
1137 | curl -LJO https://www.playonlinux.com/wine/binaries/phoenicis/upstream-linux-amd64/PlayOnLinux-wine-6.0.1-upstream-linux-amd64.tar.gz
1138 | mkdir ~/wine
1139 | cd ~/wine
1140 | tar xf ../PlayOnLinux-wine-6.0.1-upstream-linux-amd64.tar.gz
1141 | sudo rm /usr/local/bin/wine
1142 | sudo rm /usr/local/bin/wine64
1143 | sudo rm /usr/local/bin/wineserver
1144 | sudo rm /usr/local/bin/winecfg
1145 | sudo rm /usr/local/bin/wineboot
1146 | sudo ln -s ~/wine/bin/wine /usr/local/bin/wine
1147 | sudo ln -s ~/wine/bin/wine64 /usr/local/bin/wine64
1148 | sudo ln -s ~/wine/bin/wineserver /usr/local/bin/wineserver
1149 | sudo ln -s ~/wine/bin/winecfg /usr/local/bin/winecfg
1150 | sudo ln -s ~/wine/bin/wineboot /usr/local/bin/wineboot
1151 | cd ..
1152 | sudo rm PlayOnLinux-wine-6.0.1-upstream-linux-amd64.tar.gz
1153 | echo "Wine installed, test with : "
1154 | echo "box64 wine winecfg "
1155 | }
1156 |
1157 | installMaliorDroid() {
1158 | echo "Installing Malior-Droid! Thanks to monkaBlyat and ChisBread! "
1159 | sudo pacman -Sy docker android-tools --noconfirm
1160 | sudo systemctl start docker
1161 |
1162 | sudo mkdir /dev/binderfs
1163 | sudo mount -t binder binder /dev/binderfs
1164 |
1165 | wget -O - https://github.com/ChisBread/malior/raw/main/install.sh > /tmp/malior-install.sh && bash /tmp/malior-install.sh && rm /tmp/malior-install.sh
1166 | malior update
1167 | malior install malior-droid
1168 | malior-droid update
1169 |
1170 | #install scrpy version 2.0 that is needed for audio forwarding from the android docker container
1171 | sudo pacman -S scrcpy --noconfirm
1172 | echo "To use : "
1173 | echo "adb connect localhost:5555 "
1174 | echo "scrcpy -s localhost:5555 "
1175 | }
1176 |
1177 | # Credits to https://jamesachambers.com/radxa-rock-5b-steam-installation-guide-for-armbian/
1178 | installSteam() {
1179 | echo 'export STEAMOS=1
1180 | export STEAM_RUNTIME=1
1181 | export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1' | sudo tee /etc/profile.d/steam.sh
1182 |
1183 | #if you have a high resolution screen use this instead
1184 | #echo 'export GDK_SCALE=2' | sudo tee -a /etc/profile.d/steam.sh
1185 | source /etc/profile.d/steam.sh
1186 |
1187 | cd ~/box86
1188 | ./install_steam.sh
1189 | }
1190 |
1191 | ################################################################
1192 | # Performance & Features
1193 |
1194 | # Performance & Features Main Menu
1195 | performance_features() {
1196 | title "Arch Rock Configuration Utility - Performance & Features"
1197 | options=("SoC Performance Profile - Available options are performance, ondemand and powersave")
1198 | options+=("PWM Fan Control - Configure PWM Fan-control service")
1199 | #options+=("Overclocking - Configure rk3588-unlock-opps overlay which increases CPU supply & CPU VDD supply")
1200 | #options+=("Overlay - Configure Device Tree Overlay")
1201 | options+=("Return to Main Menu")
1202 | select_option "${options[@]}"
1203 | choice=$?
1204 |
1205 | # Choice
1206 | case $choice in
1207 | 0)
1208 | soc_profile
1209 | ;;
1210 | 1)
1211 | fan_control
1212 | ;;
1213 | #2)
1214 | #overclocking
1215 | #;;
1216 | #3)
1217 | #overlays
1218 | #;;
1219 | *)
1220 | config_options
1221 | ;;
1222 | esac
1223 |
1224 | }
1225 |
1226 | # SoC Performance Profile
1227 | soc_profile() {
1228 |
1229 | if [ -z "$1" ] || [ "$1" = "status" ]; then
1230 | if [ -z "$1" ]; then
1231 | title "Arch Rock Configuration Utility - SoC Performance Profile"
1232 | else
1233 | title "Arch Rock Configuration Utility - SoC Monitor"
1234 | fi
1235 | colorecho "$BLUE" "CPU Profile: $(cat /sys/bus/cpu/devices/cpu[046]/cpufreq/scaling_governor)"
1236 | colorecho "$BLUE" "Memory Profile: $(cat /sys/class/devfreq/dmc/governor)"
1237 | colorecho "$BLUE" "GPU Profile: $(cat /sys/class/devfreq/fb000000.gpu/governor)"
1238 | fi
1239 |
1240 | if [ -z "$1" ]; then
1241 | echo ""
1242 | options=("Performance - Run SoC at full performance" "On Demand - Run SoC on CPU usage demand" "Power Save - Run SoC on Power Saving Mode" "Return to Main Menu")
1243 | select_option "${options[@]}"
1244 | choice=$?
1245 | else
1246 | case $1 in
1247 | "performance")
1248 | choice=0
1249 | ;;
1250 | "ondemand")
1251 | choice=1
1252 | ;;
1253 | "powersave")
1254 | choice=2
1255 | ;;
1256 | "status")
1257 | choice=99
1258 | ;;
1259 | "force-performance")
1260 | force_performance_at_boot
1261 | choice=99
1262 | ;;
1263 | *)
1264 | colorecho "$RED" "Invalid Option, Exiting ..."
1265 | exit 1
1266 | ;;
1267 | esac
1268 | fi
1269 |
1270 | if [ "$choice" = "0" ]; then
1271 | echo performance | sudo tee /sys/bus/cpu/devices/cpu[046]/cpufreq/scaling_governor /sys/class/devfreq/dmc/governor /sys/class/devfreq/fb000000.gpu/governor
1272 | colorecho "$GREEN" "Profile set to Performance"
1273 | elif [ "$choice" = "1" ]; then
1274 | echo ondemand | sudo tee /sys/bus/cpu/devices/cpu[046]/cpufreq/scaling_governor && echo dmc_ondemand | sudo tee /sys/class/devfreq/dmc/governor && echo simple_ondemand | sudo tee /sys/class/devfreq/fb000000.gpu/governor
1275 | colorecho "$GREEN" "Profile set to On Demand"
1276 | elif [ "$choice" = "2" ]; then
1277 | echo powersave | sudo tee /sys/bus/cpu/devices/cpu[046]/cpufreq/scaling_governor /sys/class/devfreq/dmc/governor /sys/class/devfreq/fb000000.gpu/governor
1278 | colorecho "$GREEN" "Profile set to Power Save"
1279 | elif [ "$choice" = "99" ]; then
1280 | fan_control status --soc-monitor
1281 | else
1282 | config_options
1283 | fi
1284 |
1285 | }
1286 |
1287 | # PWM Fan Control
1288 | fan_control() {
1289 |
1290 | if [ -z "$1" ] || [ "$1" = "status" ]; then
1291 |
1292 | if [ -z "$2" ]; then
1293 | title "Arch Rock Configuration Utility - PWM Fan Control"
1294 |
1295 | if systemctl is-active --quiet fan-control; then
1296 | fanstatus=1
1297 | else
1298 | fanstatus=0
1299 | fi
1300 |
1301 | if [ "$fanstatus" = 1 ]; then
1302 | colorecho "$GREEN" "Fan Control Status: Enabled"
1303 | #colorecho "$GREEN" "PWM Fan Speed: 50%"
1304 | else
1305 | colorecho "$GREEN" "Fan Control Status: Disabled"
1306 | fi
1307 |
1308 | fi
1309 |
1310 | temp_cmd=($(cat /sys/class/thermal/thermal_zone*/temp))
1311 | temp_type_cmd=($(cat /sys/class/thermal/thermal_zone*/type))
1312 | cpu_freq_cmd=($(sudo cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq))
1313 | temp_list=()
1314 | temp_type_list=()
1315 | cpu_freq_list=()
1316 |
1317 | for ((i=0; i<${#temp_cmd[@]}; i++)); do
1318 | temp_list+=("$((temp_cmd[i] / 1000))")
1319 | temp_type_list+=("${temp_type_cmd[i]%-thermal}")
1320 | done
1321 |
1322 | for ((i=0; i<${#cpu_freq_cmd[@]}; i++)); do
1323 | cpu_freq_list+=("$((cpu_freq_cmd[i] / 1000))")
1324 | done
1325 |
1326 | if [ -z "$2" ]; then
1327 | colorecho "$GREEN" "Clock Speed (Efficient Core): ${cpu_freq_list[0]}MHz"
1328 | colorecho "$GREEN" "Clock Speed (Performance Core 0): ${cpu_freq_list[4]}MHz"
1329 | colorecho "$GREEN" "Clock Speed (Performance Core 1): ${cpu_freq_list[6]}MHz"
1330 | elif [ "$2" = "--soc-monitor" ]; then
1331 | colorecho "$GREEN" "Clock Speed (Efficient Core 0): ${cpu_freq_list[0]}MHz"
1332 | colorecho "$GREEN" "Clock Speed (Efficient Core 1): ${cpu_freq_list[1]}MHz"
1333 | colorecho "$GREEN" "Clock Speed (Efficient Core 2): ${cpu_freq_list[2]}MHz"
1334 | colorecho "$GREEN" "Clock Speed (Efficient Core 3): ${cpu_freq_list[3]}MHz"
1335 | colorecho "$GREEN" "Clock Speed (Performance Core 0): ${cpu_freq_list[4]}MHz"
1336 | colorecho "$GREEN" "Clock Speed (Performance Core 1): ${cpu_freq_list[5]}MHz"
1337 | colorecho "$GREEN" "Clock Speed (Performance Core 2): ${cpu_freq_list[6]}MHz"
1338 | colorecho "$GREEN" "Clock Speed (Performance Core 3): ${cpu_freq_list[7]}MHz"
1339 | fi
1340 |
1341 | colorecho "$GREEN" "SoC Temp (${temp_type_list[0]}): ${temp_list[0]}C"
1342 | colorecho "$GREEN" "CPU Temp (${temp_type_list[1]}): ${temp_list[1]}C"
1343 | colorecho "$GREEN" "CPU Temp (${temp_type_list[2]}): ${temp_list[2]}C"
1344 | colorecho "$GREEN" "CPU Temp (${temp_type_list[3]}): ${temp_list[3]}C"
1345 | colorecho "$GREEN" "SoC Temp (${temp_type_list[4]}): ${temp_list[4]}C"
1346 | colorecho "$GREEN" "GPU Temp (${temp_type_list[5]}): ${temp_list[5]}C"
1347 | colorecho "$GREEN" "NPU Temp (${temp_type_list[6]}): ${temp_list[6]}C"
1348 | echo ""
1349 |
1350 | options=("Return to Main Menu")
1351 | fi
1352 |
1353 | if [ -z "$1" ]; then
1354 | if [[ -e "/lib/systemd/system/fan-control.service" ]]; then
1355 |
1356 | if [ "$fanstatus" = 1 ]; then
1357 | options+=("Disable PWM Fan Control")
1358 | else
1359 | options+=("Enable PWM Fan Control")
1360 | fi
1361 |
1362 | #options+=("Configure Fan Profile")
1363 | else
1364 | options+=("Install PWM Fan Control")
1365 | fi
1366 | fi
1367 |
1368 | if [ -z "$1" ] || [ "$1" = "status" ]; then
1369 | select_option "${options[@]}"
1370 | choice=$?
1371 | else
1372 | case $1 in
1373 | "enable"|"disable"|"install")
1374 | choice=1
1375 | ;;
1376 | #"config")
1377 | #choice=2
1378 | #;;
1379 | *)
1380 | colorecho "$RED" "Invalid Option, Exiting ..."
1381 | exit 1
1382 | ;;
1383 | esac
1384 | fi
1385 |
1386 | if [ "$choice" = "1" ]; then
1387 | if [[ -e "/lib/systemd/system/fan-control.service" ]]; then
1388 | if [ "$fanstatus" = 1 ]; then
1389 | colorecho "$GREEN" "Stopping PWM Fan Control ..."
1390 | sudo systemctl stop fan-control
1391 |
1392 | colorecho "$GREEN" "Disabling PWM Fan Control ..."
1393 | sudo systemctl disable fan-control
1394 |
1395 | colorecho "$GREEN" "Disabled PWM Fan Control, a reboot maybe required to take effect."
1396 | else
1397 | colorecho "$GREEN" "Enabling PWM Fan Control ..."
1398 | sudo systemctl enable fan-control
1399 |
1400 | colorecho "$GREEN" "Starting PWM Fan Control ..."
1401 | sudo systemctl start fan-control
1402 | fi
1403 | else
1404 | if ! [ -x "$(command -v dpkg)" ]; then
1405 | colorecho "$GREEN" "Package dpkg not found. Installing ..."
1406 | sudo pacman -Sy dpkg --noconfirm
1407 | fi
1408 |
1409 | colorecho "$GREEN" "Cloning fan-control-rock5b ..."
1410 | git clone https://github.com/lukaszsobala/fan-control-rock5b.git
1411 | cd fan-control-rock5b
1412 |
1413 | colorecho "$GREEN" "Compiling fan-control-rock5b ..."
1414 | make package
1415 |
1416 | colorecho "$GREEN" "Installing fan-control-rock5b ..."
1417 | sudo dpkg -i fan-control*.deb
1418 |
1419 | colorecho "$GREEN" "Enabling fan-control.service ..."
1420 | sudo systemctl enable fan-control
1421 |
1422 | colorecho "$GREEN" "Starting fan-control.service ..."
1423 | sudo systemctl start fan-control
1424 |
1425 | if [ -z $rock5a ]; then
1426 | colorecho "$GREEN" "Installed PWM Fan Control."
1427 | else
1428 | echo step_wise | sudo tee /sys/class/thermal/thermal_zone0/policy
1429 | colorecho "$GREEN" "Installed PWM Fan Control, a reboot maybe required to take effect."
1430 | fi
1431 |
1432 | fi
1433 | else
1434 | config_options
1435 | fi
1436 |
1437 | }
1438 |
1439 | # Overclocking
1440 | overclocking() {
1441 | echo "Not implemented"
1442 | }
1443 |
1444 | force_performance_at_boot() {
1445 | echo -e "[Unit]\nDescription=Set Performance Mode on Boot\nAfter=multi-user.target\n\n[Service]\nType=oneshot\nExecStart=/bin/bash -c \"echo performance > /sys/bus/cpu/devices/cpu4/cpufreq/scaling_governor; echo performance > /sys/bus/cpu/devices/cpu0/cpufreq/scaling_governor; echo performance > /sys/bus/cpu/devices/cpu6/cpufreq/scaling_governor; echo performance > /sys/class/devfreq/dmc/governor; echo performance > /sys/class/devfreq/fb000000.gpu/governor\"\n\n[Install]\nWantedBy=multi-user.target" | sudo tee /etc/systemd/system/force-performance.service > /dev/null
1446 | sudo systemctl daemon-reload
1447 | sudo systemctl enable force-performance.service
1448 | }
1449 |
1450 | # Device Tree Overlay
1451 | overlays() {
1452 | echo "Not implemented"
1453 | }
1454 |
1455 | ################################################################
1456 | # User & Localization
1457 |
1458 | # User & Localization Main Menu
1459 | user_localization() {
1460 | title "Arch Rock Configuration Utility - User & Localization"
1461 | options=("Manage User - Add, Remove and Change User Account Settings")
1462 | options+=("Locale - Generate Locale Settings")
1463 | options+=("Fonts - Install Fonts, TTF, Non-English Characters, Special Characters / Emoji")
1464 | options+=("Time - Change Time Zone, Current Date and Time")
1465 | options+=("Keyboard Layout - Change Keyboard Layout")
1466 | options+=("WiFi Country - Change WiFi Country Settings")
1467 | options+=("Return to Main Menu")
1468 | select_option "${options[@]}"
1469 | choice=$?
1470 |
1471 | # Choice
1472 | case $choice in
1473 | 0)
1474 | manage_user
1475 | ;;
1476 | 1)
1477 | locale
1478 | ;;
1479 | 2)
1480 | fonts
1481 | ;;
1482 | 3)
1483 | timezone
1484 | ;;
1485 | 4)
1486 | keyboard
1487 | ;;
1488 | 5)
1489 | wifi_country
1490 | ;;
1491 | *)
1492 | config_options
1493 | ;;
1494 | esac
1495 |
1496 | }
1497 |
1498 | # Function to manage user accounts
1499 | manage_user() {
1500 |
1501 | confirm_password() {
1502 | while [[ -z "$new_pw" || -z "$cfm_pw" || "$new_pw" != "$cfm_pw" ]]; do
1503 | read -s -p "Set a password for $new_user: " new_pw
1504 | echo
1505 | read -s -p "Confirm password for $new_user: " cfm_pw
1506 | echo
1507 | done
1508 | }
1509 |
1510 | if [ -z "$1" ]; then
1511 | title "Arch Rock Configuration Utility - Manage User"
1512 |
1513 | # List all user accounts
1514 | real_users=($(getent passwd | awk -F: '$3 >= 1000 && $3 < 65534 {print $1}'))
1515 |
1516 | # Prompt to add a new user
1517 | select_options=("Return to User & Localization Menu" "Add User")
1518 | select_options+=("${real_users[@]}")
1519 |
1520 | select_option "${select_options[@]}"
1521 | choice=$?
1522 |
1523 | elif [ "$1" = "add" ]; then
1524 | choice=1
1525 | new_user=$2
1526 | elif [ "$1" = "remove" ]; then
1527 | choice=99
1528 | t_user=$2
1529 | elif [ "$1" = "manage" ]; then
1530 | selected_user=$2
1531 | manage_action=$3
1532 | fi
1533 |
1534 | case $choice in
1535 | 0)
1536 | user_localization
1537 | ;;
1538 | 1)
1539 | if [ -z "$new_user" ]; then
1540 | title "Arch Rock Configuration Utility - Add New User"
1541 | read -p "Enter username for the new user: " new_user
1542 | fi
1543 | if [ -z "$new_pw" ]; then
1544 | confirm_password
1545 | fi
1546 | sudo useradd -m "$new_user"
1547 | echo -e "$new_pw\n$cfm_pw" | sudo passwd "$new_user"
1548 | sudo usermod -aG wheel "$new_user"
1549 | sudo usermod -aG video "$new_user"
1550 | sudo usermod -aG audio "$new_user"
1551 | sudo usermod -aG games "$new_user"
1552 | sudo usermod -aG log "$new_user"
1553 | sudo usermod -aG lp "$new_user"
1554 | sudo usermod -aG optical "$new_user"
1555 | sudo usermod -aG power "$new_user"
1556 | sudo usermod -aG scanner "$new_user"
1557 | sudo usermod -aG storage "$new_user"
1558 | ;;
1559 | 99)
1560 | if [ -z "$t_user" ]; then
1561 | title "Arch Rock Configuration Utility - Remove User"
1562 | read -p "Enter username to remove: " t_user
1563 | fi
1564 | # Remove account
1565 | sudo userdel -r $t_user
1566 | if [ $? -eq 0 ]; then
1567 | echo "account removed successfully"
1568 | else
1569 | echo "Error removing account"
1570 | fi
1571 | ;;
1572 | *)
1573 | if [ -z "$selected_user" ]; then
1574 | selected_user=${real_users[$((choice - 2))]}
1575 | fi
1576 |
1577 | if [ -z "$manage_action" ]; then
1578 | title "Arch Rock Configuration Utility - Manage $selected_user"
1579 | colorecho "$GREEN" "User: $selected_user"
1580 | echo ""
1581 |
1582 | # Perform actions for the selected user (if needed)
1583 | options=("Return to Manage User Menu" "Change User Password")
1584 |
1585 | if sudo -lU "$selected_user" | grep -q NOPASSWD; then
1586 | options+=("Enable Sudo Password")
1587 | else
1588 | options+=("Disable Sudo Password")
1589 | fi
1590 |
1591 | select_option "${options[@]}"
1592 | choice=$?
1593 | elif [ "$manage_action" = "sudopw" ]; then
1594 | choice=2
1595 | fi
1596 |
1597 | case $choice in
1598 | 0)
1599 | manage_user
1600 | ;;
1601 | 1)
1602 | sudo passwd "$selected_user"
1603 | ;;
1604 | 2)
1605 | if sudo -lU "$selected_user" | grep -q NOPASSWD; then
1606 | sudo sed -i "s/^\($selected_user.*\)NOPASSWD: ALL/\1ALL/" /etc/sudoers
1607 | colorecho "$GREEN" "Enabled Sudo Password for $selected_user"
1608 | else
1609 | # NOPASSWD is not set, check if the user exists in sudoers file
1610 | if sudo grep -q "^[^#]*$selected_user ALL" /etc/sudoers; then
1611 | # User exists, change (ALL) ALL to (ALL) NOPASSWD: ALL
1612 | sudo sed -i "s/^\($selected_user.*\)(ALL) ALL/\1(ALL) NOPASSWD: ALL/" /etc/sudoers
1613 | echo "Changed $selected_user permissions to NOPASSWD: ALL"
1614 | else
1615 | # User does not exist, add it to sudoers file
1616 | echo "$selected_user ALL=(ALL) NOPASSWD: ALL" | sudo tee -a "/etc/sudoers" >/dev/null
1617 | echo "Added $selected_user to sudoers file with NOPASSWD: ALL"
1618 | fi
1619 | colorecho "$GREEN" "Disabled Sudo Password for $selected_user"
1620 | fi
1621 | ;;
1622 | esac
1623 | ;;
1624 | esac
1625 | }
1626 |
1627 | # Function to select and generate locale
1628 | locale() {
1629 |
1630 | generated_locales=$(sudo locale -a)
1631 |
1632 | if [ -z "$1" ]; then
1633 | title "Arch Rock Configuration Utility - Locale"
1634 |
1635 | # List available locales
1636 | colorecho "$GREEN" "Generated Locales:"
1637 |
1638 | echo "$generated_locales"
1639 | echo ""
1640 |
1641 | # Prompt to select and generate locale
1642 | select_options=("Generate New Locales" "Return to User & Localization Menu")
1643 | select_option "${select_options[@]}"
1644 | choice=$?
1645 | elif [ "$1" = "list-generated" ]; then
1646 | echo "$generated_locales"
1647 | exit 1
1648 | elif [ "$1" = "list-available" ] || [ "$1" = "generate" ]; then
1649 | choice=0
1650 | else
1651 | colorecho "$RED" "Invalid option"
1652 | exit 1
1653 | fi
1654 |
1655 | case $choice in
1656 | 0)
1657 | # Read available locales from file and add numbers
1658 | IFS=$'\n' read -d '' -ra locales <<< "$(grep -E '^#[^[:space:]]' /etc/locale.gen | sed 's/^#//')"
1659 | IFS=$'\n' read -d '' -ra langcode <<< "$(grep -E '^#[^[:space:]]' /etc/locale.gen | sed 's/^#//; s/[ @.].*//' | uniq)"
1660 |
1661 | if [ ! "$1" = "list-available" ]; then
1662 |
1663 | if [ "$1" = "generate" ] && [ -z "$2" ] || [ "$1" = "locale" ] && [ -z "$2" ] || [ -z "$1" ]; then
1664 | colorecho "$GREEN" "Available Locales for generation:"
1665 |
1666 | for ((i = 0; i < ${#langcode[@]}; i++)); do
1667 | echo "$((i + 1))) ${langcode[$i]}"
1668 | done
1669 |
1670 | read -p "Enter the locale number: " chosen_number
1671 | chosen_locale=${langcode[$((chosen_number - 1))]}
1672 | colorecho "$GREEEN" "Picked $chosen_locale"
1673 | else
1674 | chosen_locale=$2
1675 | fi
1676 |
1677 | # Iterate through the array and find matches
1678 | matches=()
1679 | for ((i = 0; i < ${#locales[@]}; i++)); do
1680 | element="${locales[i]}"
1681 | if [[ "$element" =~ $chosen_locale ]]; then
1682 | matches+=("$element")
1683 | fi
1684 | done
1685 |
1686 | title "Arch Rock Configuration Utility - Generate Locale"
1687 | colorecho "$GREEN" "The following locales will be added:"
1688 |
1689 | for ((i = 0; i < ${#matches[@]}; i++)); do
1690 | echo "${matches[i]}"
1691 | done
1692 |
1693 | if [ -z "$3" ]; then
1694 | select_options=("Generate Locales" "Cancel")
1695 | select_option "${select_options[@]}"
1696 | choice=$?
1697 | elif [ "$3" = "-y" ]; then
1698 | choice=0
1699 | else
1700 | colorecho "$RED" "Invalid option"
1701 | exit 1
1702 | fi
1703 |
1704 | if [ "$choice" = 0 ]; then
1705 | for ((i = 0; i < ${#matches[@]}; i++)); do
1706 | sudo sed -i "s|#${matches[i]}|${matches[i]}|" /etc/locale.gen
1707 | done
1708 | sudo locale-gen
1709 | fi
1710 |
1711 | else
1712 | for ((i = 0; i < ${#langcode[@]}; i++)); do
1713 | echo "${langcode[$i]}"
1714 | done
1715 | fi
1716 | ;;
1717 | *)
1718 | user_localization
1719 | ;;
1720 | esac
1721 | }
1722 |
1723 | # Function to manage fonts
1724 | fonts() {
1725 | title "Arch Rock Configuration Utility - Fonts"
1726 |
1727 | # Prompt to install fonts
1728 | select_options=("Install Noto Fonts (including CJK and Emoji) - Support Asian Characters" "Install TTF Fonts from File" "Return to User & Localization Menu")
1729 | select_option "${select_options[@]}"
1730 | choice=$?
1731 |
1732 | case $choice in
1733 | 0)
1734 | sudo pacman -S noto-fonts noto-fonts-cjk noto-fonts-emoji --noconfirm
1735 | ;;
1736 | 1)
1737 | read -p "Enter the path to the TTF font file: " font_path
1738 | sudo cp "$font_path" /usr/share/fonts/TTF/
1739 | sudo fc-cache -f -v
1740 | ;;
1741 | *)
1742 | user_localization
1743 | ;;
1744 | esac
1745 | }
1746 |
1747 | # Function to change time zone and date/time
1748 | timezone() {
1749 |
1750 | # Get current time zone and network time zone
1751 | current_timezone=$(timedatectl show --property=Timezone --value)
1752 | network_timezone=$(curl -s https://ipapi.co/timezone)
1753 |
1754 |
1755 | if [ -z "$1" ]; then
1756 |
1757 | title "Arch Rock Configuration Utility - Time Zone"
1758 |
1759 | colorecho "$GREEN" "Network Time Zone: $network_timezone"
1760 |
1761 | if [ "$current_timezone" = "$network_timezone" ]; then
1762 | colorecho "$GREEN" "Current Time Zone: $current_timezone"
1763 | else
1764 | colorecho "$RED" "Current Time Zone: $current_timezone"
1765 | fi
1766 |
1767 | echo ""
1768 | select_options=("Return to User & Localization Menu" "Set Time Zone Manually" "Set Date & Time Manually")
1769 |
1770 | if [ "$current_timezone" != "$network_timezone" ]; then
1771 | select_options+=("Synchronize Time Zone with Network")
1772 | fi
1773 |
1774 | select_option "${select_options[@]}"
1775 | choice=$?
1776 |
1777 | elif [ "$1" = "set-time-zone" ]; then
1778 | if [ -z "$2" ]; then
1779 | choice=1
1780 | elif [ "$2" = "sync" ]; then
1781 | choice=3
1782 | else
1783 | choice=1
1784 | new_timezone=$2
1785 | fi
1786 | elif [ "$1" = "set-time-date" ]; then
1787 | choice=2
1788 | elif [ "$1" = "network-time-zone" ]; then
1789 | echo $network_timezone
1790 | elif [ "$1" = "system-time-zone" ]; then
1791 | echo $current_timezone
1792 | fi
1793 |
1794 | case $choice in
1795 | 0)
1796 | user_localization
1797 | ;;
1798 | 1)
1799 | if [ -z "$new_timezone" ]; then
1800 | read -p "Enter new time zone (e.g., Asia/Tokyo): " new_timezone
1801 | fi
1802 | sudo timedatectl set-timezone "$new_timezone"
1803 | echo "Time Zone updated to $new_timezone"
1804 | sudo timedatectl set-ntp true
1805 | ;;
1806 | 2)
1807 | read -p "Enter the new date and time in format 'YYYY-MM-DD HH:MM:SS': " new_datetime
1808 | sudo timedatectl set-time "$new_datetime"
1809 | ;;
1810 | 3)
1811 | sudo timedatectl set-timezone "$network_timezone"
1812 | sudo timedatectl set-ntp true
1813 | colorecho "$GREEN" "Time Zone synchronized with network."
1814 | ;;
1815 | esac
1816 | }
1817 |
1818 | # Function to change keyboard layout
1819 | keyboard() {
1820 | title "Arch Rock Configuration Utility - Keyboard Layout"
1821 |
1822 | # Get current keyboard layout
1823 | current_layout=$(localectl status | grep "X11 Layout" | awk '{print $3}')
1824 |
1825 | echo "Current Keyboard Layout: $current_layout"
1826 |
1827 | # Prompt to select new keyboard layout
1828 | select_options=("Change Keyboard Layout" "Return to User & Localization Menu")
1829 | select_option "${select_options[@]}"
1830 | choice=$?
1831 |
1832 | case $choice in
1833 | 0)
1834 | read -p "Enter new keyboard layout (e.g., us, de): " new_layout
1835 | sudo localectl set-x11-keymap "$new_layout"
1836 | echo "Keyboard Layout updated to $new_layout"
1837 | ;;
1838 | *)
1839 | user_localization
1840 | ;;
1841 | esac
1842 | }
1843 |
1844 | # Function to change WiFi country
1845 | wifi_country() {
1846 | title "Arch Rock Configuration Utility - WiFi Country"
1847 |
1848 | # Get available WiFi countries
1849 | wifi_countries=("Return to User & Localization Menu")
1850 | wifi_countries+=($(iw reg get | grep -o -E '^[A-Z]{2}'))
1851 |
1852 | # Display available WiFi countries and prompt to select
1853 | select_option "${wifi_countries[@]}"
1854 | choice=$?
1855 |
1856 | if [ "$choice" -ge 1 ] && [ "$choice" -le "${#wifi_countries[@]}" ]; then
1857 | selected_country=${wifi_countries[$((choice))]}
1858 | sudo iw reg set "$selected_country"
1859 | echo "WiFi Country updated to $selected_country"
1860 | else
1861 | user_localization
1862 | fi
1863 | }
1864 |
1865 | ################################################################
1866 | # Main Program
1867 |
1868 | ### Options ###
1869 | if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
1870 | colorecho "$BLUE" "Arch Rock Configuration Utility (BUILD $utilver-$branch)"
1871 | echo "Usage: arch-rock-config "
1872 |
1873 | colorecho "$GREEN" "Options"
1874 | echo "-h / --help : Usage and Infomation of this configuration utility."
1875 | echo "-r / --run : Run without installing this configuration utility to PATH (/usr/bin)."
1876 | echo "-u / --update : Install latest configuration utility without checking updates. options: main, dev."
1877 |
1878 | colorecho "$GREEN" "Features"
1879 | colorecho "$YELLOW" "System Maintenance"
1880 | echo "upgrade : Check & Perform Selective / Full System Upgrade."
1881 | echo "install-kernel : Build & Install other Linux Kernel from source. options: rkbsp-bin, rkbsp-git, midstream-git."
1882 | echo "flash-bootloader : Flash Latest SPI Bootloader. options: radxa, radxa-debug, edk2-rock5a, edk2-rock5b, armbian."
1883 |
1884 | colorecho "$YELLOW" "Manage Packages"
1885 | echo "install : Install Software / RK3588 Specified / Customized Packages. : package name."
1886 | echo "downgrade : Install / Downgrade any Arch Linux Packages from Archive. : package name : index to show, default=15."
1887 | echo "add-7ji : Add 7Ji Arch Linux repo to pacman"
1888 |
1889 | colorecho "$YELLOW" "Performance & Features"
1890 | echo "soc