1+ #! /usr/bin/env bash
2+ #
3+ # #DO NOT RUN DIRECTLY
4+ # #Self: bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Github/Runners/bootstrap/artix.sh")
5+ # -------------------------------------------------------#
6+
7+ # -------------------------------------------------------#
8+ set -x
9+ # # No aarch64 docker yet: https://hub.docker.com/r/artixlinux/artixlinux
10+ # # Though it does exist: https://wiki.artixlinux.org/Main/Aarch64
11+ # # https://armtixlinux.org/
12+ # # https://gitea.artixlinux.org/artixdocker/artixlinux-docker
13+ if [ " $( uname -m) " == " aarch64" ]; then
14+ exit 0
15+ fi
16+ # -------------------------------------------------------#
17+
18+ # -------------------------------------------------------#
19+ # #Bootstrap
20+ pushd " $( mktemp -d) " > /dev/null 2>&1
21+ docker stop " artix-base" 2> /dev/null ; docker rm " artix-base" 2> /dev/null
22+ docker run --name " artix-base" --privileged " artixlinux/artixlinux:latest" bash -l -c '
23+ #Bootstrap
24+ pacman -y --sync --refresh --refresh --sysupgrade --noconfirm --debug
25+ packages="bash binutils curl fakechroot fakeroot git wget"
26+ for pkg in $packages; do pacman -Sy "${pkg}" --noconfirm ; done
27+ for pkg in $packages; do pacman -Sy "${pkg}" --needed --noconfirm ; done
28+ #Fix & Patches
29+ sed ' \' ' /DownloadUser/d' \' ' -i "/etc/pacman.conf"
30+ #sed ' \' ' s/^.*Architecture\s*=.*$/Architecture = auto/' \' ' -i "/etc/pacman.conf"
31+ sed ' \' ' 0,/^.*SigLevel\s*=.*/s//SigLevel = Never/' \' ' -i "/etc/pacman.conf"
32+ #sed ' \' ' s/^.*SigLevel\s*=.*$/SigLevel = Never/' \' ' -i "/etc/pacman.conf"
33+ sed ' \' ' /#\[multilib\]/,/#Include = .*/s/^#//' \' ' -i "/etc/pacman.conf"
34+ echo -e "nameserver 8.8.8.8\nnameserver 2620:0:ccc::2" | tee "/etc/resolv.conf"
35+ echo -e "nameserver 1.1.1.1\nnameserver 2606:4700:4700::1111" | tee -a "/etc/resolv.conf"
36+ unlink "/var/lib/dbus/machine-id" 2>/dev/null
37+ unlink "/etc/machine-id" 2>/dev/null
38+ rm -rvf "/etc/machine-id"
39+ systemd-machine-id-setup --print 2>/dev/null | tee "/var/lib/dbus/machine-id"
40+ cat "/var/lib/dbus/machine-id" | tee "/etc/machine-id"
41+ pacman -Scc --noconfirm
42+ echo "disable-scdaemon" | tee "/etc/pacman.d/gnupg/gpg-agent.conf"
43+ curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Github/Runners/bootstrap/archlinux_hooks.sh" -o "/arch_hooks.sh"
44+ chmod +x "/arch_hooks.sh" ; "/arch_hooks.sh"
45+ rm -rfv "/arch_hooks.sh"
46+ echo "LANG=en_US.UTF-8" | tee "/etc/locale.conf"
47+ echo "LANG=en_US.UTF-8" | tee -a "/etc/locale.conf"
48+ echo "LANGUAGE=en_US:en" | tee -a "/etc/locale.conf"
49+ echo "LC_ALL=en_US.UTF-8" | tee -a "/etc/locale.conf"
50+ echo "en_US.UTF-8 UTF-8" | tee -a "/etc/locale.gen"
51+ echo "LC_ALL=en_US.UTF-8" | tee -a "/etc/environment"
52+ locale-gen ; locale-gen "en_US.UTF-8"
53+ #Cleanup
54+ pacman -y --sync --refresh --refresh --sysupgrade --noconfirm
55+ pacman -Rsn base-devel --noconfirm
56+ pacman -Rsn perl --noconfirm
57+ pacman -Rsn python --noconfirm
58+ pacman -Scc --noconfirm
59+ #Fake-Sudo
60+ pacman -Rsndd sudo 2>/dev/null
61+ rm -rvf "/usr/bin/sudo" 2>/dev/null
62+ curl -qfsSL "https://github.com/pkgforge/devscripts/releases/download/common-utils/fake-sudo-pkexec.tar.zst" -o "./fake-sudo-pkexec.tar.zst" && chmod +x "./fake-sudo-pkexec.tar.zst"
63+ pacman -Uddd "./fake-sudo-pkexec.tar.zst" --noconfirm
64+ pacman -Syy fakeroot --needed --noconfirm
65+ rm -rvf "./fake-sudo-pkexec.tar.zst"
66+ #Yay
67+ curl -qfsSL "https://github.com/pkgforge/devscripts/releases/download/common-utils/yay-$(uname -m)" -o "/usr/bin/yay" && chmod +x "/usr/bin/yay"
68+ yay --version ; which fakeroot yay sudo
69+ #More cleanup
70+ rm -rfv "/usr/share/gtk-doc/"* 2>/dev/null
71+ rm -rfv "/usr/share/man/"* 2>/dev/null
72+ rm -rfv "/usr/share/help/"* 2>/dev/null
73+ rm -rfv "/usr/share/info/"* 2>/dev/null
74+ rm -rfv "/usr/share/doc/"* 2>/dev/null
75+ rm -rfv "/var/tmp/"* 2>/dev/null
76+ rm -rfv "/var/lib/pacman/sync/"* 2>/dev/null
77+ rm -rfv "/var/cache/pacman/pkg/"* 2>/dev/null
78+ find "/boot" -mindepth 1 -delete 2>/dev/null
79+ find "/dev" -mindepth 1 -delete 2>/dev/null
80+ find "/proc" -mindepth 1 -delete 2>/dev/null
81+ find "/run" -mindepth 1 -delete 2>/dev/null
82+ find "/sys" -mindepth 1 -delete 2>/dev/null
83+ find "/tmp" -mindepth 1 -delete 2>/dev/null
84+ find "/usr/include" -mindepth 1 -delete 2>/dev/null
85+ find "/usr/lib" -type f -name "*.a" -print -exec rm -rfv "{}" 2>/dev/null \; 2>/dev/null
86+ find "/usr/lib32" -type f -name "*.a" -print -exec rm -rfv "{}" 2>/dev/null \; 2>/dev/null
87+ find "/etc/pacman.d/gnupg" -type f -name "S.*" -print -exec rm -rfv "{}" 2>/dev/null \; 2>/dev/null
88+ find "/usr/share/locale" -mindepth 1 -maxdepth 1 ! -regex ".*/\(locale.alias\|en\|en_US\)$" -exec rm -rfv "{}" + 2>/dev/null
89+ find "/usr/share/doc" -mindepth 1 -delete 2>/dev/null
90+ find "/usr/share/gtk-doc" -mindepth 1 -delete 2>/dev/null
91+ find "/usr/share/help" -mindepth 1 -delete 2>/dev/null
92+ find "/usr/share/info" -mindepth 1 -delete 2>/dev/null
93+ find "/usr/share/man" -mindepth 1 -delete 2>/dev/null
94+ find "." -type d -name "__pycache__" -exec rm -rfv "{}" \; 2>/dev/null
95+ find "." -type f -name "*.pacnew" -exec rm -rfv "{}" \; 2>/dev/null
96+ find "." -type f -name "*.pacsave" -exec rm -rfv "{}" \; 2>/dev/null
97+ find "/var/log" -type f -name "*.log" -exec rm -rfv "{}" \; 2>/dev/null
98+ rm -rfv "/"{tmp,proc,sys,dev,run} 2>/dev/null
99+ mkdir -pv "/"{tmp,proc,sys,dev,run/media,mnt,media,home} 2>/dev/null
100+ rm -fv ""/etc/{host.conf,hosts,nsswitch.conf} 2>/dev/null
101+ touch ""/etc/{host.conf,hosts,nsswitch.conf} 2>/dev/null
102+ hostname 2>/dev/null; cat "/etc/os-release" 2>/dev/null'
103+ # #Export
104+ docker export " $( docker ps -aqf ' name=artix-base' ) " --output " rootfs.tar"
105+ if [[ -f " ./rootfs.tar" ]] && [[ $( stat -c%s " ./rootfs.tar" ) -gt 10000 ]]; then
106+ rsync -achLv --mkpath " ./rootfs.tar" " /tmp/rootfs.tar"
107+ else
108+ echo " \n[-] FATAL: Failed to export ROOTFS\n"
109+ exit 1
110+ fi
111+ popd " $( mktemp -d) " > /dev/null 2>&1
112+ # -------------------------------------------------------#
113+
114+
115+ # -------------------------------------------------------#
116+ # #Push
117+ # ENV
118+ D_ID=" $( docker ps -aqf ' name=artix-base' | tr -d ' [:space:]' ) "
119+ D_TAG=" v$( date +' %Y.%m.%d' | tr -d ' [:space:]' ) "
120+ export D_ID D_TAG
121+ # Tags
122+ docker commit " ${D_ID} " " pkgforge/artix-base:latest"
123+ docker commit " ${D_ID} " " ghcr.io/pkgforge/devscripts/artix-base:latest"
124+ docker commit " ${D_ID} " " pkgforge/artix-base:${D_TAG} "
125+ docker commit " ${D_ID} " " ghcr.io/pkgforge/devscripts/artix-base:${D_TAG} "
126+ docker commit " ${D_ID} " " pkgforge/artix-base:$( uname -m) "
127+ docker commit " ${D_ID} " " ghcr.io/pkgforge/devscripts/artix-base:$( uname -m) "
128+ # Push
129+ docker push " pkgforge/artix-base:latest"
130+ docker push " ghcr.io/pkgforge/devscripts/artix-base:latest"
131+ docker push " pkgforge/artix-base:${D_TAG} "
132+ docker push " ghcr.io/pkgforge/devscripts/artix-base:${D_TAG} "
133+ docker push " pkgforge/artix-base:$( uname -m) "
134+ docker push " ghcr.io/pkgforge/devscripts/artix-base:$( uname -m) "
135+ # -------------------------------------------------------#
0 commit comments