Skip to content

Commit 42cad6b

Browse files
committed
Merge remote-tracking branch 'teored90/master'
2 parents d6f6617 + 2bb247e commit 42cad6b

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

install.sh

+9-13
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ loginhook="nobootsound_loginhook"
1010
logouthook="nobootsound_logouthook"
1111
logoutvolume="nobootsound_logoutvol"
1212

13-
#-- Find 'echo' program in PATH or use Mac Ports default location
14-
ECHO="$( which echo )"
15-
ECHO="${ECHO:-/opt/local/libexec/gnubin/echo}"
16-
1713
#-- Directory containing this installer and the scripts to install.
1814
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1915

2016
if [ "$(id -u)" != "0" ]; then
21-
${ECHO} "You need administrative privileges to install this script.\nPlease run: sudo ./install.sh"
17+
printf "You need administrative privileges to install this script.\nPlease run: sudo ./install.sh\n"
2218
exit 1
2319
fi
2420

@@ -30,43 +26,43 @@ while getopts ":u" opt; do
3026
uninstallmode=true
3127
;;
3228
\?)
33-
${ECHO} "Invalid option: -$OPTARG" >&2
29+
printf "Invalid option: -$OPTARG\n" >&2
3430
;;
3531
esac
3632
done
3733

3834

3935
if [ "$uninstallmode" = true ]; then
40-
${ECHO} "Removing hooks..."
36+
printf "Removing hooks...\n"
4137
defaults delete com.apple.loginwindow LoginHook
4238
defaults delete com.apple.loginwindow LogoutHook
4339

44-
${ECHO} "Removing files..."
40+
printf "Removing files...\n"
4541
rm "$installation_folder$loginhook"
4642
rm "$installation_folder$logouthook"
4743
rm "$installation_folder$logoutvolume"
4844

49-
${ECHO} "Done!"
45+
printf "Done!\n"
5046

5147
else
52-
${ECHO} "Copying files..."
48+
printf "Copying files...\n"
5349

5450
# Create installation folder if it doesn't already exists.
5551
mkdir -p "$installation_folder"
5652

5753
# Create file where the mute state is stored
58-
sudo ${ECHO} "false" > "$installation_folder$logoutvolume"
54+
sudo printf "false" > "$installation_folder$logoutvolume"
5955

6056
# Copy login and logout scripts and make them executable
6157
sudo cp "${DIR}/$loginhook" "$installation_folder"
6258
sudo cp "${DIR}/$logouthook" "$installation_folder"
6359
sudo chmod +x "$installation_folder$loginhook"
6460
sudo chmod +x "$installation_folder$logouthook"
6561

66-
${ECHO} "Registering hooks..."
62+
printf "Registering hooks...\n"
6763
# Register the scripts as login and logout hooks
6864
defaults write com.apple.loginwindow LoginHook "$installation_folder$loginhook"
6965
defaults write com.apple.loginwindow LogoutHook "$installation_folder$logouthook"
7066

71-
${ECHO} "Done!"
67+
printf "Done!\n"
7268
fi

0 commit comments

Comments
 (0)