local repo died lol

This commit is contained in:
Luke Smith 2018-08-03 00:21:28 -04:00
parent b2dd71b0c0
commit 74322da323
2 changed files with 110 additions and 146 deletions

123
larbs.sh
View File

@ -3,29 +3,21 @@
# You can provide a custom repository with -r or a custom programs csv with -p. # You can provide a custom repository with -r or a custom programs csv with -p.
# Otherwise, the script will use my defaults. # Otherwise, the script will use my defaults.
### DEPENDENCIES: git, make and rsync. Make sure these are either in the progs.csv file or installed beforehand. ### DEPENDENCIES: git and make . Make sure these are either in the progs.csv file or installed beforehand.
### ###
### OPTIONS AND VARIABLES ### ### OPTIONS AND VARIABLES ###
### ###
while getopts ":a:r:p:h" o; do while getopts ":a:r:p:h" o; do case "${o}" in
case "${o}" in h) echo -e "Optional arguments for custom use:\n-r: Dotfiles repository\n-p: Dependencies and programs csv (url)\n-a: AUR helper (must have pacman-like syntax, specifically, \`-S\` to install)\n-h: Show this message" && exit ;;
h) r) dotfilesrepo=${OPTARG} ;;
echo -e "Optional arguments for custom use:\n-r: Dotfiles repository\n-p: Dependencies and programs csv (url)\n-a: AUR helper (must have pacman-like syntax)\n-h show this message" && exit ;; p) progsfile=${OPTARG} ;;
r) a) aurhelper=${OPTARG} ;;
dotfilesrepo=${OPTARG} ;; *) echo "-$OPTARG is not a valid option." && exit ;;
p) esac done
progsfile=${OPTARG} ;;
a)
aurhelper=${OPTARG} ;;
*)
echo "-$OPTARG is not a valid option." && exit ;;
esac
done
# DEFAULTS: # DEFAULTS:
[ -z ${dotfilesrepo+x} ] && dotfilesrepo="https://github.com/lukesmithxyz/voidrice.git" [ -z ${dotfilesrepo+x} ] && dotfilesrepo="https://github.com/lukesmithxyz/voidrice.git"
[ -z ${progsfile+x} ] && progsfile="https://raw.githubusercontent.com/LukeSmithxyz/LARBS/master/progs.csv" [ -z ${progsfile+x} ] && progsfile="https://raw.githubusercontent.com/LukeSmithxyz/LARBS/master/progs.csv"
[ -z ${aurhelper+x} ] && aurhelper="packer" [ -z ${aurhelper+x} ] && aurhelper="packer"
@ -78,31 +70,38 @@ adduserandpass() { \
echo "$name:$pass1" | chpasswd echo "$name:$pass1" | chpasswd
unset pass1 pass2 ;} unset pass1 pass2 ;}
packerwrapper() { \ gitmakeinstall() {
# INPUT: a list of programs
# OUTPUT: put uninstalled progs in $mainqueue or $aurqueue depending on
# if they're in the main repos or the AUR.
posprogs=$(pacman -Sl | awk '{print $2}')
for arg in "$@"; do
pacman -Q "$arg" &>/dev/null && continue
pacman -Qg "$arg" &>/dev/null && continue
grep "^$arg$" <<< $posprogs &>/dev/null && mainqueue="$mainqueue $arg" && continue
aurqueue="$aurqueue $arg"
done ;}
programinventory() { \
dialog --infobox "Getting program list..." 4 40
packerwrapper $(curl -sL $progsfile | grep ^, | cut -d ',' -f2)
}
gitinstall() { for gitrepo in $@; do
dir=$(mktemp -d) dir=$(mktemp -d)
dialog --infobox "Installing \"$(basename $gitrepo)\" from source..." 4 40 dialog --title "LARBS Installation" --infobox "Installing \`$(basename $1)\` via \`git\` and \`make\`. $1 ${@:2}." 4 40
git clone --depth 1 "$gitrepo" $dir git clone --depth 1 "$1" $dir &>/dev/null
cd $dir cd $dir
make &>/dev/null make &>/dev/null
make install &>/dev/null make install &>/dev/null
done ;} cd /tmp ;}
maininstall() { # Installs all needed programs from main repo.
dialog --title "LARBS Installation" --infobox "Installing \`$1\` ($n of $total). $1 ${@:2}." 5 70
pacman --noconfirm --needed -S "$1" &>/dev/null
}
aurinstall() { \
dialog --title "LARBS Installation" --infobox "Installing \`$1\` ($n of $total) from the AUR. $1 ${@:2}." 5 70
grep "^$1$" <<< "$aurinstalled" && return
sudo -u $name $aurhelper -S --noconfirm "$1" &>/dev/null
}
installationloop() { \
curl -Ls "$progsfile" > /tmp/progs.csv
total=$(wc -l < /tmp/progs.csv)
aurinstalled=$(pacman -Qm | awk '{print $1}')
while IFS=, read -r tag program comment; do
n=$((n+1))
case "$tag" in
"") maininstall "$program" "$comment" ;;
"A") aurinstall "$program" "$comment" ;;
"G") gitmakeinstall "$program" "$comment" ;;
esac
done <<< $(cat /tmp/progs.csv) ;}
serviceinit() { for service in $@; do serviceinit() { for service in $@; do
dialog --infobox "Enabling \"$service\"..." 4 40 dialog --infobox "Enabling \"$service\"..." 4 40
@ -111,7 +110,7 @@ serviceinit() { for service in $@; do
done ;} done ;}
newperms() { # Set special sudoers settings for install (or after). newperms() { # Set special sudoers settings for install (or after).
sed -e "/#LARBS/d" /etc/sudoers sed -i "/#LARBS/d" /etc/sudoers
echo "$@ #LARBS" >> /etc/sudoers ;} echo "$@ #LARBS" >> /etc/sudoers ;}
systembeepoff() { dialog --infobox "Getting rid of that retarded error beep sound..." 10 50 systembeepoff() { dialog --infobox "Getting rid of that retarded error beep sound..." 10 50
@ -123,7 +122,7 @@ installdotfiles() { # Download $dotfilesrepo and install them in user's home.
dialog --infobox "Downloading and installing config files..." 4 60 dialog --infobox "Downloading and installing config files..." 4 60
rm -rf /tmp/dotfiles/ rm -rf /tmp/dotfiles/
sudo -u $name git clone --depth 1 $dotfilesrepo /tmp/dotfiles &>/dev/null && sudo -u $name git clone --depth 1 $dotfilesrepo /tmp/dotfiles &>/dev/null &&
sudo -u $name rsync -rl /tmp/dotfiles/ /home/$name sudo -u $name cp -rT /tmp/dotfiles/ /home/$name
} }
resetpulse() { dialog --infobox "Reseting Pulseaudio..." 4 50 resetpulse() { dialog --infobox "Reseting Pulseaudio..." 4 50
@ -139,25 +138,7 @@ manualinstall() { # Installs $1 manually if not installed. Used only for AUR hel
sudo -u $name tar -xvf $1.tar.gz &>/dev/null && sudo -u $name tar -xvf $1.tar.gz &>/dev/null &&
cd $1 && cd $1 &&
sudo -u $name makepkg --noconfirm -si &>/dev/null sudo -u $name makepkg --noconfirm -si &>/dev/null
cd /tmp) cd /tmp) ;}
}
installmainprograms() { # Installs all needed programs from main repo.
count=$(echo "$mainqueue" | wc -w)
for x in $mainqueue; do
n=$((n+1))
dialog --title "LARBS Installation" --infobox "Downloading and installing program $n out of $count: $x...\n\nThe first programs will take more time due to dependencies." 7 70
pacman --noconfirm --needed -S "$x" &>/dev/null
done ;}
installaurprograms() { \
count=$(echo "$aurqueue" | wc -w)
n=0
for prog in $aurqueue; do
n=$((n+1))
dialog --infobox "Downloading and installing AUR program $n out of $count: $prog..." 6 70
sudo -u $name $aurhelper -S --noconfirm "$prog" &>/dev/null
done ;}
finalize(){ \ finalize(){ \
dialog --infobox "Preparing welcome message..." 4 50 dialog --infobox "Preparing welcome message..." 4 50
@ -171,10 +152,6 @@ finalize(){ \
### This is how everything happens in an intuitive format and order. ### This is how everything happens in an intuitive format and order.
### ###
# NOTE: If you're deploying a system that doesn't require AUR packages, you
# don't need to include `installaurprograms` `manualinstall $aurhelper`
# (obviously), but also `getpermissions`.
# Check if user is root on Arch distro. Install dialog. # Check if user is root on Arch distro. Install dialog.
initialcheck initialcheck
@ -197,45 +174,33 @@ adduserandpass
# Refresh Arch keyrings. # Refresh Arch keyrings.
refreshkeys refreshkeys
# Checks progs and current programs to see what's needed.
programinventory
# Must be run sometime after `programinventory`.
# This will usually be the longest command by a large margin.
installmainprograms
# Allow user to run sudo without password. Since AUR programs must be installed # Allow user to run sudo without password. Since AUR programs must be installed
# in a fakeroot environment, this is required for all builds with AUR. # in a fakeroot environment, this is required for all builds with AUR.
newperms "%wheel ALL=(ALL) NOPASSWD: ALL" newperms "%wheel ALL=(ALL) NOPASSWD: ALL"
# Install AUR helper. Needs sudo w/o passwd.
manualinstall $aurhelper manualinstall $aurhelper
# $aurhelper must be installed to run this. Needs sudo w/o passwd. # The command that does all the installing. Reads the progs.csv file and
installaurprograms # installs each needed program the way required. Be sure to run this only after
# the user has been created and has priviledges to run sudo without a password
# and all build dependencies are installed.
installationloop
installdotfiles installdotfiles
# Pulseaudio, if/when initially installed, often needs a restart to work immediately. # Pulseaudio, if/when initially installed, often needs a restart to work immediately.
[[ -f /usr/bin/pulseaudio ]] && resetpulse [[ -f /usr/bin/pulseaudio ]] && resetpulse
# Must be run sometime after `userandpassword`.
# git and rsync must be installed.
gitinstall https://github.com/lukesmithxyz/st.git https://github.com/lukesmithxyz/dmenu.git
# Enable services here. # Enable services here.
serviceinit NetworkManager cronie serviceinit NetworkManager cronie
# Most important command! Get rid of the beep! # Most important command! Get rid of the beep!
systembeepoff systembeepoff
# Should only be run after `installaurprograms`. Not strictly necessary if you
# want the more permissive sudo settings set above.
# This line, overwriting the `newperms` command above will allow the user to run # This line, overwriting the `newperms` command above will allow the user to run
# serveral important commands, `shutdown`, `reboot`, updating, etc. without a password. # serveral important commands, `shutdown`, `reboot`, updating, etc. without a password.
newperms "%wheel ALL=(ALL) NOPASSWD: /usr/bin/shutdown,/usr/bin/reboot,/usr/bin/wifi-menu,/usr/bin/mount,/usr/bin/umount,/usr/bin/pacman -Syu,/usr/bin/pacman -Syyu,/usr/bin/packer -Syu,/usr/bin/packer -Syyu,/usr/bin/systemctl restart NetworkManager,/usr/bin/rc-service NetworkManager restart, /usr/bin/pacman -Syyu --noconfirm" newperms "%wheel ALL=(ALL) NOPASSWD: /usr/bin/shutdown,/usr/bin/reboot,/usr/bin/wifi-menu,/usr/bin/mount,/usr/bin/umount,/usr/bin/pacman -Syu,/usr/bin/pacman -Syyu,/usr/bin/packer -Syu,/usr/bin/packer -Syyu,/usr/bin/systemctl restart NetworkManager,/usr/bin/rc-service NetworkManager restart, /usr/bin/pacman -Syyu --noconfirm"
# Last message! Install complete! # Last message! Install complete!
finalize finalize
clear clear

133
progs.csv
View File

@ -1,67 +1,66 @@
~,NAME,PURPOSE TAG,NAME,PURPOSE
,arandr,gui adjustment of screen ,base-devel,is a group package with sudo and compilation software
,base-devel,sudo and compilation software ,git,is a version control system
,calcurse,calendar ,i3-gaps,is the main graphical user interface and window manager
,compton,transparency and removing tearing A,packer,can install packages from the AUR
,cronie,cron manager ,xorg-server,is the graphical server
,dmenu,command runner ,xorg-xdpyinfo,retrieves screen information for some scripts
,dosfstools,file system compatibility ,xorg-xinit,starts the graphical server
,dunst,notification system G,https://github.com/lukesmithxyz/st.git,is my custom build of suckless's terminal emulator
,exfat-utils,file system compatibility G,https://github.com/lukesmithxyz/dmenu.git,runs commands and provides a UI for selection
,feh,image viewer ,ranger,the file manager
,ffmpeg,audio/video recording and splicing ,arandr,is a UI for screen adjustment
,firefox,default browser ,calcurse,is a lightweight terminal-based calendar
,git,dling config repos ,compton,for transparency and removing screen-tearing
,gnome-keyring,system keyring ,cronie,manages scheduled tasks
,gnome-themes-extra,for dark GTK theme ,dosfstools,allows your computer to access dos-like filesystems
,gvim,text editor ,dunst,is a suckless notification system
,i3-gaps,window manager ,exfat-utils,allows management of FAT drives
,i3blocks,status bar ,feh,is a minimal image viewer
,i3lock,screen lock ,ffmpeg,can record and splice video and audio on the command line
,mpc,music daemon control ,firefox,is the only program on LARBS your girlfriend has ever heard of
,mpd,music daemon ,gnome-keyring,serves as the system keyring
,mpv,video/gif player ,gnome-themes-extra,gives the dark GTK theme used in LARBS
,ncmpcpp,music player ,gvim,provides a build of vim with the ability to copy and paste between other programs
,networkmanager,network manager ,i3blocks,is the status bar
,network-manager-applet,status bar internet applet ,i3lock,is the screen lock
,newsboat,RSS reader ,mpd,is a lightweight music daemon
,ttf-emojione,emoji fonts ,mpc,is a terminal interface for mpd
,ntfs-3g,file system compatibility ,mpv,is the patrician's choice video/gif player
,packer,AUR manager ,ncmpcpp,a ncurses interface for music, with extensive views, tag editing and more
,pamixer,audio system control ,networkmanager,does exactly what it sounds like
,pulseaudio,audio system ,network-manager-applet,appears in the top right corner and manages the wi-fi connection
,pulseaudio-alsa,audio system ,newsboat,is a terminal RSS client
,pulsemixer,audio system manager A,ttf-emojione,is a package that gives the system unicode symbols and emojis used in the status bar and elsewhere.
,python-pywal,colorscheme generator ,ntfs-3g,allows accessing NTFS partitions
,rsync, ,pulseaudio,is the audio system (>inb4 bloat)
,sc-im,spreadsheet manager ,pulseaudio-alsa,is an audio interface with ALSA
,screenkey,screencasting keyboard view ,pamixer,is a terminal audio control interface
,scrot,screenshoter ,pulsemixer,is an intuitive ncurses audio controller
,speedometer,internet traffic view ,python-pywal,generates color schemes based on your wallpaper
,tmux,multiplexer and dropdown A,sc-im,is an Excel-like terminal spreadsheet manager
,ttf-inconsolata,mono font A,htop-vim-git,provides system usage information and displays processes
,ttf-linux-libertine,non-mono fonts ,scrot,can take quick screenshots at your request
,unclutter-xfixes-git,hides mouse if idle ,tmux,is a terminal multiplexer and the dropdown window in LARBS
,unrar,extraction ,ttf-inconsolata,is the monospace font of LARBS
,unzip,extraction ,ttf-linux-libertine,provides the sans and serif fonts for LARBS
,urlview,url parser for terminal apps A,unclutter-xfixes-git,hides an inactive mouse
,vim-pathogen,vim package manager ,unrar,extracts rar's
,w3m, ,unzip,unzips zips
,wget, A,urlview,parses URLs in the terminal allowing keyboard-based selection
,xcape,for double mapping of escape A,vim-pathogen,manages vim plugins
,xdotool,moving windows on command ,w3m,is a terminal browser which can also view images
,xorg-server,graphical environment ,wget,downloads sites and files on the command line
,xorg-xdpyinfo,screencasting ,xcape,gives the special escape/super mappings of LARBS
,xorg-xinit,graphical environment ,xdotool,provides window action utilities on the command line.
,xssstate,screen idle detection ,xssstate,times out the screen if locked
,youtube-dl,downloads youtube videos ,youtube-dl,can download any YouTube video, playlist or channel when given the link
,youtube-viewer,watch YT videos without browser ,youtube-viewer,is a terminal interface for watching YouTube videos without a browser
,zathura,pdf reader ,zathura,is a pdf viewer with vim-like bindings
,zathura-djvu,djvu reader ,zathura-djvu,gives zathura the ability to read .djvu files
,zathura-pdf-mupdf,pdf compatibility ,zathura-pdf-mupdf,allows mupdf pdf compatibility in zathura
,poppler,ranger pdf previews ,poppler,manipulates .pdfs and gives .pdf previews in ranger
,ranger,file manager ,mediainfo,shows audio and video information and is used by ranger as well
,mediainfo,ranger audio/video info preview ,atool,manages and gives information about archives
,atool,ranger archive previews ,fzf,is a fuzzy finder tool
,fzf,ranger fuzzy finder ,highlight,can highlight code output
,highlight,ranger previews highlighted

Can't render this file because it has a wrong number of fields in line 30.