mirror of
https://github.com/femtofox/femtofox.git
synced 2026-11-19 22:46:38 -05:00
Update luckfox-install.sh
This commit is contained in:
parent
ad7255eca4
commit
0c10c9ec15
1 changed files with 34 additions and 34 deletions
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/bash
|
||||
echo "[1;32m*** Starting Femtofox install script. \e[1;31mNETWORK CONNECTIVITY REQUIRED! ***\e[0m\n"
|
||||
printf "[1;32m*** Starting Femtofox install script. \e[1;31mNETWORK CONNECTIVITY REQUIRED! ***\e[0m\n"
|
||||
|
||||
sudo timedatectl set-timezone UTC #Set timezone to UTC.
|
||||
date -d "$(wget --method=HEAD -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f4-10)" #Set time/date.
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z") Changed timezone to UTC and got network time ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z") Changed timezone to UTC and got network time ***\e[0m\n"
|
||||
|
||||
read -p "Enter wifi SSID: " SSID
|
||||
echo -n "Enter wifi password: "
|
||||
|
|
@ -16,26 +16,26 @@ echo "\n[1;32m*** SSID saved. Wifi requires adapter ***\e[0m\n"
|
|||
if ! grep -q "tmpfs /run tmpfs size=32M,nosuid,noexec,relatime,mode=755 0 0" /etc/fstab; then
|
||||
sudo mount -t tmpfs tmpfs /run -o remount,size=32M,nosuid,noexec,relatime,mode=755 #Embiggen tmpfs - prevents problems.
|
||||
sudo sh -c 'echo "tmpfs /run tmpfs size=32M,nosuid,noexec,relatime,mode=755 0 0" >> /etc/fstab'
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Enlarged tmpfs ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Enlarged tmpfs ***\e[0m\n"
|
||||
else
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): tmpfs already enlarged, skipping ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): tmpfs already enlarged, skipping ***\e[0m\n"
|
||||
fi
|
||||
|
||||
#update system and install dependencies
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Updating and upgrading Ubuntu... ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Updating and upgrading Ubuntu... ***\e[0m\n"
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y update && sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y upgrade
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Ubuntu upgrade / update complete ***\e[0m\n"
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Getting latest Meshtasticd beta... ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Ubuntu upgrade / update complete ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Getting latest Meshtasticd beta... ***\e[0m\n"
|
||||
URL=$(wget -qO- https://api.github.com/repos/meshtastic/firmware/releases/latest | grep -oP '"browser_download_url": "\K[^"]*armhf\.deb' | head -n 1); FILENAME=$(basename $URL); wget -O /tmp/$FILENAME $URL
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Installing necessary packages... ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Installing necessary packages... ***\e[0m\n"
|
||||
sudo apt-get install linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest /tmp/$FILENAME -y
|
||||
sudo rm /tmp/$FILENAME
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Necessary packages installed ***\e[0m\n"
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Installing pip packages... ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Necessary packages installed ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Installing pip packages... ***\e[0m\n"
|
||||
pip3 install pytap2 meshtastic pypubsub
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Pip packages installed ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Pip packages installed ***\e[0m\n"
|
||||
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Getting custom FemtoFox files... ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Getting custom FemtoFox files... ***\e[0m\n"
|
||||
sudo cp ../liborcania_2.3_armhf/* /usr/lib/arm-linux-gnueabihf/
|
||||
sudo cp -n /etc/meshtasticd/config.yaml /etc/meshtasticd/config.yaml.bak
|
||||
sudo cp ../meshtasticd/config.yaml /etc/meshtasticd/
|
||||
|
|
@ -44,16 +44,16 @@ sudo mv 00-header /etc/update-motd.d/
|
|||
sudo chmod +x /etc/update-motd.d/00-header
|
||||
sudo mv /etc/update-motd.d/10-help-text /etc/update-motd.d/10-help-text.bak
|
||||
sudo mv /etc/update-motd.d/60-unminimize /etc/update-motd.d/60-unminimize.bak
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Copied custom FemtoFox files ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Copied custom FemtoFox files ***\e[0m\n"
|
||||
|
||||
sudo chmod +x usbconfig.sh
|
||||
sudo mv usbconfig.sh /usr/local/bin/
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Added USB configuration tool ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Added USB configuration tool ***\e[0m\n"
|
||||
|
||||
#serial port permissions
|
||||
sudo usermod -a -G tty $USER
|
||||
sudo usermod -a -G dialout $USER
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Set serial port permissions ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Set serial port permissions ***\e[0m\n"
|
||||
|
||||
if [ ! -f /etc/systemd/system/button.service ]; then
|
||||
if ! sudo grep -q "femto ALL=(ALL) NOPASSWD: /sbin/reboot" /etc/sudoers; then
|
||||
|
|
@ -65,46 +65,46 @@ if [ ! -f /etc/systemd/system/button.service ]; then
|
|||
sudo usermod -aG input femto
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable button.service
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Added reboot on BOOT button press ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Added reboot on BOOT button press ***\e[0m\n"
|
||||
else
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Reboot on BOOT button press already added, skipping ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Reboot on BOOT button press already added, skipping ***\e[0m\n"
|
||||
fi
|
||||
|
||||
#disable redundant services
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Disabling redundant services... ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Disabling redundant services... ***\e[0m\n"
|
||||
sudo systemctl disable vsftpd.service
|
||||
sudo systemctl disable ModemManager.service
|
||||
sudo systemctl disable polkit.service
|
||||
sudo systemctl disable getty@tty1.service
|
||||
sudo systemctl disable alsa-restore.service
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Disabled redundant services ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Disabled redundant services ***\e[0m\n"
|
||||
|
||||
#change luckfox system config
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Changing Luckfox system config ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Changing Luckfox system config ***\e[0m\n"
|
||||
sudo mv luckfox.cfg /etc/
|
||||
sudo luckfox-config load
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Set and loaded Luckfox system config ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Set and loaded Luckfox system config ***\e[0m\n"
|
||||
|
||||
sudo hostname femtofox
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Set hostname to femtofox ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Set hostname to femtofox ***\e[0m\n"
|
||||
|
||||
#replace /etc/rc.local
|
||||
if [ ! -f /etc/issue.bak ]; then
|
||||
sudo cp -n /etc/rc.local /etc/rc.local.bak
|
||||
sudo cp ./rc.local /etc/rc.local
|
||||
sudo chmod +x /etc/rc.local
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Replaced /etc/rc.local ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Replaced /etc/rc.local ***\e[0m\n"
|
||||
else
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): /etc/rc.local already replaced, skipping ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): /etc/rc.local already replaced, skipping ***\e[0m\n"
|
||||
fi
|
||||
|
||||
#replace /etc/issue
|
||||
if [ ! -f /etc/issue.bak ]; then
|
||||
sudo cp -n /etc/issue /etc/issue.bak
|
||||
sudo cp ./issue /etc/issue
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Replaced /etc/issue ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Replaced /etc/issue ***\e[0m\n"
|
||||
else
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): /etc/issue already replaced, skipping ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): /etc/issue already replaced, skipping ***\e[0m\n"
|
||||
fi
|
||||
|
||||
#add daily reboot to cron
|
||||
|
|
@ -114,12 +114,12 @@ if ! sudo crontab -l | grep -q "/sbin/reboot"; then
|
|||
|
||||
# restart bbs server script every odd hour
|
||||
#0 23/2 * * * sudo systemctl restart mesh-bbs.service" | sudo tee -a /var/spool/cron/crontabs/root > /dev/null
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Scheduled daily reboot at 06:00 UTC ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Scheduled daily reboot at 06:00 UTC ***\e[0m\n"
|
||||
else
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Daily reboot already scheduled, skipping ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Daily reboot already scheduled, skipping ***\e[0m\n"
|
||||
fi
|
||||
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Configuring networking... ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Configuring networking... ***\e[0m\n"
|
||||
# Replace the existing configuration for eth0 in /etc/network/interfaces
|
||||
current_mac=$(cat /sys/class/net/eth0/address)
|
||||
config="# interfaces(5) file used by ifup(8) and ifdown(8)
|
||||
|
|
@ -139,10 +139,10 @@ iface wlan0 inet dhcp
|
|||
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf"
|
||||
sudo sed -i "/iface eth0 inet/d" /etc/network/interfaces
|
||||
echo "$config" | sudo tee /etc/network/interfaces > /dev/null
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Replaced /etc/network/interfaces and made current ethernet MAC address ($current_mac) permanent ***\e[0m"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Replaced /etc/network/interfaces and made current ethernet MAC address ($current_mac) permanent ***\e[0m"
|
||||
|
||||
#wifi support
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Adding wifi support... ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Adding wifi support... ***\e[0m\n"
|
||||
sudo mkdir /lib/modules
|
||||
sudo mkdir /lib/modules/5.10.160
|
||||
sudo find /oem/usr/ko/ -name '*.ko' ! -name 'ipv6.ko' -exec cp {} /lib/modules/5.10.160/ \;
|
||||
|
|
@ -169,12 +169,12 @@ sudo systemctl stop NetworkManager
|
|||
sudo systemctl disable NetworkManager
|
||||
sudo systemctl restart wpa_supplicant
|
||||
sudo wpa_cli -i wlan0 reconfigure
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Added wifi support ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Added wifi support ***\e[0m\n"
|
||||
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Cleaning up... ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Cleaning up... ***\e[0m\n"
|
||||
sudo rm -rf ~/femtofox
|
||||
|
||||
echo "[1;32m*** $(date "+%H:%M:%S %Z"): Configuration complete... ***\e[0m\n"
|
||||
printf "[1;32m*** $(date "+%H:%M:%S %Z"): Configuration complete... ***\e[0m\n"
|
||||
|
||||
echo "\e[1;31mPress any key to reboot...\e[0m\n"
|
||||
read -n 1 -s && sudo reboot
|
||||
Loading…
Add table
Add a link
Reference in a new issue