Progress
Reorganize; add a new service that actively keeps rc.d in sync with the real rootfs
This commit is contained in:
24
etc/config/atcommands.user
Normal file
24
etc/config/atcommands.user
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
Reboot;AT+CFUN=1,1
|
||||||
|
Disconnect;AT+CFUN=0
|
||||||
|
Connect;AT+CFUN=1
|
||||||
|
Signal Info;AT+QENG="servingcell"
|
||||||
|
CA Info;AT+QCAINFO
|
||||||
|
Get current SIM Slot;AT+QUIMSLOT?
|
||||||
|
Switch to SIM Slot 1;AT+QUIMSLOT=1
|
||||||
|
Switch to SIM Slot 2;AT+QUIMSLOT=2
|
||||||
|
Get current APN List;AT+CGDCONT?
|
||||||
|
Set APN to NRBROADBAND;AT+CGDCONT=1,"IPV4V6","NRBROADBAND"
|
||||||
|
Show Current IMEI;AT+EGMR=0,7
|
||||||
|
Show Current Network Mode;AT+QNWPREFCFG="mode_pref"
|
||||||
|
Set Network Mode to AUTO;AT+QNWPREFCFG="mode_pref",AUTO
|
||||||
|
Set Network Mode to 5G NR/4G LTE Only;AT+QNWPREFCFG="mode_pref",NR5G:LTE
|
||||||
|
Set Network Mode to 5G NR Only;AT+QNWPREFCFG="mode_pref",NR5G
|
||||||
|
Set Network Mode to 4G LTE Only;AT+QNWPREFCFG="mode_pref",LTE
|
||||||
|
Check to see if SA or NSA is disabled;AT+QNWPREFCFG="nr5g_disable_mode"
|
||||||
|
Enable Both SA and NSA;AT+QNWPREFCFG="nr5g_disable_mode",0
|
||||||
|
Disable SA Only;AT+QNWPREFCFG="nr5g_disable_mode",1
|
||||||
|
Disable NSA Only;AT+QNWPREFCFG="nr5g_disable_mode",2
|
||||||
|
Get Currently Enabled 5G/NR SA Bands;AT+QNWPREFCFG="nr5g_band"
|
||||||
|
Get Currently Enabled 5G/NR NSA Bands;AT+QNWPREFCFG="nsa_nr5g_band"
|
||||||
|
Get Currently Enabled 4G/LTE Bands;AT+QNWPREFCFG="lte_band"
|
||||||
|
View assigned IPv4/IPv6 addresses from the provider;AT+QMAP="WWAN"
|
||||||
4
etc/config/atinout
Normal file
4
etc/config/atinout
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
config atinout 'general'
|
||||||
|
option atcport '/dev/smd11'
|
||||||
|
|
||||||
50
etc/config/luci
Normal file
50
etc/config/luci
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
|
||||||
|
config core 'main'
|
||||||
|
option lang 'auto'
|
||||||
|
option mediaurlbase '/luci-static/bootstrap'
|
||||||
|
option resourcebase '/luci-static/resources'
|
||||||
|
option ubuspath '/ubus/'
|
||||||
|
|
||||||
|
config extern 'flash_keep'
|
||||||
|
option uci '/etc/config/'
|
||||||
|
option dropbear '/etc/dropbear/'
|
||||||
|
option openvpn '/etc/openvpn/'
|
||||||
|
option passwd '/etc/passwd'
|
||||||
|
option opkg '/etc/opkg.conf'
|
||||||
|
option firewall '/etc/firewall.user'
|
||||||
|
option uploads '/lib/uci/upload/'
|
||||||
|
|
||||||
|
config internal 'languages'
|
||||||
|
option en 'English'
|
||||||
|
|
||||||
|
config internal 'sauth'
|
||||||
|
option sessionpath '/tmp/luci-sessions'
|
||||||
|
option sessiontime '3600'
|
||||||
|
|
||||||
|
config internal 'ccache'
|
||||||
|
option enable '1'
|
||||||
|
|
||||||
|
config internal 'themes'
|
||||||
|
option Bootstrap '/luci-static/bootstrap'
|
||||||
|
option BootstrapDark '/luci-static/bootstrap-dark'
|
||||||
|
option BootstrapLight '/luci-static/bootstrap-light'
|
||||||
|
|
||||||
|
config internal 'apply'
|
||||||
|
option rollback '90'
|
||||||
|
option holdoff '4'
|
||||||
|
option timeout '5'
|
||||||
|
option display '1.5'
|
||||||
|
|
||||||
|
config internal 'diag'
|
||||||
|
option dns 'openwrt.org'
|
||||||
|
option ping 'openwrt.org'
|
||||||
|
option route 'openwrt.org'
|
||||||
|
|
||||||
|
config command
|
||||||
|
option name 'Show INFO'
|
||||||
|
option command 'atcmd '\''ATI'\'''
|
||||||
|
|
||||||
|
config command
|
||||||
|
option name 'show name'
|
||||||
|
option command 'uname -a'
|
||||||
|
|
||||||
6
etc/config/ttyd
Normal file
6
etc/config/ttyd
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
config ttyd
|
||||||
|
option interface '@lan'
|
||||||
|
option debug '7'
|
||||||
|
option command '/usr/bin/login'
|
||||||
|
|
||||||
20
etc/init.d/init-overlay-watchdog
Normal file
20
etc/init.d/init-overlay-watchdog
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/ash /etc/rc.common
|
||||||
|
|
||||||
|
START=04
|
||||||
|
USE_PROCD=1
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
procd_open_instance
|
||||||
|
procd_set_param command /usr/sbin/init-overlay-watchdog.sh
|
||||||
|
procd_set_param respawn 3600 5 5
|
||||||
|
procd_set_param stdout 1
|
||||||
|
procd_set_param stderr 1
|
||||||
|
procd_set_param pidfile /var/run/init-overlay-watchdog.pid
|
||||||
|
procd_set_param tracking
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_service() {
|
||||||
|
echo "Stopping init-overlay-watchdog service"
|
||||||
|
# `procd` will handle stopping the service and its processes
|
||||||
|
}
|
||||||
44
etc/opkg/distfeeds.conf
Normal file
44
etc/opkg/distfeeds.conf
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# src/gz openwrt_core https://downloads.openwrt.org/releases/22.03.5/targets/sdx75/generic/packages
|
||||||
|
src/gz openwrt_base https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/base
|
||||||
|
src/gz openwrt_luci https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/luci
|
||||||
|
src/gz openwrt_packages https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/packages
|
||||||
|
# src/gz openwrt_qtiagm https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiagm
|
||||||
|
# src/gz openwrt_qtiargs https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiargs
|
||||||
|
# src/gz openwrt_qtiaudio https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiaudio
|
||||||
|
# src/gz openwrt_qtiaudioprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiaudioprop
|
||||||
|
# src/gz openwrt_qtibsp https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtibsp
|
||||||
|
# src/gz openwrt_qtibspprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtibspprop
|
||||||
|
# src/gz openwrt_qtibt https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtibt
|
||||||
|
# src/gz openwrt_qtibtprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtibtprop
|
||||||
|
# src/gz openwrt_qticore https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qticore
|
||||||
|
# src/gz openwrt_qticoreinternal https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qticoreinternal
|
||||||
|
# src/gz openwrt_qticoreprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qticoreprop
|
||||||
|
# src/gz openwrt_qtictainternal https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtictainternal
|
||||||
|
# src/gz openwrt_qtidata https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtidata
|
||||||
|
# src/gz openwrt_qtidatainternal https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtidatainternal
|
||||||
|
# src/gz openwrt_qtidataprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtidataprop
|
||||||
|
# src/gz openwrt_qtiipq https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiipq
|
||||||
|
# src/gz openwrt_qtiipqezmesh https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiipqezmesh
|
||||||
|
# src/gz openwrt_qtiipqprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiipqprop
|
||||||
|
# src/gz openwrt_qtilocation https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtilocation
|
||||||
|
# src/gz openwrt_qtilocationinternal https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtilocationinternal
|
||||||
|
# src/gz openwrt_qtilocationprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtilocationprop
|
||||||
|
# src/gz openwrt_qtimsdcprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtimsdcprop
|
||||||
|
# src/gz openwrt_qtinternal https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtinternal
|
||||||
|
# src/gz openwrt_qtipal https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtipal
|
||||||
|
# src/gz openwrt_qtiperfprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiperfprop
|
||||||
|
# src/gz openwrt_qtippatprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtippatprop
|
||||||
|
# src/gz openwrt_qtiquectel https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiquectel
|
||||||
|
# src/gz openwrt_qtiquectelprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiquectelprop
|
||||||
|
# src/gz openwrt_qtirilprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtirilprop
|
||||||
|
# src/gz openwrt_qtisecurity https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtisecurity
|
||||||
|
# src/gz openwrt_qtisecurityinternal https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtisecurityinternal
|
||||||
|
# src/gz openwrt_qtisecurityprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtisecurityprop
|
||||||
|
# src/gz openwrt_qtisensorsinternal https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtisensorsinternal
|
||||||
|
# src/gz openwrt_qtisensorsprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtisensorsprop
|
||||||
|
# src/gz openwrt_qtissdk https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtissdk
|
||||||
|
# src/gz openwrt_qtissmgr https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtissmgr
|
||||||
|
# src/gz openwrt_qtissmgrprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtissmgrprop
|
||||||
|
# src/gz openwrt_qtiwlan https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiwlan
|
||||||
|
# src/gz openwrt_qtiwlanprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiwlanprop
|
||||||
|
src/gz openwrt_routing https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/routing
|
||||||
@@ -1,25 +1,19 @@
|
|||||||
#!/bin/sh
|
#!/bin/ash
|
||||||
|
|
||||||
#WORK IN PROGRESS
|
#WORK IN PROGRESS
|
||||||
|
|
||||||
# Define toolkit paths
|
# Define toolkit paths
|
||||||
GITUSER="iamromulan"
|
GITUSER="iamromulan"
|
||||||
GITTREE="development-RM551"
|
GITREPO="quectel-rgmii-toolkit"
|
||||||
GITMAINTREE="main"
|
GITTREE="SDXPINN"
|
||||||
GITDEVTREE="development"
|
GITMAINTREE="SDXPINN"
|
||||||
|
GITDEVTREE="development-SDXPINN"
|
||||||
TMP_DIR="/tmp"
|
TMP_DIR="/tmp"
|
||||||
USRDATA_DIR="/data"
|
USRDATA_DIR="/data"
|
||||||
SOCAT_AT_DIR="/data/socat-at-bridge"
|
|
||||||
SOCAT_AT_SYSD_DIR="/data/socat-at-bridge/systemd_units"
|
|
||||||
SIMPLE_ADMIN_DIR="/data/simpleadmin"
|
|
||||||
SIMPLE_FIREWALL_DIR="/data/simplefirewall"
|
SIMPLE_FIREWALL_DIR="/data/simplefirewall"
|
||||||
SIMPLE_FIREWALL_SCRIPT="$SIMPLE_FIREWALL_DIR/simplefirewall.sh"
|
SIMPLE_FIREWALL_SCRIPT="$SIMPLE_FIREWALL_DIR/simplefirewall.sh"
|
||||||
SIMPLE_FIREWALL_SYSTEMD_DIR="$SIMPLE_FIREWALL_DIR/systemd"
|
SIMPLE_FIREWALL_SYSTEMD_DIR="$SIMPLE_FIREWALL_DIR/systemd"
|
||||||
|
|
||||||
# AT Command Script Variables and Functions
|
|
||||||
DEVICE_FILE="/dev/smd7"
|
|
||||||
TIMEOUT=4 # Set a timeout for the response
|
|
||||||
|
|
||||||
# Function to remount file system as read-write
|
# Function to remount file system as read-write
|
||||||
remount_rw() {
|
remount_rw() {
|
||||||
mount -o remount,rw /
|
mount -o remount,rw /
|
||||||
@@ -30,76 +24,23 @@ remount_ro() {
|
|||||||
mount -o remount,ro /
|
mount -o remount,ro /
|
||||||
}
|
}
|
||||||
|
|
||||||
# Basic AT commands without socat bridge for fast response commands only
|
send_at_commands_using_atcmd() {
|
||||||
start_listening() {
|
|
||||||
cat "$DEVICE_FILE" > /tmp/device_readout &
|
|
||||||
CAT_PID=$!
|
|
||||||
}
|
|
||||||
|
|
||||||
send_at_command() {
|
|
||||||
echo -e "\e[1;31mThis only works for basic quick responding commands!\e[0m" # Red
|
|
||||||
echo -e "\e[1;36mType 'install' to simply type atcmd in shell from now on\e[0m"
|
|
||||||
echo -e "\e[1;36mThe installed version is much better than this portable version\e[0m"
|
|
||||||
echo -e "\e[1;32mEnter AT command (or type 'exit' to quit): \e[0m"
|
|
||||||
read at_command
|
|
||||||
if [ "$at_command" = "exit" ]; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$at_command" = "install" ]; then
|
|
||||||
install_update_at_socat
|
|
||||||
echo -e "\e[1;32mInstalled. Type atcmd from adb shell or ssh to start an AT Command session\e[0m"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
echo -e "${at_command}\r" > "$DEVICE_FILE"
|
|
||||||
}
|
|
||||||
|
|
||||||
wait_for_response() {
|
|
||||||
local start_time=$(date +%s)
|
|
||||||
local current_time
|
|
||||||
local elapsed_time
|
|
||||||
|
|
||||||
echo -e "\e[1;32mCommand sent, waiting for response...\e[0m"
|
|
||||||
while true; do
|
while true; do
|
||||||
if grep -qe "OK" -e "ERROR" /tmp/device_readout; then
|
echo -e "\e[1;32mEnter AT command (or type 'exit' to return to the main menu): \e[0m"
|
||||||
echo -e "\e[1;32mResponse received:\e[0m"
|
read at_command
|
||||||
cat /tmp/device_readout
|
if [ "$at_command" = "exit" ]; then
|
||||||
return 0
|
echo -e "\e[1;32mReturning to the main menu.\e[0m"
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
current_time=$(date +%s)
|
echo -e "\e[1;32mSending AT command: $at_command\e[0m"
|
||||||
elapsed_time=$((current_time - start_time))
|
echo -e "\e[1;32mResponse:\e[0m"
|
||||||
if [ "$elapsed_time" -ge "$TIMEOUT" ]; then
|
# Use atcmd to send the command and display the output
|
||||||
echo -e "\e[1;31mError: Response timed out.\e[0m" # Red
|
atcmd_output=$(atcmd "$at_command")
|
||||||
echo -e "\e[1;32mIf the response takes longer than a second or 2 to respond this will not work\e[0m" # Green
|
echo "$atcmd_output"
|
||||||
echo -e "\e[1;36mType install to install the better version of this that will work.\e[0m" # Cyan
|
echo -e "\e[1;32m----------------------------------------\e[0m"
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
|
||||||
kill "$CAT_PID"
|
|
||||||
wait "$CAT_PID" 2>/dev/null
|
|
||||||
rm -f /tmp/device_readout
|
|
||||||
}
|
|
||||||
|
|
||||||
send_at_commands() {
|
|
||||||
if [ -c "$DEVICE_FILE" ]; then
|
|
||||||
while true; do
|
|
||||||
start_listening
|
|
||||||
send_at_command
|
|
||||||
if [ $? -eq 1 ]; then
|
|
||||||
cleanup
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
wait_for_response
|
|
||||||
cleanup
|
|
||||||
done
|
|
||||||
else
|
|
||||||
echo -e "\e[1;31mError: Device $DEVICE_FILE does not exist!\e[0m"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
overlay_check() {
|
overlay_check() {
|
||||||
if ! grep -qs '/real_rootfs ' /proc/mounts; then
|
if ! grep -qs '/real_rootfs ' /proc/mounts; then
|
||||||
@@ -131,16 +72,20 @@ basic_55x_setup() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd /etc/init.d/
|
cd /etc/init.d/
|
||||||
wget https://raw.githubusercontent.com/iamromulan/quectel-rgmii-toolkit/development-SDXPINN/init.d/mount-fix
|
wget https://raw.githubusercontent.com/$GITUSER/$GITREPO/$GITTREE/etc/init.d/mount-fix
|
||||||
# wget https://raw.githubusercontent.com/iamromulan/quectel-rgmii-toolkit/development-SDXPINN/init.d/init-overlay-watchdog
|
wget https://raw.githubusercontent.com/$GITUSER/$GITREPO/$GITTREE/etc/init.d/init-overlay-watchdog
|
||||||
# Set executable permissions
|
# Set executable permissions
|
||||||
chmod +x mount-fix
|
chmod +x mount-fix
|
||||||
# chmod +x init-overlay-watchdog
|
chmod +x init-overlay-watchdog
|
||||||
cd /
|
cd /usr/sbin
|
||||||
|
wget https://raw.githubusercontent.com/$GITUSER/$GITREPO/$GITTREE/usr/sbin/init-overlay-watchdog.sh
|
||||||
|
cd /
|
||||||
service mount-fix enable
|
service mount-fix enable
|
||||||
# service init-overlay-watchdog enable
|
service init-overlay-watchdog enable
|
||||||
service mount-fix start
|
service mount-fix start
|
||||||
# service init-overlay-watchdog start
|
opkg update
|
||||||
|
opkg opkg install inotifywait inotifywatch
|
||||||
|
service init-overlay-watchdog start
|
||||||
echo -e "\e[92m"
|
echo -e "\e[92m"
|
||||||
echo "Mount fix completed!"
|
echo "Mount fix completed!"
|
||||||
echo "Visit https://github.com/iamromulan for more!"
|
echo "Visit https://github.com/iamromulan for more!"
|
||||||
@@ -218,6 +163,9 @@ ttl_setup() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_root_passwd() {
|
||||||
|
passwd
|
||||||
|
}
|
||||||
|
|
||||||
# Function for Tailscale Submenu
|
# Function for Tailscale Submenu
|
||||||
tailscale_menu() {
|
tailscale_menu() {
|
||||||
@@ -239,13 +187,68 @@ tailscale_menu() {
|
|||||||
|
|
||||||
# Function to install, update, or remove Tailscale
|
# Function to install, update, or remove Tailscale
|
||||||
install_update_tailscale() {
|
install_update_tailscale() {
|
||||||
echo -e "\e[1;31m2) Installing tailscale from opkg\e[0m"
|
echo -e "\e[1;31mInstalling Tailscale from opkg...\e[0m"
|
||||||
opkg install tailscale
|
opkg install tailscale
|
||||||
echo -e "\e[1;32mTailscale has been updated/installed.\e[0m"
|
if [ $? -ne 0 ]; then
|
||||||
echo -e "\e[1;31mTailscale is not up to date!.\e[0m"
|
echo -e "\e[1;31mFailed to install Tailscale via opkg.\e[0m"
|
||||||
echo -e "\e[1;32mReplace the tailscale and tailscaled binaries with the new ones and run tailscale update.\e[0m"
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\e[1;32mTailscale has been installed via opkg.\e[0m"
|
||||||
|
echo -e "\e[1;32mUpdating to the latest Tailscale version...\e[0m"
|
||||||
|
|
||||||
|
# Stop Running Service
|
||||||
|
service tailscale stop
|
||||||
|
|
||||||
|
# Define variables for the download
|
||||||
|
TAILSCALE_URL="https://pkgs.tailscale.com/stable/tailscale_1.74.1_arm64.tgz"
|
||||||
|
TAILSCALE_TGZ="/tmp/tailscale_1.74.1_arm64.tgz"
|
||||||
|
TAILSCALE_TMP_DIR="/tmp/tailscale_update"
|
||||||
|
|
||||||
|
# Download the latest Tailscale package
|
||||||
|
echo -e "\e[1;32mDownloading latest Tailscale package...\e[0m"
|
||||||
|
wget -O "$TAILSCALE_TGZ" "$TAILSCALE_URL"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e "\e[1;31mFailed to download Tailscale package. Please check your internet connection.\e[0m"
|
||||||
|
rm -f "$TAILSCALE_TGZ"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract the package
|
||||||
|
echo -e "\e[1;32mExtracting Tailscale package...\e[0m"
|
||||||
|
mkdir -p "$TAILSCALE_TMP_DIR"
|
||||||
|
tar -xzf "$TAILSCALE_TGZ" -C "$TAILSCALE_TMP_DIR"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e "\e[1;31mFailed to extract Tailscale package.\e[0m"
|
||||||
|
rm -f "$TAILSCALE_TGZ"
|
||||||
|
rm -rf "$TAILSCALE_TMP_DIR"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Replace the binaries with force option
|
||||||
|
echo -e "\e[1;32mUpdating Tailscale binaries...\e[0m"
|
||||||
|
cp -f "$TAILSCALE_TMP_DIR/tailscale_1.74.1_arm64/tailscale" /usr/sbin/
|
||||||
|
cp -f "$TAILSCALE_TMP_DIR/tailscale_1.74.1_arm64/tailscaled" /usr/sbin/
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e "\e[1;31mFailed to copy new Tailscale binaries.\e[0m"
|
||||||
|
rm -f "$TAILSCALE_TGZ"
|
||||||
|
rm -rf "$TAILSCALE_TMP_DIR"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set the correct permissions
|
||||||
|
chmod +x /usr/sbin/tailscale /usr/sbin/tailscaled
|
||||||
|
|
||||||
|
# Clean up temporary files
|
||||||
|
rm -f "$TAILSCALE_TGZ"
|
||||||
|
rm -rf "$TAILSCALE_TMP_DIR"
|
||||||
|
|
||||||
|
# Start Tailscale service if available
|
||||||
|
service tailscale start
|
||||||
|
echo -e "\e[1;32mTailscale version 1.74.1 installed\e[0m"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Function to Configure Tailscale
|
# Function to Configure Tailscale
|
||||||
configure_tailscale() {
|
configure_tailscale() {
|
||||||
while true; do
|
while true; do
|
||||||
@@ -353,7 +356,7 @@ while true; do
|
|||||||
read -p "Enter your choice: " choice
|
read -p "Enter your choice: " choice
|
||||||
|
|
||||||
case $choice in
|
case $choice in
|
||||||
1) send_at_commands ;;
|
1) send_at_commands_using_atcmd ;;
|
||||||
2) remount_rw; basic_55x_setup ;;
|
2) remount_rw; basic_55x_setup ;;
|
||||||
3)
|
3)
|
||||||
overlay_check
|
overlay_check
|
||||||
|
|||||||
39
usr/sbin/init-overlay-watchdog.sh
Normal file
39
usr/sbin/init-overlay-watchdog.sh
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/ash
|
||||||
|
|
||||||
|
# Paths to monitor and synchronize
|
||||||
|
WATCH_DIR="/etc/rc.d"
|
||||||
|
TARGET_DIR="/real_rootfs/etc/rc.d"
|
||||||
|
|
||||||
|
# Function to synchronize init scripts
|
||||||
|
synchronize_init_scripts() {
|
||||||
|
mount -o remount,rw /real_rootfs
|
||||||
|
# Copy new or updated symlinks from WATCH_DIR to TARGET_DIR
|
||||||
|
for link in "$WATCH_DIR"/*; do
|
||||||
|
if [ -L "$link" ]; then
|
||||||
|
link_name=$(basename "$link")
|
||||||
|
if [ ! -e "$TARGET_DIR/$link_name" ] || [ "$link" -nt "$TARGET_DIR/$link_name" ]; then
|
||||||
|
cp -af "$link" "$TARGET_DIR/$link_name"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove symlinks in TARGET_DIR that no longer exist in WATCH_DIR
|
||||||
|
for link in "$TARGET_DIR"/*; do
|
||||||
|
if [ -L "$link" ]; then
|
||||||
|
link_name=$(basename "$link")
|
||||||
|
if [ ! -e "$WATCH_DIR/$link_name" ]; then
|
||||||
|
rm -f "$TARGET_DIR/$link_name"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
mount -o remount,ro /real_rootfs
|
||||||
|
}
|
||||||
|
|
||||||
|
# Initial synchronization
|
||||||
|
synchronize_init_scripts
|
||||||
|
|
||||||
|
# Monitor WATCH_DIR for changes using inotifywait
|
||||||
|
while true; do
|
||||||
|
inotifywait -e create,delete,modify,move "$WATCH_DIR"
|
||||||
|
synchronize_init_scripts
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user