forked from WinEunuuchs2Unix/eyesome
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
174 lines (131 loc) · 4.78 KB
/
Copy pathinstall.sh
File metadata and controls
174 lines (131 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/bash
# NAME: install.sh
# PATH: Current directory where files downloaded from github
# DESC: Copy eyesome scripts / command files to target directories
# DATE: September 21, 2018. Modified: Oct 7, 2018.
# PARM: $1=dev developer mode, publish files
# =rm remove files
# =v verify files (again)
CopyFiles () {
echo
echo Installing eyesome programs...
echo
install -v ./eyesome.sh /usr/local/bin/
install -v ./eyesome-cfg.sh /usr/local/bin/
install -v ./eyesome-src.sh /usr/local/bin/
install -v ./eyesome-sun.sh /usr/local/bin/
install -v ./wake-eyesome.sh /usr/local/bin/
cp -v ./start-eyesome /etc/cron.d/
install -v ./daily-eyesome-sun /etc/cron.daily/
install -v ./systemd-wake-eyesome /lib/systemd/system-sleep/
install -v ./acpi-lid-eyesome.sh /etc/acpi/
cp -v ./acpi-lid-event-eyesome /etc/acpi/events/
install -v ./eyesome-dbus.sh /usr/local/bin/
} # CopyFiles
RemoveFiles () {
echo
echo Removing eyesome programs...
echo
rm -v -f /usr/local/bin/eyesome.sh
rm -v -f /usr/local/bin/eyesome-cfg.sh
rm -v -f /usr/local/bin/eyesome-src.sh
rm -v -f /usr/local/bin/eyesome-sun.sh
rm -v -f /usr/local/bin/wake-eyesome.sh
rm -v -f /etc/cron.d/start-eyesome
rm -v -f /etc/cron.daily/daily-eyesome-sun
rm -v -f /lib/systemd/system-sleep/systemd-wake-eyesome
rm -v -f /etc/acpi/acpi-lid-eyesome.sh
rm -v -f /etc/acpi/events/acpi-lid-event-eyesome
rm -v -f /usr/local/bin/eyesome-dbus.sh
echo
echo All eyesome programs have been removed, except data files:
echo
echo /usr/local/bin/.eyesome-cfg
echo /usr/local/bin/.eyesome-sunrise
echo /usr/local/bin/.eyesome-sunset
echo
echo This script you are running 'install.sh' has not been removed.
exit 0
} # RemoveFiles
VerifyFiles () {
md5sum -c eyesome.md5
exit 0
} # VerifyFiles
PublishFiles () {
mkdir -p ~/eyesome
cd ~/eyesome
cp -v "$0" . # This script install.sh
cp -v /usr/local/bin/eyesome.sh .
cp -v /usr/local/bin/eyesome-cfg.sh .
cp -v /usr/local/bin/eyesome-src.sh .
cp -v /usr/local/bin/eyesome-sun.sh .
cp -v /usr/local/bin/wake-eyesome.sh .
cp -v /etc/cron.d/start-eyesome .
cp -v /etc/cron.daily/daily-eyesome-sun .
cp -v /lib/systemd/system-sleep/systemd-wake-eyesome .
cp -v /etc/acpi/acpi-lid-eyesome.sh .
cp -v /etc/acpi/events/acpi-lid-event-eyesome .
cp -v /usr/local/bin/eyesome-dbus.sh .
md5sum \
install.sh \
eyesome.sh \
eyesome-cfg.sh \
eyesome-src.sh \
eyesome-sun.sh \
wake-eyesome.sh \
start-eyesome \
daily-eyesome-sun \
systemd-wake-eyesome \
acpi-lid-eyesome.sh \
acpi-lid-event-eyesome \
eyesome-dbus.sh \
> eyesome.md5
echo
echo "~/eyesome/eyesome.md5 has been created."
exit 0
} # PublishFiles
Help () {
echo " \
Eyesome will control up to three monitors including hardware laptop display.
Each day sunrise and sunset times are automatically retrievedfor your city.
Configure Daytime and Nighttime brightness and gamma levels for your monitors
Configure the transition duration after sunrise and before sunset to gradually
adjust brightness and gamma levels so changes are not noticable.
This is the main install/removal/verification program. Your options are:
sudo install.sh
sudo install.sh v
sudo install.sh rm
Use the "v" parameter to verify files were downloaded correctly.
Use the "rm" parameter to remove a previous installation. Data files remain.
With the first option of no parameters, eyesome is installed.
After installation configuration eyesome by running 'sudo eyesome-cfg.sh'
"
exit 0
} # Help
Main () {
[[ "$1" == "-h" ]] || [[ "$1" == "--help" ]] && Help # Exits
if [ $(id -u) != 0 ]; then # root powers needed to call this script
echo >&2 $0 must be called with sudo powers
exit 1
fi
[[ "$1" == "dev" ]] && PublishFiles # exits
[[ "$1" == "v" ]] && VerifyFiles # exits
[[ "$1" == "rm" ]] && RemoveFiles # exits
[[ "$1" != "" ]] && Help # exits
if [[ $(command -v yad) == "" ]]; then
echo " \
yad package is required for eyesome but it is not installed.
Do you wish to install it now?
Enter [y/Y], any other key to skip installation: "
read -rsn1 input
echo $input
if [[ $input == y ]] || [[ $input == Y ]] ; then
sudo apt install yad
fi
fi
CopyFiles
echo
echo Eyesome has been installed. Use 'sudo eyesome-cfg.sh' to configure it.
exit 0
} # Main
Main "$@"