add multiple package sources option

This commit is contained in:
Marty Oehme 2019-03-11 10:51:03 +01:00
parent 5b2870b0a9
commit ac3c172a23

View file

@ -5,17 +5,22 @@
### OPTIONS AND VARIABLES ###
while getopts ":a:r:p:h" o; do case "${o}" in
while getopts ":a:r:p:u:U:f:F:hq" 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 -a: AUR helper (must have pacman-like syntax)\\n -h: Show this message\\n" && exit ;;
r) dotfilesrepo=${OPTARG} && git ls-remote "$dotfilesrepo" || exit ;;
p) progsfile=${OPTARG} ;;
a) aurhelper=${OPTARG} ;;
f) progsfile=${OPTARG} ;;
F) progsfile=${OPTARG} && exclusiveprogsfile=true ;;
p) packagegroups=${OPTARG} ;;
u) targetuser=${OPTARG} ;;
U) targetpassword=${OPTARG} ;;
q) quietmode=true;;
*) printf "Invalid option: -%s\\n" "$OPTARG" && exit ;;
esac done
# DEFAULTS:
[ -z "$dotfilesrepo" ] && dotfilesrepo="https://gitlab.com/marty-oehme/dotfiles.git"
[ -z "$progsfile" ] && progsfile="https://gitlab.com/marty-oehme/dotfiles/snippets/1828258/raw"
[ ! "$exclusiveprogsfile" ] && progsfile="$(curl -Ls https://gitlab.com/marty-oehme/dotfiles/snippets/1828258/raw | cat ) $progsfile"
[ -z "$aurhelper" ] && aurhelper="yay"
### FUNCTIONS ###
@ -108,7 +113,6 @@ gatherpackages() {
}
installationloop() { \
([ -f "$progsfile" ] && cp "$progsfile" /tmp/progs.csv) || curl -Ls "$progsfile" | sed '/^#/d' > /tmp/progs.csv
total=$(wc -l < /tmp/progs.csv)
aurinstalled=$(pacman -Qm | awk '{print $1}')
while IFS=, read -r tag program comment; do
@ -213,6 +217,7 @@ manualinstall $aurhelper || error "Failed to install AUR helper."
# 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.
gatherpackages $progsfile
installationloop
# Install the dotfiles in the user's home directory