Created
May 5, 2022 06:09
-
-
Save isakulaksiz/20ff989c2d5f015c3f975a52ff3092d8 to your computer and use it in GitHub Desktop.
Automatically install React and Node packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IP=$(hostname -I) | |
echo "Installation started" | |
install_node(){ | |
sudo apt update -y | |
sudo apt upgrade -y | |
sudo apt install -y chromium-browser | |
sudo apt install nodejs | |
sudo apt install -y nodejs npm | |
} | |
install_node | |
echo "Modules are being installed" | |
install_modules(){ | |
sudo chown -R $USER /usr/local/lib | |
sudo chown -R $USER /usr/local/bin | |
npm install forever -g && npm install forever-service -g | |
npm install | |
npm audit fix | |
sed -i '7,10d' node_modules/escpos/statuses.js | |
} | |
install_modules | |
echo "Services are being installed" | |
install_services(){ | |
sudo killall node | |
npm run service-setup | |
sudo service kmonitor-api start && sudo service kmonitor-app start | |
} | |
install_services | |
echo "Last process" | |
create_chromium_desktop_file(){ | |
exec1='Exec=chromium-browser --kiosk http://' | |
exec2=':3000 --full-screen' | |
exec3="$exec1${IP//[[:blank:]]/}$exec2" | |
echo $exec3 | |
cat < chromium.desktop | |
echo '[Desktop Entry]' >> chromium.desktop | |
echo 'Type=Application_NAME' >> chromium.desktop | |
echo 'Name=chromium-App' >> chromium.desktop | |
echo "$exec1${IP//[[:blank:]]/}$exec2" >> chromium.desktop | |
echo 'Comment=Application' >> chromium.desktop | |
echo 'X-GNOME-Autostart-enabled=true' >> chromium.desktop | |
echo "File is ready" | |
sudo cp chromium.desktop /etc/xdg/autostart | |
reboot | |
} | |
create_chromium_desktop_file | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment