From 9485d2b1f8108f70c4f092558ae4b7b34cbcefee Mon Sep 17 00:00:00 2001 From: Ash <44369810+Phate6660@users.noreply.github.com> Date: Fri, 24 Jan 2020 19:57:42 -0500 Subject: [PATCH] Update install.sh --- install.sh | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 2346c0f..8e09b05 100644 --- a/install.sh +++ b/install.sh @@ -1,14 +1,31 @@ #!/bin/bash -# Makes and copies normal and offensive fortunes and their data to /usr/share/fortune -echo "Running STRFile on normal fortunes..." -strfile mythical_linux -echo "Running STRFile on offensive fortunes..." -strfile off/mythical_linux dir="$(whereis fortune | awk -F\ '{ print $3 }')" -echo "Copying normal fortunes to $dir..." -sudo cp mythical_linux{,.dat} "$dir" -echo "Copying offensive fortunes to $dir/off..." -sudo cp off/mythical_linux{,.dat} "$dir/off" -echo "Permission-fixing fortunes at $dir..." -sudo chmod 777 -R "$dir" -echo "Fortunes installed." +non() { + echo "Running STRFile on normal fortunes..." + strfile mythical_linux + echo "Copying normal fortunes to $dir..." + sudo cp mythical_linux{,.dat} "$dir" +} +off() { + echo "Running STRFile on offensive fortunes..." + strfile off/mythical_linux + echo "Copying offensive fortunes to $dir/off..." + sudo cp off/mythical_linux{,.dat} "$dir/off" +} +post() { + echo "Permission-fixing fortunes at $dir..." + sudo chmod 777 -R "$dir" + echo "Fortunes installed." && exit 0 +} +case $1 in + h) echo " +n = install non-offensive +o = install offensive +no arguments = install both +" + ;; + n) non && post;; + o) off && post;; + *) non && off && post;; +esac +exit 1