-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpiradio.preinst
33 lines (28 loc) · 878 Bytes
/
piradio.preinst
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
#!/bin/bash
set -e
# Radio daemon pre-install script
# $Id: piradio.preinst,v 1.3 2023/11/12 07:22:47 bob Exp $
RADIOLIB=/var/lib/radiod
MPDCONF=/etc/mpd.conf
BOOTCMD=/boot/cmdline.txt
MODULES=/etc/modules
# Check if the script is being run as root
if [[ $EUID -ne 0 ]]
then
printf 'This script must be run using sudo.\nExiting..\n'
exit 1
fi
echo "Raspberry PI internet radio installation"
if [[ -d ${RADIOLIB} ]]; then
echo "The radio software appears to be already installed"
echo "Saving current configuration"
echo "Copying ${MPDCONF} to ${MPDCONF}.save"
sudo cp -fp ${MPDCONF} ${MPDCONF}.save
echo "Software only will be upgraded"
echo "Your existing configuration will not be changed unless you choose otherwise"
echo "Stopping radiod service"
sudo systemctl stop radiod
fi
exit 0
# End of preinst script
# End of pre-install script