sintonia/dev_tools/toggle-pypo-debug.sh

38 lines
919 B
Bash
Raw Normal View History

2021-08-16 14:21:46 +02:00
#!/usr/bin/env bash
if [[ $EUID -ne 0 ]]; then
2021-08-16 13:45:32 +02:00
echo "This script must be run as root." 1>&2
exit 1
fi
2021-08-16 13:45:32 +02:00
usage() {
echo "Use --enable <user> or --disable flag. Enable is to set up environment"
echo "for specified user. --disable is to reset it back to pypo user"
}
if [ "$1" = "--enable" ]; then
2021-08-16 13:45:32 +02:00
/etc/init.d/airtime-playout stop
/etc/init.d/airtime-playout start-liquidsoap
2021-08-16 13:45:32 +02:00
user=$2
2021-08-16 13:45:32 +02:00
echo "Changing ownership to user $1"
chmod -R a+rw /var/log/airtime/pypo
chmod a+r /etc/airtime/airtime.conf
chown -Rv $user:$user /var/tmp/airtime/pypo/
chmod -v a+r /etc/airtime/api_client.cfg
elif [ "$1" = "--disable" ]; then
2021-08-16 13:45:32 +02:00
user="pypo"
2021-08-16 13:45:32 +02:00
echo "Changing ownership to user $1"
chmod 644 /etc/airtime/airtime.conf
chown -Rv $user:$user /var/tmp/airtime/pypo/
chmod -v a+r /etc/airtime/api_client.cfg
2021-08-16 13:45:32 +02:00
/etc/init.d/airtime-playout stop-liquidsoap
/etc/init.d/airtime-playout start
else
2021-08-16 13:45:32 +02:00
usage
fi