Browse Source

Initial commit

Dmitry Zakharchenko 6 months ago
  1. 176
  2. 76


@ -0,0 +1,176 @@
# Luke's Auto Rice Boostrapping Script (LARBS)
# by Adrian Claridge <>
# License: GNU GPLv3
while getopts ":a:r:b:p:h" o; do case "${o}" in
h) printf "Optional arguments for custom use:\\n -r: Dotfiles repository (local file or url)\\n -p: Dependencies and programs csv (local file or url)\\n -h: Show this message\\n" && exit ;;
r) dotfilesrepo=${OPTARG} && git ls-remote "$dotfilesrepo" || exit ;;
b) repobranch=${OPTARG} ;;
p) progsfile=${OPTARG} ;;
*) printf "Invalid option: -%s\\n" "$OPTARG" && exit ;;
esac done
[ -z "$dotfilesrepo" ] && dotfilesrepo=""
[ -z "$progsfile" ] && progsfile=""
[ -z "$repobranch" ] && repobranch="master"
installpkg(){ xbps-install -y "$1" >/dev/null 2>&1 ;}
error() { clear; printf "ERROR:\\n%s\\n" "$1"; exit;}
welcomemsg() { \
dialog --title "Welcome!" --msgbox "Welcome to Luke's Auto-Rice Bootstrapping Script!\\n\\nThis script will automatically install a fully-featured Linux desktop, which I use as my main machine.\\n\\n-Adrian" 10 60
getuser() { \
# Prompts user for their username.
name=$(dialog --inputbox "First, please enter the username you created during the Void Linux install process." 10 60 3>&1 1>&2 2>&3 3>&1) || exit
repodir="/home/$name/.local/src"; sudo -u $name mkdir -p "$repodir"
while ! echo "$name" | grep "^[a-z_][a-z0-9_-]*$" >/dev/null 2>&1; do
name=$(dialog --no-cancel --inputbox "Username not valid. Be sure your username contains valid characters: lowercase letters, - or _." 10 60 3>&1 1>&2 2>&3 3>&1)
done ;}
preinstallmsg() { \
dialog --title "Enter The Void..." --yes-label "Let's go!" --no-label "No, nevermind!" --yesno "The rest of the installation will now be totally automated, so you can sit back and relax.\\n\\nIt will take some time, but when done, you can relax even more with your complete system.\\n\\nNow just press <Let's go!> and the system will begin installation!" 13 60 || { clear; exit; }
maininstall() { # Installs all needed programs from main repo.
dialog --title "LARBS Installation" --infobox "Installing \`$1\` ($n of $total). $1 $2" 5 70
installpkg "$1"
gitmakeinstall() {
progname="$(basename "$1")"
dialog --title "LARBS Installation" --infobox "Installing \`$progname\` ($n of $total) via \`git\` and \`make\`. $(basename "$1") $2" 5 70
sudo -u "$name" git clone --depth 1 "$1" "$dir" >/dev/null 2>&1 || { cd "$dir" || return ; sudo -u "$name" git pull --force origin master;}
cd "$dir" || exit
make >/dev/null 2>&1
make install >/dev/null 2>&1
cd /tmp || return ;}
pipinstall() { \
dialog --title "LARBS Installation" --infobox "Installing the Python package \`$1\` ($n of $total). $1 $2" 5 70
command -v pip || installpkg python3-pip >/dev/null 2>&1
yes | pip install "$1"
installationloop() { \
([ -f "$progsfile" ] && cp "$progsfile" /tmp/progs.csv) || curl -Ls "$progsfile" | sed '/^#/d' | eval grep "$grepseq" > /tmp/progs.csv
total=$(wc -l < /tmp/progs.csv)
while IFS=, read -r tag program comment; do
echo "$comment" | grep "^\".*\"$" >/dev/null 2>&1 && comment="$(echo "$comment" | sed "s/\(^\"\|\"$\)//g")"
case "$tag" in
"G") gitmakeinstall "$program" "$comment" ;;
"P") pipinstall "$program" "$comment" ;;
*) maininstall "$program" "$comment" ;;
done < /tmp/progs.csv ;}
# Downloads a gitrepo $1 and places the files in $2 only overwriting conflicts
putgitrepo() {
dialog --infobox "Downloading and installing config files..." 4 60
[ -z "$3" ] && branch="master" || branch="$repobranch"
dir=$(mktemp -d)
[ ! -d "$2" ] && mkdir -p "$2"
chown -R "$name:wheel" "$dir" "$2"
sudo -u "$name" git clone -b "$branch" --depth 1 "$1" "$dir" >/dev/null 2>&1
sudo -u "$name" cp -rfT "$dir" "$2"
systembeepoff() { dialog --infobox "Disabling beep sound and bluetooth..." 10 50
mkdir -p /etc/modprobe.d/
rmmod pcspkr
echo "blacklist pcspkr\nblacklist btusb" > /etc/modprobe.d/blacklist.conf ;}
putplug() { dialog --infobox "Downloading and installing vim-plug..." 4 60
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs >/dev/null 2>&1
sudo -u "$name" nvim +"PlugInstall --sync" +qa >/dev/null 2>&1 ;}
finalize(){ \
dialog --infobox "Preparing welcome message..." 4 50
dialog --title "All done!" --msgbox "Congrats! Provided there were no hidden errors, the script completed successfully and all the programs and configuration files should be in place.\\n\\nTo run the new graphical environment, log out and log back in as your new user, then run the command \"startx\" to start the graphical environment (it will start automatically in tty1).\\n\\n.t Adrian" 12 80
### This is how everything happens in an intuitive format and order.
# Check if user is root on Arch distro. Install dialog.
installpkg dialog || error "Are you sure you're running this as the root user and have an internet connection?"
# Welcome user and pick dotfiles.
welcomemsg || error "User exited."
# Get and verify username and password.
getuser || error "User exited."
# Last chance for user to back out before install.
preinstallmsg || error "User exited."
dialog --title "LARBS Installation" --infobox "Installing \`Void nonfree repo\`, \`basedevel\` and \`git\`. These are required for the installation of other software." 5 70
installpkg void-repo-nonfree
xbps-install -Su >/dev/null
installpkg base-devel
installpkg git
installpkg curl
# The command that does all the installing. Reads the progs.csv file and
# installs each needed program using either xbps or git.
# Install the dotfiles in the user's home directory
putgitrepo "$dotfilesrepo" "/home/$name" "$repobranch"
# Most important command! Get rid of the beep!
# Install vim-plug
# Make zsh the default shell for the user
chsh -s /bin/zsh $name
# Enable services
ln -s /etc/sv/cronie /var/service/
ln -s /etc/sv/connmand /var/service/
ln -s /etc/sv/dbus /var/service/
# Change cursor to Adwaita
mkdir -p /usr/share/icons/default
printf '[Icon Theme]\nInherits=Adwaita' > /usr/share/icons/default/index.theme
# Tap to click
mkdir -p /etc/X11/xorg.conf.d/
printf 'Section "InputClass"
Identifier "libinput touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
# Enable left mouse button by tapping
Option "Tapping" "on"
EndSection' > /etc/X11/xorg.conf.d/40-libinput.conf
# Disable ttys 3-6
rm /var/service/agetty-tty6
touch /etc/sv/agetty-tty6/down
rm /var/service/agetty-tty5
touch /etc/sv/agetty-tty5/down
rm /var/service/agetty-tty4
touch /etc/sv/agetty-tty4/down
rm /var/service/agetty-tty3
touch /etc/sv/agetty-tty3/down
# Create basic home directories
sudo -u $name mkdir /home/$name/documents /home/$name/downloads /home/$name/music
# Last message! Install complete!


@ -0,0 +1,76 @@
#TAG,NAME IN REPO (or git url),PURPOSE (should be a verb phrase to sound right while installing),
,anki,"is a flashcard program that utilizes spaced repetition."
,atool,"manages and gives information about archives."
,bsdtar,"is a BSD utilities using libarchive."
,calcurse,"is a lightweight terminal-based calendar."
,connman,"is an open source connection manager."
,cronie,"contains the standard UNIX daemon crond specified programs at scheduled times."
,dbus,"facilitates inter-process communication."
,dosfstools,"allows your computer to access dos-like filesystems."
,dunst,"is a lightweight notification system."
,elinks,"is full-featured text browser."
,exfat-utils,"allows management of FAT drives."
,ffmpeg,"can record and splice video and audio on the command line."
,font-fira-ttf,"is a Mozilla's new typeface OTF."
,fontconfig-devel,"is required for the compilation of some programs."
,fzf,"is a fuzzy finder tool."
,gcr-devel,"is required for the compilation of some programs."
,gotop,"is a terminal based graphical activity monitor inspired by gtop and vtop."
,highlight,"can highlight code output."
,libX11-devel,"is required for the compilation of some programs."
,libXft-devel,"is required for the compilation of some programs."
,libnotify,"allows desktop notifications."
,maim,"can take quick screenshots at your request."
,man-db,"lets you read man pages of programs."
,mpc,"is a terminal interface for mpd."
,mpd,"is a lightweight music daemon."
,mpv,"is the patrician's choice video player."
,ncmpcpp,"is a ncurses interface for music with multiple formats and a powerful tag editor."
,neovim,"is a tidier vim with some useful features."
,newsboat,"is a terminal RSS client."
,noto-fonts-emoji,"is a emoji font set."
,ntfs-3g,"allows accessing NTFS partitions."
,ntp,"is a time synchronization daemon."
,pamixer,"is a command-line audio interface."
,pass,"safely encrypts passwords."
,pipe-viewer,"is a youtube cli interface."
,pulseaudio,"is the audio system."
,pulsemixer,"is an audio controller."
,qutebrowser,"is a keyboard-focused browser with minimal GUI."
,setxkbmap,"sets keyboard map."
,simple-mtpfs,"enables the mounting of cell phones."
,sxiv,"is a minimalist image viewer."
,translate-shell,"is a command-line interface for Google Translate."
,transmission,"is a free BitTorrent client."
,tremc,"is a curses interface for transmission."
,ts,"queues commands or files for download."
,unclutter-xfixes,"hides an inactive mouse."
,unrar,"extracts rar's."
,unzip,"unzips zips."
,urlscan,"is a terminal url selector."
,vifm,"is a curses based vi[m] like file manager."
,xbacklight,"enables changing screen brightness levels."
,xcape,"gives the special escape/super mappings of LARBS."
,xclip,"allows for copying and pasting from the command line."
,xdg-utils,"assists with various desktop integration tasks."
,xdotool,"provides window action utilities on the command line."
,xdpyinfo,"aids with resolution determination and screen recording."
,xinit,"starts the graphical server."
,xkb-switch,"allows to query and change the XKB layout state."
,xmodmap,"modifies keymaps and pointer button mappings."
,xorg-minimal,"is the graphical server."
,xprop,"is a tool for detecting window properties."
,xsel,"retrieves and sets the X selection."
,xset,"is a X11 user preferences utility."
,xtools,"are opinionated helpers for working with XBPS."
,xwallpaper,"sets the wallpaper."
,xwininfo,"allows querying information about windows."
,yt-dlp,"can download any YouTube video (or playlist or channel) when given the link."
,zathura,"is a pdf viewer with vim-like bindings."
,zathura-pdf-mupdf,"allows mupdf pdf compatibility in zathura."
,zsh-syntax-highlighting,"provides syntax highlighting in the shell."
G,,"runs commands and provides a UI for selection."
G,,"is a window manager."
G,,"serves as the modular status bar."
G,,"is a simple X display locker."
G,,"is a suckless terminal."