commit 4cbf4933296f36fd10e894e5c38e3179bd058761
parent e8a30df9e016af00bf4ec3d5ed100189ed7d37ad
Author: Mark Feller <mfeller@recurly.com>
Date: Thu, 19 Dec 2019 16:46:52 -0700
tweak installers
Signed-off-by: Mark Feller <mfeller@recurly.com>
Diffstat:
2 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/pkgs/fedora/install b/pkgs/fedora/install
@@ -1,13 +1,11 @@
#!/bin/sh
-set -e
+#
+# Auto installer for Fedora packages and dot files
dotsrepo=${dotfilesrepo:-"https://gitlab.com/mark.feller/rice.git"}
pkgfile=${pkgfile:-"https://gitlab.com/mark.feller/rice/raw/master/pkgs/fedora/packages"}
-log() {
- printf '\033[1;33m%s \033[m%s\033[m %s\n' \
- "->" "${2:+[1;36m}$1${2:+[m}" "$2"
-}
+log() { printf '\033[1;33m%s \033[m%s\033[m %s\n' "->" "${2:+[1;36m}$1${2:+[m}" "$2" ; }
install_packages() {
# Copy a real file to our temp progsfile or attempt to curl the progsfile
@@ -15,6 +13,7 @@ install_packages() {
packages=$(sed '/^$/d' /tmp/pkgs | sed '/^#/d')
while IFS=' ' read -r program comment; do
+ log "Installing $program..."
dnf install -y $program
done <<EOF
$packages
@@ -22,7 +21,7 @@ EOF
}
install_dots() {
- git clone "$dotsrepo" ~/.config/rice
+ git clone "$dotsrepo" ~/.config/rice || log "Dots have already been cloned"
(cd ~/.config/rice && ./install)
}
diff --git a/pkgs/macos/install b/pkgs/macos/install
@@ -1,9 +1,12 @@
#!/bin/sh
-set -e
+#
+# Auto installer for macOS packages and dot files
dotsrepo=${dotfilesrepo:-"https://gitlab.com/mark.feller/rice.git"}
pkgfile=${pkgfile:-"https://gitlab.com/mark.feller/rice/raw/master/pkgs/macos/packages"}
+log() { printf '\033[1;33m%s \033[m%s\033[m %s\n' "->" "${2:+[1;36m}$1${2:+[m}" "$2" ; }
+
trim_string() {
# Usage: trim_string " example string "
trim=${1#${1%%[![:space:]]*}}
@@ -11,26 +14,21 @@ trim_string() {
printf '%s\n' "$trim"
}
-log() {
- printf '\033[1;33m%s \033[m%s\033[m %s\n' \
- "->" "${2:+[1;36m}$1${2:+[m}" "$2"
-}
-
install_packages() {
# Copy a real file to our temp pkgfile or attempt to curl the pkgfile
- ([ -f "$pkgfile" ] && cp "$pkgfile" /tmp/pkgs) || curl -Ls "$pkgfile" > /tmp/pkgs
+ ([ -f "$pkgfile" ] && cp "$pkgfile" /tmp/pkgs) || (log "Downloading package list..." && curl -Ls "$pkgfile" > /tmp/pkgs)
packages=$(sed '/^$/d' /tmp/pkgs | sed '/^#/d')
while IFS=' ' read -r flag program comment; do
- program=$(trim_string $program)
+ program=$(trim_string "$program")
case $flag in
C)
- log "Installing $program cask"
- brew cask install $program || brew cask upgrade $program
+ log "Installing $program cask..."
+ brew cask install "$program" 2> /dev/null || brew cask upgrade "$program"
;;
*)
- log "Installing $program"
- brew install $program || brew upgrade $program
+ log "Installing $program..."
+ brew install "$program" 2> /dev/null || brew upgrade "$program"
;;
esac
done <<EOF
@@ -39,7 +37,7 @@ EOF
}
install_dots() {
- git clone "$dotsrepo" ~/.config/rice || log "Dots have already been clone"
+ git clone "$dotsrepo" ~/.config/rice || log "Dots have already been cloned"
(cd ~/.config/rice && ./install)
}