@@ -10,15 +10,11 @@ loginhook="nobootsound_loginhook"
10
10
logouthook=" nobootsound_logouthook"
11
11
logoutvolume=" nobootsound_logoutvol"
12
12
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
-
17
13
# -- Directory containing this installer and the scripts to install.
18
14
DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
19
15
20
16
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 "
22
18
exit 1
23
19
fi
24
20
@@ -30,43 +26,43 @@ while getopts ":u" opt; do
30
26
uninstallmode=true
31
27
;;
32
28
\? )
33
- ${ECHO} " Invalid option: -$OPTARG " >&2
29
+ printf " Invalid option: -$OPTARG \n " >&2
34
30
;;
35
31
esac
36
32
done
37
33
38
34
39
35
if [ " $uninstallmode " = true ]; then
40
- ${ECHO} " Removing hooks..."
36
+ printf " Removing hooks...\n "
41
37
defaults delete com.apple.loginwindow LoginHook
42
38
defaults delete com.apple.loginwindow LogoutHook
43
39
44
- ${ECHO} " Removing files..."
40
+ printf " Removing files...\n "
45
41
rm " $installation_folder$loginhook "
46
42
rm " $installation_folder$logouthook "
47
43
rm " $installation_folder$logoutvolume "
48
44
49
- ${ECHO} " Done!"
45
+ printf " Done!\n "
50
46
51
47
else
52
- ${ECHO} " Copying files..."
48
+ printf " Copying files...\n "
53
49
54
50
# Create installation folder if it doesn't already exists.
55
51
mkdir -p " $installation_folder "
56
52
57
53
# Create file where the mute state is stored
58
- sudo ${ECHO} " false" > " $installation_folder$logoutvolume "
54
+ sudo printf " false" > " $installation_folder$logoutvolume "
59
55
60
56
# Copy login and logout scripts and make them executable
61
57
sudo cp " ${DIR} /$loginhook " " $installation_folder "
62
58
sudo cp " ${DIR} /$logouthook " " $installation_folder "
63
59
sudo chmod +x " $installation_folder$loginhook "
64
60
sudo chmod +x " $installation_folder$logouthook "
65
61
66
- ${ECHO} " Registering hooks..."
62
+ printf " Registering hooks...\n "
67
63
# Register the scripts as login and logout hooks
68
64
defaults write com.apple.loginwindow LoginHook " $installation_folder$loginhook "
69
65
defaults write com.apple.loginwindow LogoutHook " $installation_folder$logouthook "
70
66
71
- ${ECHO} " Done!"
67
+ printf " Done!\n "
72
68
fi
0 commit comments