Remove hard-coded temporary file from functions

This commit is contained in:
Marty Oehme 2019-03-11 19:43:24 +01:00
parent da527a2534
commit 36292574c3

View file

@ -119,7 +119,8 @@ getpackagegrouplink() {
# can be called with as many csv files filled with packages as necessary
# appends them all to one temporary file for the installation
gatherpackages() {
concfile=/tmp/progs.csv
concfile=$1
shift
touch $concfile
for progs in "$@"; do
([ -f "$progs" ] && cat "$progs" >> $concfile) || curl -Ls "$progs" | sed '/^#/d' >> $concfile
@ -127,7 +128,7 @@ gatherpackages() {
}
installationloop() { \
total=$(wc -l < /tmp/progs.csv)
total=$(wc -l < $1)
aurinstalled=$(pacman -Qm | awk '{print $1}')
while IFS=, read -r tag program comment; do
n=$((n+1))
@ -137,7 +138,7 @@ installationloop() { \
"A") aurinstall "$program" "$comment" ;;
"G") gitmakeinstall "$program" "$comment" ;;
esac
done < /tmp/progs.csv ;}
done < $1 ;}
dotfiles() { \
gpath=$1
@ -237,14 +238,15 @@ getpackagegrouplink $targetdeployment
# only use the custom packages if forced with -F
[ ! "$exclusivepkgfiles" ] && pkgfiles="$(curl -Ls $pkggroup | cat ) $pkgfiles"
tmpfile=/tmp/pkgs.csv
# actually gather the individual package installation lines from the various links and files
gatherpackages $pkgfiles
gatherpackages $tmpfile $pkgfiles
# 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 privileges to run sudo without a password
# and all build dependencies are installed.
installationloop
installationloop $tmpfile
# Install the dotfiles in the user's home directory
putgitrepo "$dotfilesrepo" "/home/$name"