update
Took 1 hour 16 minutes
This commit is contained in:
@ -5,6 +5,9 @@ if [ "$EUID" -ne 0 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Creating user if not exists"
|
||||
adduser itender || true
|
||||
|
||||
echo "Updating indexes"
|
||||
apt update
|
||||
|
||||
@ -42,13 +45,13 @@ ufw allow 3000/tcp
|
||||
ufw allow 3015/tcp
|
||||
ufw --force enable
|
||||
|
||||
echo "Updating indexes and installing mongodb and yarn..."
|
||||
echo "Updating indexes..."
|
||||
# Final update
|
||||
apt update
|
||||
echo "Installing mongodb and yarn..."
|
||||
apt install nodejs yarn mongodb-org -y
|
||||
apt upgrade -y
|
||||
|
||||
|
||||
echo "Installing autostart..."
|
||||
# Autostart
|
||||
cat <<EOT >/etc/xdg/openbox/autostart
|
||||
@ -64,8 +67,12 @@ sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/
|
||||
/usr/bin/chromium-browser --disable-infobars --kiosk --incognito --disable-pinch --overscroll-history-navigation=0 "http://127.0.0.1:3000/" &
|
||||
EOT
|
||||
|
||||
echo "Setting to console autologin..."
|
||||
raspi-config nonint do_boot_behaviour B2
|
||||
|
||||
echo "Installing bashrc"
|
||||
echo "[[ -z \$DISPLAY && \$XDG_VTNR -eq 1 ]] && startx -- -nocursor" >> /home/itender/.bashrc
|
||||
echo "clear" >>/home/itender/.bashrc
|
||||
echo "[[ -z \$DISPLAY && \$XDG_VTNR -eq 1 ]] && startx -- -nocursor >/dev/null 2>&1" >>/home/itender/.bashrc
|
||||
#
|
||||
#echo "Installing start.sh"
|
||||
#cat <<EOT >>/home/itender/start.sh
|
||||
@ -101,14 +108,14 @@ yarn run compile
|
||||
|
||||
echo "Updating Cron..."
|
||||
# Add line to cron
|
||||
echo "@reboot sudo chmod g+rw /dev/tty?" > /tmp/currentCron
|
||||
echo "@reboot sudo chmod g+rw /dev/tty?" >/tmp/currentCron
|
||||
#echo "@reboot cd /home/itender/itender/ && /usr/bin/yarn run start &" >> /tmp/currentCron
|
||||
chown itender:itender /tmp/currentCron
|
||||
#install new cron file
|
||||
sudo -u itender crontab /tmp/currentCron
|
||||
|
||||
echo "Installing systemd service..."
|
||||
cat <<EOT > /etc/systemd/system/itender.service
|
||||
cat <<EOT >/etc/systemd/system/itender.service
|
||||
[Unit]
|
||||
Description=iTender App
|
||||
After=network.target mongod.service
|
||||
@ -132,7 +139,6 @@ WantedBy=multi-user.target
|
||||
EOT
|
||||
#sh -c "git pull --quiet || true"
|
||||
|
||||
|
||||
echo "Activating systemctl daemons..."
|
||||
systemctl daemon-reload
|
||||
systemctl enable mongod
|
||||
@ -156,6 +162,21 @@ fi
|
||||
if ! grep -w "disable_splash=1" /boot/config.txt; then
|
||||
echo "disable_splash=1" >>/boot/config.txt
|
||||
fi
|
||||
if ! grep -w "vc4-fkms-v3d" /boot/config.txt; then
|
||||
sed -i 's/dtoverlay=vc4-kms-v3d/dtoverlay=vc4-fkms-v3d,disable-bt/' /boot/config.txt
|
||||
fi
|
||||
if ! grep -w "boot_delay=0" /boot/config.txt; then
|
||||
echo "boot_delay=0" >>/boot/config.txt
|
||||
fi
|
||||
if ! grep -w "over_voltage=6" /boot/config.txt; then
|
||||
echo "over_voltage=6" >>/boot/config.txt
|
||||
fi
|
||||
if ! grep -w "arm_freq=1300" /boot/config.txt; then
|
||||
echo "arm_freq=1300" >>/boot/config.txt
|
||||
fi
|
||||
if ! grep -w "gpu_freq=700" /boot/config.txt; then
|
||||
echo "gpu_freq=700" >>/boot/config.txt
|
||||
fi
|
||||
|
||||
echo "Setting no-logo..."
|
||||
systemctl disable getty@tty1.service
|
||||
@ -167,9 +188,17 @@ if ! grep -w "logo.nologo" /boot/cmdline.txt; then
|
||||
#cp /tmp/cmdline.txt /boot/cmdline.txt
|
||||
sed -i "1 s|$| vt.global_cursor_default=0|" /boot/cmdline.txt
|
||||
sed -i '1 i\avoid_warnings=1' /boot/config.txt
|
||||
sed -i 's/console=tty0/console=tty3/' /boot/cmdline.txt
|
||||
fi
|
||||
|
||||
echo "iTender 2022
|
||||
Programmed by Tobias Hopp" >/etc/motd
|
||||
|
||||
echo "[Service]
|
||||
ExecStart=/usr/sbin/dhcpcd -q" >/etc/systemd/system/dhcpcd.service.d/wait.conf
|
||||
|
||||
chown itender:itender -R /home/itender/
|
||||
adduser itender gpio
|
||||
adduser itender sudo
|
||||
|
||||
reboot now
|
||||
|
Reference in New Issue
Block a user