rice

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 7fa5c1b5a1713200592a20730350936b962e74b4
parent 92589c8f89f277f7cb8a99d5cc98eb2dc69b0ba9
Author: Mark Feller <mfeller@recurly.com>
Date:   Wed, 15 Jan 2020 13:27:07 -0700

cleanup installer

Signed-off-by: Mark Feller <mfeller@recurly.com>

Diffstat:
Minstall | 28+++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/install b/install @@ -1,16 +1,13 @@ #!/bin/sh # -# Auto installer for macOS packages and dot files +# Auto installer for Fedora packages and dot files dotrepo=${dotrepo:-"https://gitlab.com/mark.feller/rice.git"} pkgfile=${pkgfile:-"https://gitlab.com/mark.feller/rice/raw/master/pkgs/fedora/packages"} logfile=${logfile:-"/var/log/rice.log"} -log() { - printf '\033[1;33m%s \033[m%s\033[m %s\n' "->" "${2:+}$1${2:+}" "$2" \ - | tee "$logfile" -} - -die() { log "$2" && exit 1 ; } +log() { printf '\033[1;33m%s \033[m%s\033[m %s\n' "->" "${2:+}$1${2:+}" "$2" | tee "$logfile"; } +die() { log "$2"; exit 1; } +try() { "$@" || die "Cannot $*"; } trim_string() { # Usage: trim_string " example string " @@ -23,16 +20,16 @@ pre_install() { # Run any preinstall setup necessary log "Enabling RPM Fustion" - dnf install -y \ + try dnf install -y \ https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-"$(rpm -E %fedora)".noarch.rpm \ https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-"$(rpm -E %fedora)".noarch.rpm \ - > "$logfile" + >> "$logfile" log "Enabled i3-gaps community repo" - dnf copr enable gregw/i3desktop > "$logfile" + dnf copr enable gregw/i3desktop >> "$logfile" log "Enabled alacritty community repo" - dnf copr enable pschyska/alacritty > "$logfile" + dnf copr enable pschyska/alacritty >> "$logfile" } install_package() { @@ -41,11 +38,11 @@ install_package() { case $2 in G) log "Installing go package $1" - go get -u "$1" > "$logfile" + try go get -u "$1" >> "$logfile" ;; *) log "Installing $1..." - dnf install -y "$1" > "$logfile" + try dnf install -y "$1" >> "$logfile" ;; esac } @@ -59,7 +56,7 @@ install_packages() { packages=$(sed '/^$/d' /tmp/pkgs | sed '/^#/d') while IFS=' ' read -r flag program comment; do program=$(trim_string "$program") - install_package "$program" "$flag" + install_package $program $flag done <<EOF $packages EOF @@ -69,10 +66,11 @@ install_dots() { # Clone and install dot files log "Fetching dot files" - git clone "$dotrepo" ~/.config/rice > "$logfile" || log "Dots have already been cloned" + git clone "$dotrepo" ~/.config/rice >> "$logfile" || log "Dots have already been cloned" (cd ~/.config/rice && stow --target="$HOME" --ignore='gitignore' dots) } + log "Running installer for Fedora" pre_install install_packages