2022-07-13 07:35:21 +02:00
|
|
|
#!/usr/bin/bash
|
2022-07-07 19:59:14 +02:00
|
|
|
#
|
2023-02-13 17:19:00 +01:00
|
|
|
# This file is part of the Pandora-box distribution
|
2022-07-07 19:59:14 +02:00
|
|
|
# Copyright (c) 2022 Didier Barzin.
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, version 3.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
|
|
|
|
set -e # stop on error
|
|
|
|
set -x # echo on
|
2022-07-06 17:55:07 +02:00
|
|
|
|
2022-06-28 22:49:48 +02:00
|
|
|
#---------------------
|
2022-07-04 17:29:59 +02:00
|
|
|
# Pandora-box
|
2022-06-28 22:49:48 +02:00
|
|
|
#---------------------
|
2023-02-13 21:16:10 +01:00
|
|
|
pwd
|
2022-06-28 22:49:48 +02:00
|
|
|
|
|
|
|
# Python libraries
|
2022-07-04 20:24:06 +02:00
|
|
|
su - $SUDO_USER -c "pip install pypandora psutil pyudev"
|
2022-06-28 22:49:48 +02:00
|
|
|
|
|
|
|
# Quarantine folder
|
2022-07-04 20:24:06 +02:00
|
|
|
mkdir -p /var/quarantine
|
2022-07-04 17:29:59 +02:00
|
|
|
chown $SUDO_USER /var/quarantine
|
2022-06-28 22:49:48 +02:00
|
|
|
|
2022-07-13 07:35:21 +02:00
|
|
|
# FIM and pmount
|
2022-07-04 20:24:06 +02:00
|
|
|
apt --fix-broken install -y
|
2022-07-13 07:35:21 +02:00
|
|
|
apt install -y fim pmount
|
2022-06-28 22:49:48 +02:00
|
|
|
|
|
|
|
# Suppress all messages from the kernel (and its drivers) except panic messages from appearing on the console.
|
2022-07-04 17:29:59 +02:00
|
|
|
echo "kernel.printk = 3 4 1 3" | tee -a /etc/sysctl.conf
|
2022-07-05 20:14:07 +02:00
|
|
|
# Set Permanently ulimit -n / open files in ubuntu
|
|
|
|
echo "fs.file-max = 65535" | tee -a /etc/sysctl.conf
|
2022-06-28 22:49:48 +02:00
|
|
|
|
|
|
|
# allow write to /dev/fb0
|
2022-07-04 17:29:59 +02:00
|
|
|
usermod -a -G video $SUDO_USER
|
2022-06-28 22:49:48 +02:00
|
|
|
|
2022-06-30 10:32:30 +02:00
|
|
|
# allow read mouse input
|
2022-07-04 17:29:59 +02:00
|
|
|
usermod -a -G input $SUDO_USER
|
2022-06-30 10:32:30 +02:00
|
|
|
|
2022-07-12 16:31:57 +00:00
|
|
|
# allow read mouse input
|
|
|
|
usermod -a -G tty $SUDO_USER
|
|
|
|
|
2022-07-06 17:55:07 +02:00
|
|
|
# Start Pandora at boot
|
2022-07-06 19:10:16 +02:00
|
|
|
cp pandora.service /etc/systemd/system/pandora.service
|
2022-07-06 18:41:41 +02:00
|
|
|
sed -i "s/_USER_/$SUDO_USER/g" /etc/systemd/system/pandora.service
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl enable pandora
|
2022-06-28 22:49:48 +02:00
|
|
|
|
2022-08-02 22:40:36 +02:00
|
|
|
# Do not print messages on console
|
|
|
|
echo "mesg n" >> /home/$SUDO_USER/.profile
|
|
|
|
|
2022-07-06 18:01:45 +02:00
|
|
|
# Start Pandora-box on getty1 at boot
|
2022-07-04 20:24:06 +02:00
|
|
|
mkdir -p /etc/systemd/system/getty@tty1.service.d
|
|
|
|
echo "[Service]" > /etc/systemd/system/getty@tty1.service.d/override.conf
|
|
|
|
echo "ExecStart=" >> /etc/systemd/system/getty@tty1.service.d/override.conf
|
|
|
|
echo "ExecStart=-su - pandora -c ./pandora-box/pandora-box.py" >> /etc/systemd/system/getty@tty1.service.d/override.conf
|
|
|
|
echo "StandardInput=tty" >> /etc/systemd/system/getty@tty1.service.d/override.conf
|
|
|
|
echo "StandardOutput=tty" >> /etc/systemd/system/getty@tty1.service.d/override.conf
|
|
|
|
echo "Type=idle" >> /etc/systemd/system/getty@tty1.service.d/override.conf
|
|
|
|
|
2023-02-13 21:28:53 +01:00
|
|
|
|
|
|
|
# Copy ini file
|
|
|
|
cp pandora-box.ini.curses pandora-dox.ini
|
|
|
|
|
|
|
|
# Reboot
|
|
|
|
echo "You may reboot the server"
|