neko/.docker/test

78 lines
1.5 KiB
Plaintext
Raw Normal View History

2020-01-13 21:05:38 +13:00
#!/bin/bash
# usefull debugging tools pavucontrol htop x11vnc
2020-01-28 20:07:35 +13:00
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
export USER=neko
2020-01-27 14:28:39 +13:00
export SCREEN_WIDTH=1280
export SCREEN_HEIGHT=720
export SCREEN_DEPTH=24
export DISPLAY=:99.0
2020-01-30 20:19:57 +13:00
#
# create log folders
if [ ! -L /var/log/neko ]; then
mkdir -p /var/log/neko
mkdir -p logs
2020-01-13 21:05:38 +13:00
2020-01-30 20:19:57 +13:00
ln -s /workspace/.docker/logs /var/log/neko
chown -R $USER logs
chown -R $USER /var/log/neko
fi
#
# clean up old logs
2020-01-29 05:45:00 +13:00
if [ -d logs ]; then
2020-01-30 20:19:57 +13:00
rm -rf logs/*.log
fi
#
# copy neko config
mkdir -p /etc/neko/supervisord
cp files/dbus /usr/bin/dbus
cp files/default.pa /etc/pulse/default.pa
cp files/supervisord.conf /etc/neko/supervisord.conf
cp files/openbox.xml /etc/neko/openbox.xml
#
# remove old configs
rm -rf /etc/neko/supervisord/*.conf
#
# copy dist files
if [ -f ../server/bin/neko ]; then
cp ../server/bin/neko /usr/bin/neko
fi
if [ -d ../client/dist ]; then
cp -R ../client/dist /var/www/
fi
#
# setup pules
if [ ! -f /home/$USER/.config/pulse/client.conf ]; then
mkdir -p /home/$USER/.config/pulse
echo "default-server=unix:/tmp/pulseaudio.socket" > /home/$USER/.config/pulse/client.conf
chown -R $USER /home/$USER/.config;
2020-01-28 20:07:35 +13:00
fi
2020-01-30 20:19:57 +13:00
#
# run setup for browser
case $1 in
firefox) ./files/firefox/test ;;
chromium) ./files/chromium/test ;;
*) ./files/chromium/test ;;
esac
#
# clean up old sessions
rm -rf /home/$USER/.dbus
#
# run supervisord
supervisord --configuration ./files/supervisord.conf