WIP: installer

This commit is contained in:
λmolinae 2025-04-24 23:00:20 -06:00
parent 0821d684a9
commit 2ad168cfe3
2 changed files with 101 additions and 11 deletions

View file

@ -1,10 +1,99 @@
#!/bin/sh
dotfiles="https://git.amolinae.com/amolinae06/dotfiles.git"
software="software.csv"
devsoftware=""
if [ "$(id -u)" -ne 0 ]
then echo "You must run this script as root"
exit 1
fi
apk_install(){
echo "installing $1"; apk add "$1" >/dev/null 2>&1
}
git_install(){
echo "cloning from $1"; su - "$user" -c "cd ~/.local/src && git clone \"$1\"" >/dev/null 2>&1
}
deploy_dotfiles(){
printf "Deploying dotfiles..."
su - $user -c "git clone $dotfiles && cd dotfiles && rm -rf .git README.md && cp -r .* $HOME && cd && rm -rf dotfiles"
}
read_software(){
tail -n +2 "$software" | sed -E ':a; s/("[^"]*),([^"]*")/\1\2/; ta' | while IFS=',' read -r NAME DESCRIPTION GIT GIT_URL; do
case "$GIT" in
"N") apk_install $NAME ;;
"Y") git_install "$GIT_URL" ;;
*) echo "ERROR: failed to determine $NAME."; exit 1 ;;
esac
done
printf "Successfully installed all software!"
}
setup_greetd(){
printf "Setting up greetd"
cat <<EOF > /etc/greetd/config.toml
[terminal]
vt = 7
[default_session]
command = "tuigreet -t -r --cmd /home/$user/.local/bin/dwmlaunch"
user = "greetd"
EOF
rc-update add greetd default
printf "Finished setting up greetd."
}
setup_shell(){
usermod -s /bin/zsh "$user"
echo "changed "$user"'s shell to zsh"
}
setup_bluetooth(){
printf "Setting up bluetooth"
rc-update add bluetooth default
printf "Done."
}
setup_home(){
su - $user -c "xdg-user-dirs-update && mkdir ~/Documents/Miscellaneous"
}
setup_chroot(){
printf "Setting up chroot"
apk_install curl
cd "/home/$user/Documents/Miscellaneous"
mkdir alpchroot
curl -LO https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/apk-tools-static-2.14.4-r1.apk
tar -xzf apk-tools-static-*.apk
./sbin/apk.static -X https://dl-cdn.alpinelinux.org/alpine/v3.20/main -U --allow-untrusted -p ${chroot_dir} --initdb add alpine-base
mount -o bind /dev alpchroot/dev
mount -t proc none alpchroot/proc
mount -o bind /sys alpchroot/sys
cp -L /etc/resolv.conf alpchroot/etc/
chown
mkdir -p alpchroot/etc/apk
echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main" > alpchroot/etc/apk/repositories
apk del curl
}
check_root(){
if [ "$(id -u)" -ne 0 ]; then
echo "ERROR: you must run this script as root."; exit 1
else
echo "ROOT: OK"
fi
}
get_user(){
printf "Please enter the name of your user: "
read -r user
}
check_root
echo "Welcome to the installer"
apk_install git
get_user
read_software
deploy_dotfiles
setup_greetd
setup_shell
setup_bluetooth

View file

@ -2,14 +2,15 @@ NAME,DESCRIPTION,GIT,GIT URL
bluez,"Tools for the Bluetooth protocol stack",N,
brillo,"Control the brightness of backlight and keyboard LED devices",N,
btop,"Resource monitor",N,
bubblewrap,"Unprivileged sandboxing tool",N,
chafa,"Terminal graphics for the 21st century",N,
ctpv,"Image previews for lf file manager",Y,https://github.com/amolinae06/ctpv
ctpv,"Image previews for lf file manager",Y,https://github.com/amolinae06/ctpv.git
fastfetch,"Maintained, feature-rich and performance oriented", neofetch-like system information tool",N,
ffmpeg,"Complete and free Internet live audio and video broadcasting solution for Linux/Unix",N,
foot,"Fast, lightweight and minimalistic Wayland terminal emulator",N,
fuzzel,"Application launcher for wlroots-based Wayland compositors",N,
git,"Distributed version control system",N,
gnome-keyring,"GNOME keyring", N,
gnome-keyring,"GNOME keyring",N,
greetd,"Minimal and flexible login manager daemon",N,
greetd-tuigreet,"Graphical console greeter for greetd",N,
grim,"Grabs images from Wayland compositors",N,
@ -18,8 +19,8 @@ kanshi,"Dynamic display configuration for Wayland",N,
lf,"Terminal filemanager written in Go with vim-style keybindings",N,
libnotify,"Desktop notification library",N,
librewolf,"Community-maintained fork of Firefox, focused on privacy, security and freedom.",N,
libinput,"Library for handling input devices", N,
libxkbcommon,"keyboard handling library", N,
libinput,"Library for handling input devices",N,
libxkbcommon,"keyboard handling library",N,
mako,"A lightweight notification daemon for Wayland",N,
mpv,"Video player based on MPlayer/mplayer2",N,
ncpamixer,"ncurses PulseAudio Mixer",N,
@ -32,7 +33,7 @@ pipewire,"Multimedia processing graphs",N,
pipewire-alsa,"ALSA support for pipewire",N,
pipewire-jack,"JACK support for pipewire",N,
pipewire-pulse,"Pulseaudio support for pipewire",N,
pipewire-spa-bluez, "PipeWire BlueZ5 SPA plugin (Bluetooth)", N
pipewire-spa-bluez, "PipeWire BlueZ5 SPA plugin (Bluetooth)",N
ripgrep,"ripgrep combines the usability of The Silver Searcher with the raw speed of grep",N,
sc-im,"ncurses spreadsheet program based on SC",N,
slurp,"Interaction screen selection on Wayland compositors",N,
@ -43,7 +44,7 @@ swaylock-effects,"Screen locker for Wayland with fancy effects",N,
font-inconsolata,"Inconsolata fonts",N,
font-inconsolata-nerd,"Inconsolata Nerd Font",N,
typst,"New markup-based typesetting system that is powerful and easy to learn",N,
wayland,"A computer display server protocol", N,
wayland,"A computer display server protocol",N,
wbg,"Simple wallpaper application for Wayland compositors",N,
wev,"Wayland event viewer",N,
wf-recorder,"Screen recording for wlroots-based compositors",N,
@ -54,7 +55,7 @@ wlroots,"Modular Wayland compositor library",N,
xdg-desktop-portal,"Desktop integration portal",N,
xdg-desktop-portal-wlr,"wlroots implementation of xdg-desktop-portal",N,
xdg-user-dirs,"Manage user directories like ~/Desktop and ~/Music",N,
xdg-utils,"Basic desktop integration functions"",N,
xdg-utils,"Basic desktop integration functions",N,
zathura,"Highly customizable and functional document viewer",N,
zathura-pdf-poppler,"Poppler plugin adds PDF support to zathura",N,
zsh,"Very advanced and programmable command interpreter (shell)",N,

Can't render this file because it contains an unexpected character in line 7 and column 101.