11
11
# 09/14/2024
12
12
#
13
13
14
- if [ $EUID -ne 0 ]
15
- then echo " Please run as root"
14
+ if [ $EUID -ne 0 ] ; then
15
+ echo " Please run as root"
16
16
exit 1
17
17
fi
18
18
@@ -23,49 +23,72 @@ if [ "$DESTDIR" == "" ] ; then
23
23
fi
24
24
25
25
# Create /usr/share/smax and its lua/ sub-directory
26
- SMAX=" $( DESTDIR) /share/smax"
26
+ SMAX=" $DESTDIR /share/smax"
27
27
28
28
# Copy LUA script over to /usr/share/smax
29
- mkdir -p $SMAX /lua || exit 1
30
- cp -a lua $SMAX || exit 2
29
+ echo " . Creating $SMAX /lua directory"
30
+ mkdir -p $SMAX /lua || exit 2
31
+
32
+ echo " . Copying LUA scripts to $SMAX /lua"
33
+ cp -a lua $SMAX || exit 3
31
34
32
35
# install script loader and systemd unit file
33
- install -m 755 smax-init.sh /usr/bin/ || ( exho exit 3
34
- install -m 644 smax-scripts.service /etc/systemd/system/ || exit 4
36
+ echo " . Copying script loader to $DESTDIR /bin"
37
+ install -m 755 smax-init.sh $DESTDIR /bin/ || echo exit 4
38
+
39
+ echo " . Copying script loader to /etc/systemd/system"
40
+ install -m 644 smax-scripts.service /etc/systemd/system/ || exit 5
35
41
36
42
# Register smax-scripts with systemd
37
- systemctl daemon-reload || exit 5
43
+ echo " . Reloading systemd daemon"
44
+ systemctl daemon-reload || exit 6
38
45
39
46
# if you call the script with a single argument 'auto', then it will install
40
47
# a default without asking any questions. (Without the option, the installer
41
48
# will ask you to make some choices.)
42
49
if [ " $1 " == " auto" ] ; then
43
- # automatic installation
50
+ # automatic installation
51
+ echo " Automatic installation..."
44
52
45
- sed -i ' /^.*BEGIN SMA.*/,/^.*END SMA.*$/d' * .lua || exit 6
46
- systemctl restart smax-scripts || exit 7
47
- systemctl enable redis || exit 8
48
- systemctl enable smax-scripts || exit 9
53
+ echo " . Removing SMA-specific sections from scripts"
54
+ sed -i ' /^.*BEGIN SMA.*/,/^.*END SMA.*$/d' * .lua || exit 7
55
+
56
+ echo " . Starting smax-scripts service"
57
+ systemctl restart smax-scripts || exit 8
58
+
59
+ echo " . Enabling Redis at boot"
60
+ systemctl enable redis || exit 9
61
+
62
+ echo " . Enabling SMA-X at boot"
63
+ systemctl enable smax-scripts || exit 10
49
64
else
50
65
# prompt for choices
66
+ echo " Manual installation..."
51
67
52
- read -p " Are you going to use SMA-X at the SMA? " -n 1 -r
68
+ read -p " Are you going to use SMA-X outside of the SMA? " -n 1 -r
53
69
echo # (optional) move to a new line
54
70
if [[ $REPLY =~ ^[Yy]$ ]] ; then
55
- sed -i ' /^.*BEGIN SMA.*/,/^.*END SMA.*$/d' * .lua || exit 10
71
+ echo " . Removing SMA-specific sections from scripts"
72
+ sed -i ' /^.*BEGIN SMA.*/,/^.*END SMA.*$/d' * .lua || exit 11
56
73
fi
57
74
58
75
read -p " start redis with SMA-X scripts at this time? " -n 1 -r
59
76
echo # (optional) move to a new line
60
77
if [[ $REPLY =~ ^[Yy]$ ]] ; then
61
- systemctl restart smax-scripts || exit 11
78
+ echo " . Starting smax-scripts service"
79
+ systemctl restart smax-scripts || exit 12
62
80
fi
63
81
64
82
read -p " Enable and start SMA-X at boot time? " -n 1 -r
65
83
echo # (optional) move to a new line
66
84
if [[ $REPLY =~ ^[Yy]$ ]] ; then
67
- systemctl enable redis || exit 12
68
- systemctl enable smax-scripts || exit 13
85
+ echo " . Enabling Redis at boot"
86
+ systemctl enable redis || exit 13
87
+
88
+ echo " . Enabling SMA-X at boot"
89
+ systemctl enable smax-scripts || exit 14
69
90
fi
70
91
fi
71
92
93
+
94
+ echo " Done!"
0 commit comments