diff --git a/RMxxx_rgmii_toolkit.sh b/RMxxx_rgmii_toolkit.sh index 08e8820..8d5327d 100644 --- a/RMxxx_rgmii_toolkit.sh +++ b/RMxxx_rgmii_toolkit.sh @@ -310,97 +310,134 @@ configure_simple_firewall() { install_simple_admin() { while true; do echo -e "\e[1;32mWhat version of Simple Admin do you want to install? This will start a webserver on port 8080\e[0m" - echo -e "\e[1;32m1) Full Install\e[0m" - echo -e "\e[1;34m2) No AT Commands, List only\e[0m" - echo -e "\e[1;33m3) TTL Only\e[0m" - echo -e "\e[1;31m4) Install Test Build (work in progress/not ready yet)\e[0m" - echo -e "\e[0;33m5) Return to Main Menu\e[0m" + echo -e "\e[1;32m1) Stable current version, (Main Branch)\e[0m" + echo -e "\e[1;31m2) Install Test Build (Development Branch)\e[0m" + echo -e "\e[0;33m3) Return to Main Menu\e[0m" echo -e "\e[1;32mSelect your choice: \e[0m" read choice case $choice in 1) - install_update_at_socat + echo -e "\e[1;32mInstalling simpleadmin from the main stable branch\e[0m" + install_update_at_socat + sleep 1 install_simple_firewall + sleep 1 remount_rw - cd $TMP_DIR - wget $GITHUB_SIMPADMIN_FULL_URL -O simpleadminfull.zip - unzip -o simpleadminfull.zip - cp -Rf quectel-rgmii-toolkit-simpleadminfull/simpleadmin/ $USRDATA_DIR + sleep 1 + mkdir $SIMPLE_ADMIN_DIR + mkdir $SIMPLE_ADMIN_DIR/systemd + mkdir $SIMPLE_ADMIN_DIR/scripts + mkdir $SIMPLE_ADMIN_DIR/www + mkdir $SIMPLE_ADMIN_DIR/www/cgi-bin + mkdir $SIMPLE_ADMIN_DIR/www/css + mkdir $SIMPLE_ADMIN_DIR/www/js + cd $SIMPLE_ADMIN_DIR/systemd + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/systemd/simpleadmin_generate_status.service + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/systemd/simpleadmin_httpd.service + sleep 1 + cd $SIMPLE_ADMIN_DIR/scripts + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/scripts/build_modem_status + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/scripts/modemstatus_parse.sh + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/scripts/tojson.sh + sleep 1 + cd $SIMPLE_ADMIN_DIR/www + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/atcommander.html + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/index.html + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/speedtest.html + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/styles.css + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/ttl.html + sleep 1 + cd $SIMPLE_ADMIN_DIR/www/js + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/js/alpinejs.min.js + sleep 1 + cd $SIMPLE_ADMIN_DIR/www/css + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/css/admin.css + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/css/bulma.css + sleep 1 + cd $SIMPLE_ADMIN_DIR/www/cgi-bin + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/cgi-bin/get_atcommand + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/cgi-bin/get_csq + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/cgi-bin/get_ttl_status + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/simpleadmin/www/cgi-bin/set_ttl + sleep 1 + cd / chmod +x $SIMPLE_ADMIN_DIR/scripts/* chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/* cp -rf $SIMPLE_ADMIN_DIR/systemd/* /lib/systemd/system systemctl daemon-reload + sleep 1 ln -sf /lib/systemd/system/simpleadmin_httpd.service /lib/systemd/system/multi-user.target.wants/ ln -sf /lib/systemd/system/simpleadmin_generate_status.service /lib/systemd/system/multi-user.target.wants/ systemctl start simpleadmin_generate_status + sleep 1 systemctl start simpleadmin_httpd remount_ro - echo "Cleaning up..." - rm /tmp/simpleadminfull.zip - rm -rf /tmp/quectel-rgmii-toolkit-simpleadminfull/ + echo -e "\e[1;32msimpleadmin has been installed and is now ready for use!\e[0m" break ;; 2) - install_update_at_socat + echo -e "\e[1;31m2) Installing simpleadmin from the development test branch\e[0m" + install_update_at_socat + sleep 1 install_simple_firewall + sleep 1 remount_rw - cd $TMP_DIR - wget $GITHUB_SIMPADMIN_NOCMD_URL -O simpleadminnoatcmds.zip - unzip -o simpleadminnoatcmds.zip - cp -Rf quectel-rgmii-toolkit-simpleadminnoatcmds/simpleadmin/ $USRDATA_DIR + sleep 1 + mkdir $SIMPLE_ADMIN_DIR + mkdir $SIMPLE_ADMIN_DIR/systemd + mkdir $SIMPLE_ADMIN_DIR/scripts + mkdir $SIMPLE_ADMIN_DIR/www + mkdir $SIMPLE_ADMIN_DIR/www/cgi-bin + mkdir $SIMPLE_ADMIN_DIR/www/css + mkdir $SIMPLE_ADMIN_DIR/www/js + cd $SIMPLE_ADMIN_DIR/systemd + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/systemd/simpleadmin_generate_status.service + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/systemd/simpleadmin_httpd.service + sleep 1 + cd $SIMPLE_ADMIN_DIR/scripts + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/scripts/build_modem_status + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/scripts/modemstatus_parse.sh + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/scripts/tojson.sh + sleep 1 + cd $SIMPLE_ADMIN_DIR/www + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/atcommander.html + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/index.html + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/speedtest.html + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/styles.css + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/ttl.html + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/sms.html + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/bandlock.html + sleep 1 + cd $SIMPLE_ADMIN_DIR/www/js + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/js/alpinejs.min.js + sleep 1 + cd $SIMPLE_ADMIN_DIR/www/css + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/css/admin.css + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/css/bulma.css + sleep 1 + cd $SIMPLE_ADMIN_DIR/www/cgi-bin + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/cgi-bin/get_atcommand + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/cgi-bin/get_csq + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/cgi-bin/get_ttl_status + wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/development/simpleadmin/www/cgi-bin/set_ttl + sleep 1 + cd / chmod +x $SIMPLE_ADMIN_DIR/scripts/* chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/* cp -rf $SIMPLE_ADMIN_DIR/systemd/* /lib/systemd/system systemctl daemon-reload + sleep 1 ln -sf /lib/systemd/system/simpleadmin_httpd.service /lib/systemd/system/multi-user.target.wants/ ln -sf /lib/systemd/system/simpleadmin_generate_status.service /lib/systemd/system/multi-user.target.wants/ systemctl start simpleadmin_generate_status + sleep 1 systemctl start simpleadmin_httpd remount_ro - echo "Cleaning up..." - rm /tmp/simpleadminnoatcmds.zip - rm -rf /tmp/quectel-rgmii-toolkit-simpleadminnoatcmds/ + echo -e "\e[1;32msimpleadmin has been installed and is now ready for use!\e[0m" break ;; - 3) - install_simple_firewall - remount_rw - cd $TMP_DIR - wget $GITHUB_SIMPADMIN_TTL_URL -O simpleadminttlonly.zip - unzip -o simpleadminttlonly.zip - cp -Rf quectel-rgmii-toolkit-simpleadminttlonly/simpleadmin/ $USRDATA_DIR - chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/* - cp -rf $SIMPLE_ADMIN_DIR/systemd/* /lib/systemd/system - systemctl daemon-reload - ln -sf /lib/systemd/system/simpleadmin_httpd.service /lib/systemd/system/multi-user.target.wants/ - systemctl start simpleadmin_httpd - remount_ro - echo "Cleaning up..." - rm /tmp/simpleadminttlonly.zip - rm -rf /tmp/quectel-rgmii-toolkit-simpleadminttlonly/ - break - ;; - 4) - install_update_at_socat - install_simple_firewall - remount_rw - cd $TMP_DIR - wget $GITHUB_SIMPADMIN_TEST_URL -O simpleadmintest.zip - unzip -o simpleadmintest.zip - cp -Rf quectel-rgmii-toolkit-simpleadmintest/simpleadmin/ $USRDATA_DIR - chmod +x $SIMPLE_ADMIN_DIR/scripts/* - chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/* - cp -rf $SIMPLE_ADMIN_DIR/systemd/* /lib/systemd/system - systemctl daemon-reload - ln -sf /lib/systemd/system/simpleadmin_httpd.service /lib/systemd/system/multi-user.target.wants/ - ln -sf /lib/systemd/system/simpleadmin_generate_status.service /lib/systemd/system/multi-user.target.wants/ - systemctl start simpleadmin_generate_status - systemctl start simpleadmin_httpd - remount_ro - break - ;; - 5) + 3) echo "Returning to main menu..." break ;; @@ -542,11 +579,15 @@ install_update_remove_tailscale() { echo "Creating /usrdata/tailscale/" mkdir $TAILSCALE_DIR mkdir $TAILSCALE_SYSD_DIR + echo "Downloading binary files..." + cd /usrdata + wget https://pkgs.tailscale.com/stable/tailscale_1.62.1_arm.tgz + tar -xzf tailscale_1.62.1_arm.tgz + cd /usrdata/tailscale_1.62.1_arm + mv tailscale $TAILSCALE_DIR/tailscale + mv tailscaled $TAILSCALE_DIR/tailscaled cd $TAILSCALE_DIR - echo "Downloading binary: /usrdata/tailscale/tailscaled" - wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/tailscale/tailscaled - echo "Downloading binary: /usrdata/tailscale/tailscale" - wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/tailscale/tailscale + rm -rf /usrdata/tailscale_1.62.1_arm echo "Downloading systemd files..." cd $TAILSCALE_SYSD_DIR wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/tailscale/systemd/tailscaled.service @@ -795,10 +836,9 @@ WantedBy=multi-user.target" > "$cfun_service_path" fi } -# Function for TTYd install install_ttyd() { echo -e "\e[1;34mStarting ttyd installation process...\e[0m" - + # Check for existing Entware/opkg installation, install if not installed if [ ! -f "/opt/bin/opkg" ]; then echo -e "\e[1;32mInstalling Entware/OPKG\e[0m" cd /tmp && wget -O installentware.sh "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/installentware.sh" && chmod +x installentware.sh && ./installentware.sh @@ -812,43 +852,69 @@ install_ttyd() { fi mount -o remount,rw / - opkg update && opkg install shadow-login shadow-passwd - if [ "$?" -ne 0 ]; then - echo -e "\e[1;31mPackage installation failed. Please check your internet connection and try again.\e[0m" - exit 1 + + if [ -d "/usrdata/ttyd" ]; then + echo -e "\e[1;34mttyd is already installed. Choose an option:\e[0m" + echo -e "\e[1;34m1.) Update to ttyd 1.7.5 (DO NOT UPDATE WHILE USING ttyd! Use ADB or SSH instead)\e[0m" + echo -e "\e[1;31m2.) Uninstall ttyd\e[0m" + read -p "Enter your choice (1/2): " choice + case $choice in + 1) + echo -e "\e[1;34mUpdating ttyd...\e[0m" + systemctl stop ttyd + wget -O /usrdata/ttyd/ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.5/ttyd.armhf && chmod +x /usrdata/ttyd/ttyd + systemctl start ttyd + echo -e "\e[1;32mttyd has been updated.\e[0m" + ;; + 2) + echo -e "\e[1;34mUninstalling ttyd...\e[0m" + systemctl stop ttyd + rm -rf /usrdata/ttyd + rm /lib/systemd/system/ttyd.service + rm /lib/systemd/system/multi-user.target.wants/ttyd.service + rm /bin/ttyd + echo -e "\e[1;32mttyd has been uninstalled.\e[0m" + ;; + *) + echo -e "\e[1;31mInvalid option. Exiting.\e[0m" + exit 1 + ;; + esac + return fi - # Replacing the login and passwd binaries - rm /opt/etc/shadow - cp /etc/shadow /opt/etc/ - rm /bin/login /usr/bin/passwd - ln -sf /opt/bin/login /bin - ln -sf /opt/bin/passwd /usr/bin/ - echo -e "\e[1;31mPlease set your system login password.\e[0m" - /usr/bin/passwd - - # Setting up ttyd + # Continue with installation if ttyd is not already installed. + # Check for /usrdata/socat-at-bridge/atcmd, install if not installed + if [ ! -f "/usrdata/socat-at-bridge/atcmd" ]; then + echo -e "\e[1;34mDependency: atcmd command does not exist. Installing socat-at-bridge...\e[0m" + install_update_at_socat + if [ "$?" -ne 0 ]; then + echo -e "\e[1;31mFailed to install/update atcmd. Please check the process.\e[0m" + exit 1 + fi + fi mkdir -p /usrdata/ttyd/scripts /usrdata/ttyd/systemd cd /usrdata/ttyd/ - wget -O ttyd "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/ttyd/ttyd" && chmod +x ttyd + wget -O ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.4/ttyd.armhf && chmod +x ttyd wget -O scripts/ttyd.bash "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/ttyd/scripts/ttyd.bash" && chmod +x scripts/ttyd.bash wget -O systemd/ttyd.service "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/ttyd/systemd/ttyd.service" cp systemd/ttyd.service /lib/systemd/system/ - ln -sf /lib/systemd/system/ttyd.service /lib/systemd/system/multi-user.target.wants/ + ln -sf /usrdata/ttyd/ttyd /bin # Enabling and starting ttyd service systemctl daemon-reload - systemctl enable ttyd + ln -sf /lib/systemd/system/ttyd.service /lib/systemd/system/multi-user.target.wants/ systemctl start ttyd if [ "$?" -ne 0 ]; then echo -e "\e[1;31mFailed to start ttyd service. Please check the systemd service file and ttyd binary.\e[0m" exit 1 fi - echo -e "\e[1;32mInstall Complete! ttyd server is up on port 443. Note: No TLS/SSL enabled yet.\e[0m" + echo -e "\e[1;32mInstallation Complete! ttyd server is up on port 443. Note: No TLS/SSL enabled yet.\e[0m" } + # Main menu while true; do echo " .%+: " @@ -923,9 +989,11 @@ echo " :+##+. " echo -e "\e[94m4) Tailscale Management\e[0m" # Light Blue echo -e "\e[92m5) Install/Change or remove Daily Reboot Timer\e[0m" # Light Green echo -e "\e[91m6) Install/Uninstall CFUN 0 Fix\e[0m" # Light Red - echo -e "\e[96m7) Install Entware/OPKG (BETA/Advanced)\e[0m" # Cyan (repeated color for additional options) - echo -e "\e[96m8) Install TTYd (BETA,443,No TLS/SSL)\e[0m" # Cyan - echo -e "\e[93m9) Exit\e[0m" # Yellow (repeated color for exit option) + echo -e "\e[96m7) Install/Uninstall Entware/OPKG\e[0m" # Cyan (repeated color for additional options) + echo -e "\e[96m8) Install/Update/Uninstall TTYd 1.7.4 (Uses port 443, No TLS/SSL)\e[0m" # Cyan + echo -e "\e[92m9) Install Speedtest.net CLI app (speedtest command)\e[0m" # Light Green + echo -e "\e[92m10) Install Fast.com CLI app (fast command)(tops out at 40Mbps)\e[0m" # Light Green + echo -e "\e[93m11) Exit\e[0m" # Yellow (repeated color for exit option) read -p "Enter your choice: " choice case $choice in @@ -963,13 +1031,42 @@ echo " :+##+. " ;; 7) echo -e "\e[1;32mInstalling Entware/OPKG\e[0m" - cd /tmp && wget -O installentware.sh https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/installentware.sh && chmod +x installentware.sh && ./installentware.sh - cd / + cd /tmp && wget -O installentware.sh https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/installentware.sh && chmod +x installentware.sh && ./installentware.sh && cd / ;; 8) install_ttyd ;; 9) + echo -e "\e[1;32mInstalling Speedtest.net CLI (speedtest command)\e[0m" + remount_rw + mkdir /usrdata/root + mkdir /usrdata/root/bin + cd /usrdata/root/bin + wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-armhf.tgz + tar -xzf ookla-speedtest-1.2.0-linux-armhf.tgz + rm ookla-speedtest-1.2.0-linux-armhf.tgz + rm speedtest.md + cd / + ln -sf /usrdata/root/bin/speedtest /bin + remount_ro + echo -e "\e[1;32mSpeedtest CLI (speedtest command) installed!!\e[0m" + echo -e "\e[1;32mTry running the command 'speedtest'\e[0m" + ;; + 10) + echo -e "\e[1;32mInstalling fast.com CLI (fast command)\e[0m" + remount_rw + mkdir /usrdata/root + mkdir /usrdata/root/bin + cd /usrdata/root/bin + wget -O fast https://github.com/ddo/fast/releases/download/v0.0.4/fast_linux_arm && chmod +x fast + cd / + ln -sf /usrdata/root/bin/fast /bin + remount_ro + echo -e "\e[1;32mFast.com CLI (speedtest command) installed!!\e[0m" + echo -e "\e[1;32mTry running the command 'fast'\e[0m" + echo -e "\e[1;32mThe fast.com test tops out at 40Mbps on the modem\e[0m" + ;; + 11) echo -e "\e[1;32mGoodbye!\e[0m" break ;; diff --git a/installentware.sh b/installentware.sh index f1280c4..cc0532a 100644 --- a/installentware.sh +++ b/installentware.sh @@ -1,7 +1,8 @@ #!/bin/sh - +# Modified by iamromlan to set up a proper entware environment for Quectel RM5xx series m.2 modems TYPE='generic' #|---------|-----------------| +#| TARGET | Quectel Modem | #| ARCH | armv7sf-k3.2 | #| LOADER | ld-linux.so.3 | #| GLIBC | 2.27 | @@ -41,7 +42,9 @@ uninstall_entware() { systemctl daemon-reload # Optionally, clean up any modifications to /etc/profile or other system files - # This step depends on the specific changes made by the user or the installation script + # Restore original link to login binary compiled by Quectel + rm /bin/login + ln /bin/login.shadow /bin/login echo -e '\033[32mInfo: Entware/OPKG has been uninstalled successfully.\033[0m' } @@ -49,6 +52,7 @@ uninstall_entware() { # Check if /opt exists if [ -d /opt ]; then echo -e "\033[32mDo you want to uninstall Entware/OPKG first? It is already installed.\033[0m" + echo -e "\033[32mThis will also resore your login process to Quectel Stock\033[0m" echo -e "\033[32m1) Yes\033[0m" echo -e "\033[32m2) No\033[0m" echo -e "\033[32m3) Cancel\033[0m" @@ -209,6 +213,38 @@ echo -e '\033[32mInfo: Add /opt/bin & /opt/sbin to $PATH variable\033[0m' echo -e '\033[32mInfo: Run export PATH=/opt/bin:/opt/sbin:$PATH to do it for this session only\033[0m' echo -e '\033[32mInfo: opkg at /opt/bin will be linked to /bin but any package you install with opkg will not be automatically.\033[0m' ln -sf /opt/bin/opkg /bin -opkg update +opkg update && opkg install shadow-login shadow-passwd + if [ "$?" -ne 0 ]; then + echo -e "\e[1;31mPackage installation failed. Please check your internet connection and try again.\e[0m" + exit 1 + fi + + # Replace the login and passwd binaries and set home for root to a writable directory + rm /opt/etc/shadow + rm /opt/etc/passwd + cp /etc/shadow /opt/etc/ + cp /etc/passwd /opt/etc + mkdir /usrdata/root + mkdir /usrdata/root/bin + touch /usrdata/root/.profile + echo "# Set PATH for all shells" > /usrdata/root/.profile + echo "export PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin" >> /usrdata/root/.profile + chmod +x /usrdata/root/.profile + sed -i '1s|/home/root:/bin/sh|/usrdata/root:/bin/bash|' /opt/etc/passwd + rm /bin/login /usr/bin/passwd + ln -sf /opt/bin/login /bin + ln -sf /opt/bin/passwd /usr/bin/ + echo -e "\e[1;31mPlease set your system login password.\e[0m" + /usr/bin/passwd + + # Install basic and useful utilites + opkg install mc + ln -sf /opt/bin/mc /bin + opkg install htop + ln -sf /opt/bin/htop /bin + opkg install dfc + ln -sf /opt/bin/dfc /bin + opkg install lsof + ln -sf /opt/bin/lsof /bin # Remount filesystem as read-only mount -o remount,ro / diff --git a/socat-at-bridge/atcmd b/socat-at-bridge/atcmd index 8d272a4..df5006c 100644 --- a/socat-at-bridge/atcmd +++ b/socat-at-bridge/atcmd @@ -10,24 +10,15 @@ setup_device() { -echoctl -echoke noflsh -ixon -crtscts } -# Prepare the device for communication -setup_device - -echo -e "\033[0;36mType 'exit' to end the session.\033[0m" -while true; do - echo -en "\033[0;36mEnter AT Command: \033[0m" - read user_input - - if [[ "$user_input" == "exit" ]]; then - echo -e "\033[0;32mExiting...\033[0m" - break - fi - +# Function to send AT command and capture the output +send_at_command() { + local command="$1" + # Clear the device buffer before sending a new command echo -n > $DEVICE - # Send the AT command - echo -e "$user_input\r" > $DEVICE + # Send the AT command, preserving the integrity of the input + echo -e "$command\r" > $DEVICE # Use a temporary file to capture the command output tmpfile=$(mktemp) @@ -52,4 +43,27 @@ while true; do # Clean up rm "$tmpfile" -done +} + +# Prepare the device for communication +setup_device + +# Check if an AT command is provided as an argument +if [ $# -gt 0 ]; then + # Concatenate all arguments to handle commands with spaces and/or quotes correctly + FULL_CMD="$*" + send_at_command "$FULL_CMD" +else + echo -e "\033[0;36mType 'exit' to end the session.\033[0m" + while true; do + echo -en "\033[0;36mEnter AT Command: \033[0m" + read user_input + + if [[ "$user_input" == "exit" ]]; then + echo -e "\033[0;32mExiting...\033[0m" + break + fi + + send_at_command "$user_input" + done +fi diff --git a/tailscale/tailscale b/tailscale/tailscale deleted file mode 100644 index acafe22..0000000 Binary files a/tailscale/tailscale and /dev/null differ diff --git a/tailscale/tailscaled b/tailscale/tailscaled deleted file mode 100644 index 3faebab..0000000 Binary files a/tailscale/tailscaled and /dev/null differ diff --git a/ttyd/scripts/ttyd.bash b/ttyd/scripts/ttyd.bash index 13aeba3..e62635d 100644 --- a/ttyd/scripts/ttyd.bash +++ b/ttyd/scripts/ttyd.bash @@ -1,7 +1,9 @@ #!/bin/bash -# Read the serial number and remove the last two digits -serial_number=$(cat /sys/devices/soc0/serial_number | sed 's/..$//') +# Read the serial number +serial_number=$(/usrdata/socat-at-bridge/atcmd 'AT+EGMR=0,5' | grep '+EGMR:' | cut -d '"' -f2) +# Read the firmware revision +firmware_revision=$(/usrdata/socat-at-bridge/atcmd 'AT+CGMR' | grep -o 'RM[0-9A-Z]*' | head -1) echo "==============================================================" echo "==============================================================" @@ -82,9 +84,10 @@ echo " :@@@@@*. " echo " .=@@@@@- " echo " :+##+. " echo "==============================================================" -echo "Test ttyd startup file by iamromulan V0.1" -echo "quectel-ID: $serial_number" +echo "TTYd session file by iamromulan v1.0" +echo "Firmware Revision: $firmware_revision" +echo "Serial Number: $serial_number" echo "==============================================================" # Start a login session -exec /bin/login \ No newline at end of file +exec /bin/login diff --git a/ttyd/ttyd b/ttyd/ttyd deleted file mode 100644 index 9b890f6..0000000 Binary files a/ttyd/ttyd and /dev/null differ