JustMotion/install.sh
Zii 525c342c0f v3.3.t3
-moved all service related code to seperate files.
-split the camera service into 2 systemd services.
-the -i, -c and -d options now function differently to support the
 split systemd services.
-internal logging was completely removed. all verbose output will
 instead just go to stderr/stdout. will use journalctl for real
 time logging instead.
-fixed the magick compile/install script so it will actually run
 now.
-fixed a bug in the config file reading functions so it will now
 trim off white spaces and line breaks at the ends. doing this
 now prevents undefined behaviour if any parameter has a line
 break in it.
-service user was added as a config file option. this can be used
 to set user name the installed services will run under. the
 default user is "mow."
-the install.sh script will now add the default mow user to the
 video group making it possible to record footage from webcams
 without permission issues.
2023-10-27 15:43:17 -04:00

51 lines
1.0 KiB
Bash

#!/bin/sh
if [ -f "/opt/mow/uninst" ]; then
mow -u -f
fi
if [ ! -d "/opt/mow" ]; then
mkdir /opt/mow
fi
if [ ! -d "/var/footage" ]; then
mkdir /var/footage
fi
if [ ! -d "/etc/mow" ]; then
mkdir /etc/mow
fi
if [ ! -d "/var/buffer" ]; then
mkdir /var/buffer
fi
cp -v ./.build-mow/mow /opt/mow/bin
echo "writing /opt/mow/run"
printf "#!/bin/sh\n" > /opt/mow/run
printf "/opt/mow/bin \$1 \$2 \$3\n" >> /opt/mow/run
echo "writing /opt/mow/uninst"
printf "#!/bin/sh\n" > /opt/mow/uninst
printf "mow -r\n" >> /opt/mow/uninst
printf "rm -v /opt/mow/bin\n" >> /opt/mow/uninst
printf "rm -v /opt/mow/run\n" >> /opt/mow/uninst
printf "rm -v /opt/mow/uninst\n" >> /opt/mow/uninst
printf "rm -v /usr/bin/mow\n" >> /opt/mow/uninst
printf "rm -rv /opt/mow\n" >> /opt/mow/uninst
printf "deluser mow\n" >> /opt/mow/uninst
useradd -r mow
usermod -aG video mow
chown -R mow:mow /var/footage
chown -R mow:mow /var/buffer
chmod -v +x /opt/mow/run
chmod -v +x /opt/mow/bin
chmod -v +x /opt/mow/uninst
ln -sv /opt/mow/run /usr/bin/mow
sh imgmagick_build.sh