From 36292574c343264e619aa3ea78fa7c38e0cd54f1 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 11 Mar 2019 19:43:24 +0100 Subject: [PATCH] Remove hard-coded temporary file from functions --- .config/bootstrap/install.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.config/bootstrap/install.sh b/.config/bootstrap/install.sh index 7b9087c..1a2305b 100644 --- a/.config/bootstrap/install.sh +++ b/.config/bootstrap/install.sh @@ -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"