Skip to content

Instantly share code, notes, and snippets.

@donnaken15
Created March 13, 2026 09:13
Show Gist options
  • Select an option

  • Save donnaken15/53e5a1ab888f1822595357ed77574eb7 to your computer and use it in GitHub Desktop.

Select an option

Save donnaken15/53e5a1ab888f1822595357ed77574eb7 to your computer and use it in GitHub Desktop.
CURL ISNT WORKING, THANKS CLOUDFLARE | runit+btrfs only (200mb install, requires 1.1gb)
#!/bin/bash
echo -n 'Enter disk to install to (CHOOSE CAREFULLY, default: /dev/sda): '
[ `whoami` != root ] && sudo -i
{
disk="$(head -1 /dev/tty)"; disk="${disk:-/dev/sda}"; echo "The chosen one: $disk"
dd if=/dev/zero of="$disk" bs=4K status=progress; echo -e "o\nn\np\n1\n\n\nw\nq" | fdisk "${disk}"
#echo -e "o\nn\np\n1\n\n+44M\nn\np\n2\n\n\nw\nq" | fdisk "${disk}"
#mkfs.ext2 -L BOOT "${disk}1"
#mkfs.ext4 -L ROOT "${disk}2" # abandoning lol
mkfs.btrfs -fL PROJ "${disk}1"
pushd /mnt; mkdir -p boot root proj; popd
mount -o 'compress=zstd:19' "${disk}1" /mnt
btrfs subvolume create /mnt/proj
#mount "${disk}2" /mnt
#mount "${disk}1" /mnt/boot
echo '---------- before install ----------'; df -h; echo '------------------------------------';
basestrap /mnt base runit elogind-runit linux-lts nano less grub dhclient htop connman-runit virtualbox-guest-utils-nox upx btrfs-progs
echo '---------- after install ----------'; df -h; echo '------------------------------------';
fstabgen -U /mnt | sed 's/\(rw,relatime\)/\1,compress=zstd:14,space_cache=v2,noatime/g' >> /mnt/etc/fstab
export disk terms=3; artix-chroot /mnt bash <<'die_linus'
function stupid() {
curl -Lo "$1.pkg.zst" "https://archlinux.org/packages/${2:-extra}/`uname -m`/$1/download/"
yes | pacman -U "$1.pkg.zst"
rm -f "$1.pkg.zst"
}
stupid compsize
echo '---------- before cleanup ----------'; df -h; compsize /; echo '------------------------------------';
yes | pacman -Scc
echo '---------- after cleanup ----------'; df -h; compsize /; echo '------------------------------------';
ln -sf /etc/runit/sv/connmand /etc/runit/runsvdir/default
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
hwclock --systohc
echo '---------- before locale ----------'; df -h; compsize /; echo '------------------------------------';
cat <<america > /etc/locale.gen
en_US.UTF-8 UTF-8
en_US ISO-8859-1
america
locale-gen
locale-gen --purge en_US.UTF-8 UTF-8 en_US ISO-8859-1
cat <<america > /etc/locale.conf
export LANG="en_US.UTF-8"
export LC_COLLATE="C"
america
echo '---------- after locale ----------'; df -h; compsize /; echo '------------------------------------';
echo wesnix > /etc/hostname
cat <<EOF > /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 wesnix.localdomain wesnix
EOF
echo grub
sed -i 's/^MODULES=()$/MODULES=(btrfs)/' /etc/mkinitcpio.conf
echo "COMPRESSION=xz" >> /etc/mkinitcpio.conf
mkinitcpio -P
grub-install --recheck "${disk}"
grub-mkconfig -o /boot/grub/grub.cfg
cat <<EOF > /etc/default/grub
GRUB_TIMEOUT=0
GRUB_TIMEOUT_STYLE=hidden
EOF
update-grub
pacman -Rsn --noconfirm grub
rm -rf /boot/grub/themes /boot/grub/locale
echo . | passwd -sq
rm /etc/runit/runsvdir/current/logind /etc/runit/runsvdir/current/agetty-tty[$((terms+1))-6]
sed -i 's/\(GETTY_ARGS="\)\([^"]\+\)"/\1\2 --autologin root"/' /etc/runit/sv/agetty-tty1/conf
echo 'OPTS="--noplugin=vpn"' > /etc/runit/sv/connmand
echo '---------- before cleanup ----------'; df -h; compsize /; echo '------------------------------------';
yes | pacman -Rddsn licenses pciutils psmisc shadow # TOTALLY USELESS
# iproute2 dhclient iputils
yes | pacman -Rsn `pacman -Qqtdn`
#yes | pacman -Rdd file # genuinely worthless bloat, useful 2% of the time
yes | pacman -Scc
# ----- i cant read my own scripts
cd /var; rm -rf empty games local opt tmp spool mail; rm -f /usr/lib/udev/hwdb.bin
cd /usr/share; rm -rf /usr/include /usr/local /usr/src man doc licenses hwdata emacs info gir-1.0 gtk-doc
for l in "A[a-ln-z]*" "America/[A-MO-Z]*" "America/N[a-df-z]*" B* EET Egypt Eire Europe "GB*" "[CH-T]*" "[V-Z]*"; do
rm -rf zoneinfo/$l zoneinfo/right/$l zoneinfo-leaps/$l
done
for l in "[a-df-klm-z]*" "e[^n]*" "en@*" "en_[^U][^S]*"; do
#echo locale/$l i18n/locales/$l
rm -rf locale/$l i18n/locales/$l
done
cd kbd; rm -rf keymaps/[a-gi-z]* keymaps/i18n consolefonts/[^l]*
cd ../terminfo; find . -type f | grep -Ev '/(linux|xterm|xterm-256color|vt100|vt220)$' | xargs rm
rm -rf /boot/grub/locale/
cd /usr/lib/modules/*-lts/kernel
rm -rf net/wireless media bluetooth sound/pci sound/soc staging fs/xfs
rm -rf drivers/net/[a-dg-z]* drivers/net/e*/[a-hm-uw-z]*
cd drivers/gpu/drm; rm -rf radeon amdgpu nouveau i915
echo '---------- after cleanup ----------'; df -h; compsize /; echo '------------------------------------';
echo 'zero out free space'
cat << defrag > /bin/defrag
#!/bin/sh
echo defragging system
btrfs filesystem defragment -rczstd "$(findmnt -no TARGET --target .)"
echo wiping free space
touch .defrag
chattr +mC .defrag
dd if=/dev/zero of=.defrag status=progress
rm .defrag
sync
defrag
chmod +x /bin/defrag
cat <<'modclean' > /root/modclean # RUN ONLY IF YOU'RE DEAD SET ON KEEPING THE CURRENTLY LOADED MODULES IN THE SYSTEM WHEN EXECUTED
#!/bin/sh
pushd "`dirname "$0"`"
lsmod | cut -d' ' -f1 | xargs -I{} modinfo -n {} 2>/dev/null | tar --remove-files -PcT- -f mods.tar # thanks claude
rm -rf /usr/lib/modules/*-lts/kernel
tar -xf mods.tar -C /
rm -f mods.tar
popd
# nothing changes
#find /usr/lib/modules -name '*.ko.zst' | while read -r f; do
# b=`stat -Lc'%s' -- "$f"`
# zstd -dq -- "$f" && zstd --rm --ultra -19fq -- "${f%.zst}"
# stat -Lc"$b > %s : ${f##*/}" -- "$f"
#done
modclean
chmod +x /root/modclean
cat <<htop > /root/.config/htop/htoprc
htop_version=3.3.0
config_reader_min_version=3
fields=5 0 39 2 52 53 1
hide_kernel_threads=1
hide_userland_threads=0
hide_running_in_container=0
shadow_other_users=1
show_thread_names=1
show_program_path=0
highlight_base_name=1
highlight_deleted_exe=1
shadow_distribution_path_prefix=0
highlight_megabytes=1
highlight_threads=1
highlight_changes=1
highlight_changes_delay_secs=1
find_comm_in_cmdline=1
strip_exe_from_cmdline=1
show_merged_command=1
header_margin=1
screen_tabs=0
detailed_cpu_time=0
cpu_count_from_one=1
show_cpu_usage=1
show_cpu_frequency=0
show_cpu_temperature=0
degree_fahrenheit=1
update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=2
enable_mouse=1
delay=1
hide_function_bar=1
header_layout=four_25_25_25_25
column_meters_0=CPU(1) CPU(5) Blank DateTime System
column_meter_modes_0=1 1 2 2 2
column_meters_1=CPU(2) CPU(6) Blank Uptime
column_meter_modes_1=1 1 2 2
column_meters_2=CPU(3) CPU(7) Blank CPU Tasks
column_meter_modes_2=1 1 2 1 2
column_meters_3=CPU(4) CPU(8) Blank Memory Swap
column_meter_modes_3=1 1 2 1 1
tree_view=1
sort_key=46
tree_sort_key=1
sort_direction=-1
tree_sort_direction=1
tree_view_always_by_pid=0
all_branches_collapsed=0
screen:jaosn=SESSION PID M_RESIDENT STATE PERCENT_NORM_CPU ELAPSED Command
.sort_key=PERCENT_CPU
.tree_sort_key=Command
.tree_view_always_by_pid=0
.tree_view=1
.sort_direction=-1
.tree_sort_direction=1
.all_branches_collapsed=0
htop
curl 'https://github.com/dylanaraps/neofetch/raw/refs/heads/master/neofetch' | bash
# stupid (BLOATING)
#find / -name '*.gz' | while read -r f; do
# b=`stat -Lc'%s' -- "$f"`
# gzip -dq -- "$f" && gzip -9f -- "${f%.gz}"
# stat -Lc"$b > %s : ${f##*/}" -- "$f"
#done
die_linus
echo '---------- before squash ----------'; df -h; echo '------------------------------------';
echo 'optimizing /lib/ and /bin/'
find /mnt/usr/lib -name '*.a' -or -name '*.so' -or -name '*.so.*' | xargs strip -gSdxXp --strip-dwo --strip-unneeded -- /mnt/usr/bin/* 2>/dev/null
strip -sp -- /mnt/usr/bin/* 2>/dev/null #echo upx; pushd /mnt/bin &&
#./upx --best --ultra-brute -- xgettext dhclient udevadm captree sqldiff sqlite3* showdb dbhash dbdump showstat4 index_usage gawk-5.4.0 gpg connmand ldconfig openssl dwp ip as readelf upx ld ld.gold && popd
echo '---------- after squash ----------'; df -h; echo '------------------------------------';
echo defragging; pushd /mnt/root; ./defrag; popd
rm -f /mnt/root/.bash_history
#ls /mnt; lsblk
umount -R /mnt
} 2>&1 | tee /mnt/install.log
reboot # halt
while :; do read; done # NO CONTROL NO SURPRISE THROW THE KEYS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment