Skip to content

Instantly share code, notes, and snippets.

@mateoppalacios
Last active August 31, 2021 05:05
Show Gist options
  • Save mateoppalacios/1073de304172108f696b44e1b0ebc619 to your computer and use it in GitHub Desktop.
Save mateoppalacios/1073de304172108f696b44e1b0ebc619 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Might change this later.
((EUID == 0)) && printf "Can't run as root, quitting.\n" && exit 1
shopt -s expand_aliases
alias dots="/usr/bin/git --git-dir=$HOME/.dots/ --work-tree=$HOME"
alias sxi="sudo xbps-install -y"
audio_setup=false
# A prompt to continue code execution.
function prompt
{
IFS=;
echo -n "${1} [Y/n] "
read yn
if [[ $yn =~ ^[Yy](es)* ]] || [[ $yn == "" ]]; then
ans=0
elif [[ $yn =~ ^[Nn](o)* ]]; then
ans=1
fi
return $ans
}
[[ $(pwd) != "$HOME" ]] && cd
echo "Running a quick update..."
sudo xbps-install -Suy
echo -e "\nCreating some directories..."
mkdir -p documents pictures/screenshots workspace .local/share/themes/ \
.local/share/icons/
# Install media packages.
read -p "$(echo -ne "Choose a graphic drivers option:\n[0] Intel [1] AMD ")" \
graphics
sxi xorg mesa-dri vulkan-loader
case $graphics in
0)
sxi linux-firmware-intel linux-lts mesa-vulkan-intel \
intel-video-accel intel-media-driver
;;
1)
sxi linux-firmware-amd mesa-vulkan-radeon xf86-video-amdgpu \
mesa-vaapi mesa-vdpau
;;
esac
echo
if prompt "Install audio setup?"; then
audio_setup=true
sxi alsa-utils apulse alsa-plugins-pulseaudio alsa-firmware sof-firmware \
alsa-ucm-conf
fi
# Some packages for fully-functioning fonts and setting the wallpaper.
echo -e "\nInstalling fonts and wallpaper setup..."
sxi noto-fonts-cjk noto-fonts-emoji noto-fonts-ttf noto-fonts-ttf-extra \
nerd-fonts font-cozette nitrogen curl
sudo ln -s /usr/share/fontconfig/conf.avail/70-no-bitmaps.conf \
/etc/fonts/conf.d/
sudo xbps-reconfigure -f fontconfig
# Software from local repos.
echo -e "\nInstalling packages from source..."
sxi git
git clone --depth=1 https://github.com/void-linux/void-packages $HOME/documents
cd $HOME/documents/void-packages
./xbps-src binary-bootstrap
echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
sxi xtools
./xbps-src pkg discord
cd masterdir
xi discord -y
cd
./xbps-src pkg spotify
sxi --repository=hostdir/binpkgs/nonfree spotify
# Remove some files to prevent conflicts with git.
echo -e "\nCleaning up before checking out configuration files..."
rm -rf $HOME/.bashrc $HOME/.config/qtile/config.py
# Source the remote dotfiles and create some required directories.
echo -e "\nChecking out configuration files..."
git clone --bare https://github.com/mateoppalacios/dots.git $HOME/.dots
dots checkout
# Pretty self explanatory.
echo -e "\nInstalling personal-use software..."
sxi vim dunst redshift zathura zathura-djvu zathura-pdf-poppler firefox \
curl gotop xclip jq youtube-dl fzf ueberzug mpv gcc make go maim sxiv \
libXinerama-devel patch nautilus python3-pip pandoc texlive dragon \
xdotool pkg-config libXrandr-devel ncurses ncurses-base ncurses-devel \
rust cargo gcr-devel picom
# A plugin manager for Vim.
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# A script to use YouTube in the terminal.
curl -sL "https://raw.githubusercontent.com/pystardust/ytfzf/master/ytfzf" | \
sudo tee /usr/bin/ytfzf >/dev/null && sudo chmod 755 /usr/bin/ytfzf
# Install the window manager.
sudo make -C $HOME/.config/dwm clean install
# Install the menu.
sudo make -C $HOME/.config/dmenu clean install
# Installl the terminal.
sudo make -C $HOME/.config/st clean install
# Install scrolling support for the terminal.
sudo make -C $HOME/.config/scroll clean install
# Install a "window-swallower".
git clone https://github.com/salman-abedin/devour.git
cd devour && sudo make install && cd && rm -rf devour
# Install the screen locker.
sudo make -C $HOME/.config/slock clean install
# Install a program to support tabs.
sudo make -C $HOME/.config/tabbed clean install
# Install a music player.
cargo install ncspot
# Final touches...
echo -e "\nSetting up media services..."
[ $audio_setup == true ] && {
sudo ln -s /etc/sv/alsa/ /var/service/
sudo ln -s /etc/sv/pulseaudio/ /var/service/
}
sudo ln -s /etc/sv/dbus/ /var/service/
echo
if prompt "Set up git?"; then
read -p "Email: " email
git config --global user.email "$email"
read -p "Name: " name
git config --global user.name "$name"
fi
echo
if prompt "Done! Reboot?"; then sudo reboot; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment