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.
# 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 ###
###
while getopts ":a:r:p:h" o; do
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)\n-h show this message" && exit ;;
r)
dotfilesrepo=${OPTARG} ;;
p)
progsfile=${OPTARG} ;;
a)
aurhelper=${OPTARG} ;;
*)
echo "-$OPTARG is not a valid option." && exit ;;
esac
done
while getopts ":a:r:p:h" o; do 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 ;;
r) dotfilesrepo=${OPTARG} ;;
p) progsfile=${OPTARG} ;;
a) aurhelper=${OPTARG} ;;
*) echo "-$OPTARG is not a valid option." && exit ;;
esac done
# DEFAULTS:
[ -z ${dotfilesrepo+x} ] && dotfilesrepo="https://github.com/lukesmithxyz/voidrice.git"
[ -z ${progsfile+x} ] && progsfile="https://raw.githubusercontent.com/LukeSmithxyz/LARBS/master/progs.csv"
[ -z ${aurhelper+x} ] && aurhelper="packer"
@ -78,31 +70,38 @@ adduserandpass() { \
echo "$name:$pass1" | chpasswd
unset pass1 pass2 ;}
packerwrapper() { \
# 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
gitmakeinstall() {
dir=$(mktemp -d)
dialog --infobox "Installing \"$(basename $gitrepo)\" from source..." 4 40
git clone --depth 1 "$gitrepo" $dir
dialog --title "LARBS Installation" --infobox "Installing \`$(basename $1)\` via \`git\` and \`make\`. $1 ${@:2}." 4 40
git clone --depth 1 "$1" $dir &>/dev/null
cd $dir
make &>/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
dialog --infobox "Enabling \"$service\"..." 4 40
@ -111,7 +110,7 @@ serviceinit() { for service in $@; do
done ;}
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 ;}
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
rm -rf /tmp/dotfiles/
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
@ -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 &&
cd $1 &&
sudo -u $name makepkg --noconfirm -si &>/dev/null
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 ;}
cd /tmp) ;}
finalize(){ \
dialog --infobox "Preparing welcome message..." 4 50
@ -171,10 +152,6 @@ finalize(){ \
### 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.
initialcheck
@ -197,45 +174,33 @@ adduserandpass
# Refresh Arch keyrings.
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
# in a fakeroot environment, this is required for all builds with AUR.
newperms "%wheel ALL=(ALL) NOPASSWD: ALL"
# Install AUR helper. Needs sudo w/o passwd.
manualinstall $aurhelper
# $aurhelper must be installed to run this. Needs sudo w/o passwd.
installaurprograms
# The command that does all the installing. Reads the progs.csv file and
# 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
# Pulseaudio, if/when initially installed, often needs a restart to work immediately.
[[ -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.
serviceinit NetworkManager cronie
# Most important command! Get rid of the beep!
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
# 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"
# Last message! Install complete!
finalize
clear

133
progs.csv
View file

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

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