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