Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidy up script a bit #12

Merged
merged 1 commit into from
Jan 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 24 additions & 53 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,59 +1,30 @@
#!/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
echo "Copying normal fortunes to /usr/share/fortune..."
sudo cp ./mythical_linux /usr/share/fortune
echo "Copying normal fortune data to /usr/share/fortune..."
sudo cp ./mythical_linux.dat /usr/share/fortune
echo "Copying offensive fortunes to /usr/share/fortune/off..."
sudo cp ./off/mythical_linux /usr/share/fortune/off
echo "Copying offensive fortune data to /usr/share/fortune/off..."
sudo cp ./off/mythical_linux.dat /usr/share/fortune/off


echo "If you got non-existant errors at this point, keep the script running. You might have /usr/share/fortunes instead, this part of the script copies to there."

# Copies normal and offensive fortunes and their data to /usr/share/fortunes

echo "Copying normal fortunes to /usr/share/fortunes..."
sudo cp ./mythical_linux /usr/share/fortunes
echo "Copying normal fortune data to /usr/share/fortunes..."
sudo cp ./mythical_linux.dat /usr/share/fortunes
echo "Copying offensive fortunes to /usr/share/fortunes/off..."
sudo cp ./off/mythical_linux /usr/share/fortunes/off
echo "Copying offensive fortune data to /usr/share/fortunes/off..."
sudo cp ./off/mythical_linux.dat /usr/share/fortunes/off



echo "Allowing Fortune to use the fortunes by changing permissions..."

# Fixes permissions on the fortune files so anybody can use them

echo "Permission-fixing normal fortunes at /usr/share/fortune..."
sudo chmod 777 /usr/share/fortune/mythical_linux
echo "Permission-fixing normal fortune data at /usr/share/fortune..."
sudo chmod 777 /usr/share/fortune/mythical_linux.dat
echo "Permission-fixing offensive fortunes at /usr/share/fortune..."
sudo chmod 777 /usr/share/fortune/off/mythical_linux
echo "Permission-fixing offensive fortune data at /usr/share/fortune..."
sudo chmod 777 /usr/share/fortune/off/mythical_linux.dat

# Same as last but does it to /usr/share/fortunes instead

echo "Permission-fixing normal fortunes at /usr/share/fortunes..."
sudo chmod 777 /usr/share/fortunes/mythical_linux
echo "Permission-fixing normal fortune data at /usr/share/fortunes..."
sudo chmod 777 /usr/share/fortunes/mythical_linux.dat
echo "Permission-fixing offensive fortunes at /usr/share/fortunes..."
sudo chmod 777 /usr/share/fortunes/off/mythical_linux
echo "Permission-fixing offensive fortune data at /usr/share/fortunes..."
sudo chmod 777 /usr/share/fortunes/off/mythical_linux.dat

# We hopefully done

echo "Fortunes (hopefully) installed."
if test -d /usr/share/fortune; then
echo "Copying normal fortunes to /usr/share/fortune..."
sudo cp ./mythical_linux /usr/share/fortune
echo "Copying normal fortune data to /usr/share/fortune..."
sudo cp ./mythical_linux.dat /usr/share/fortune
echo "Copying offensive fortunes to /usr/share/fortune/off..."
sudo cp ./off/mythical_linux /usr/share/fortune/off
echo "Copying offensive fortune data to /usr/share/fortune/off..."
sudo cp ./off/mythical_linux.dat /usr/share/fortune/off
echo "Permission-fixing fortunes at /usr/share/fortune..."
sudo chmod 777 -R /usr/share/fortune
elif test -d /usr/share/fortunes; then
echo "Copying normal fortunes to /usr/share/fortunes..."
sudo cp ./mythical_linux /usr/share/fortunes
echo "Copying normal fortune data to /usr/share/fortunes..."
sudo cp ./mythical_linux.dat /usr/share/fortunes
echo "Copying offensive fortunes to /usr/share/fortunes/off..."
sudo cp ./off/mythical_linux /usr/share/fortunes/off
echo "Copying offensive fortune data to /usr/share/fortunes/off..."
sudo cp ./off/mythical_linux.dat /usr/share/fortunes/off
echo "Permission-fixing fortunes at /usr/share/fortunes..."
sudo chmod 777 -R /usr/share/fortunes
fi
echo "Fortunes installed."