diff --git a/ipk-source/sdxpinn-mount-fix/CONTROL/control b/ipk-source/sdxpinn-mount-fix/CONTROL/control old mode 100644 new mode 100755 index ebf0783..ff60012 --- a/ipk-source/sdxpinn-mount-fix/CONTROL/control +++ b/ipk-source/sdxpinn-mount-fix/CONTROL/control @@ -1,5 +1,5 @@ Package: sdxpinn-mount-fix -Version: 1.1.0 +Version: 1.2.0 Architecture: aarch64_cortex-a53 Maintainer: Cameron Thompson iamromulan@github.com Description: Creates a usable mount space and overlay for SDXPINN modems. Dependencies bundled: libinotifytools and inotifywait diff --git a/ipk-source/sdxpinn-mount-fix/CONTROL/postinst b/ipk-source/sdxpinn-mount-fix/CONTROL/postinst old mode 100644 new mode 100755 index 79bd077..126ea3c --- a/ipk-source/sdxpinn-mount-fix/CONTROL/postinst +++ b/ipk-source/sdxpinn-mount-fix/CONTROL/postinst @@ -62,10 +62,23 @@ chmod +x /etc/init.d/mount-fix /etc/init.d/init-overlay-watchdog /etc/init.d/add # Enable and start the services echo "Starting services..." + service mount-fix enable +if grep -qs '/usrdata' /proc/mounts; then + echo "/usrdata is mounted. Synchronizing mount-fix files to /usrdata..." + cp /etc/init.d/mount-fix /usrdata/etc/init.d/mount-fix + cp -P /etc/rc.d/S03mount-fix /usrdata/etc/rc.d/S03mount-fix +fi service mount-fix start + sleep 1 + service init-overlay-watchdog enable +if grep -qs '/usrdata' /proc/mounts; then + echo "/usrdata is mounted. Synchronizing init-overlay-watchdog files to /usrdata..." + cp /etc/init.d/init-overlay-watchdog /usrdata/etc/init.d/init-overlay-watchdog + cp -P /etc/rc.d/S04init-overlay-watchdog /usrdata/etc/rc.d/S04init-overlay-watchdog +fi service init-overlay-watchdog start echo -e "\e[32m sdxpinn-mount-fix installed! Here is the new file structure! \e[0m" @@ -103,7 +116,6 @@ if ! grep -q "Package:" "$INIT_SCRIPT"; then else # Enable and start the updated add_opkg_status_bundled script echo "Updated $INIT_SCRIPT with remaining bundled package info." - service add_opkg_status_bundled enable service add_opkg_status_bundled start fi diff --git a/ipk-source/sdxpinn-mount-fix/CONTROL/preinst b/ipk-source/sdxpinn-mount-fix/CONTROL/preinst old mode 100644 new mode 100755 index 6196203..cc3fe86 --- a/ipk-source/sdxpinn-mount-fix/CONTROL/preinst +++ b/ipk-source/sdxpinn-mount-fix/CONTROL/preinst @@ -1,5 +1,9 @@ #!/bin/ash +# Remount original rootfs as read-write +echo "Mounting / as read-write" +mount -o remount,rw / + # Define the location of detected packages file DETECTED_PACKAGES_FILE="/tmp/detected_packages.tmp" LIST_FILE_DELETED=false @@ -49,13 +53,15 @@ if [ "$LIST_FILE_DELETED" = true ]; then fi # Check if /etc is mounted -if grep -qs '/etc ' /proc/mounts; then +if grep -qs '/etc' /proc/mounts; then echo "Unmounting /etc..." umount -lf /etc fi -# Remount original rootfs as read-write -echo "Mounting / as read-write" -mount -o remount,rw / +# Check if /usrdata is mounted +if grep -qs '/usrdata' /proc/mounts; then + echo "/usrdata is mounted. Unmounting /etc again to access rootfs /etc..." + umount -lf /etc +fi exit 0 diff --git a/ipk-source/sdxpinn-mount-fix/CONTROL/prerm b/ipk-source/sdxpinn-mount-fix/CONTROL/prerm old mode 100644 new mode 100755 diff --git a/ipk-source/sdxpinn-mount-fix/build-ipk b/ipk-source/sdxpinn-mount-fix/build-ipk old mode 100644 new mode 100755 diff --git a/ipk-source/sdxpinn-mount-fix/root/etc/init.d/add_opkg_status_bundled b/ipk-source/sdxpinn-mount-fix/root/etc/init.d/add_opkg_status_bundled old mode 100644 new mode 100755 diff --git a/ipk-source/sdxpinn-mount-fix/root/etc/init.d/init-overlay-watchdog b/ipk-source/sdxpinn-mount-fix/root/etc/init.d/init-overlay-watchdog old mode 100644 new mode 100755 diff --git a/ipk-source/sdxpinn-mount-fix/root/etc/init.d/mount-fix b/ipk-source/sdxpinn-mount-fix/root/etc/init.d/mount-fix old mode 100644 new mode 100755 index fe229f1..140cfe7 --- a/ipk-source/sdxpinn-mount-fix/root/etc/init.d/mount-fix +++ b/ipk-source/sdxpinn-mount-fix/root/etc/init.d/mount-fix @@ -2,46 +2,70 @@ START=03 +LOG_FILE="/tmp/mount-fix.log" + start() { - # Log to tmp - rm /tmp/mount-fix.log >/dev/null 2>&1 - /bin/touch /tmp/mount-fix.log - /bin/echo "Begin mount fix process to make a usable userspace" >> /tmp/mount-fix.log + # Initialize log + rm -f "$LOG_FILE" >/dev/null 2>&1 + touch "$LOG_FILE" + + # Redirect all output (stdout and stderr) to the log file + exec >>"$LOG_FILE" 2>&1 + + echo "Begin mount fix process to make a usable userspace." + + # Determine firmware scenario + if mount | grep -q "/usrdata"; then + echo "New firmware scenario detected (with /usrdata)." + handle_new_firmware + elif mount | grep -q "/overlay"; then + echo "Old firmware scenario detected (with /overlay)." + handle_old_firmware + else + echo "Error: Unable to detect firmware scenario. Neither /usrdata nor /overlay mounts found. Exiting." + exit 1 + fi +} + +handle_old_firmware() { + # Redirect all output (stdout and stderr) to the log file + exec >>"$LOG_FILE" 2>&1 + /bin/echo "Begin mount fix process to make a usable userspace" # Forcefully unmount /etc - /bin/echo "Unmounting the tiny overlay at /etc" >> /tmp/mount-fix.log + /bin/echo "Unmounting the tiny overlay at /etc" /bin/umount -lf /etc >/dev/null 2>&1 # Remount root filesystem as read-write - /bin/echo "Remounting / as read-write" >> /tmp/mount-fix.log - /bin/mount -o remount,rw / >> /tmp/mount-fix.log + /bin/echo "Remounting / as read-write" + /bin/mount -o remount,rw / # Check if /overlay/etc-upper/merged.done exists - /bin/echo "First time this is ran the stuff you have been putting in the old overlay needs merged." >> /tmp/mount-fix.log - /bin/echo "Looking for evidence that this has already happened..." >> /tmp/mount-fix.log + /bin/echo "First time this is ran the stuff you have been putting in the old overlay needs merged." + /bin/echo "Looking for evidence that this has already happened..." if [ ! -f /overlay/etc-upper/merged.done ]; then - /bin/echo "/overlay/etc-upper/merged.done not found, merging /overlay/etc-upper/* to /etc/" >> /tmp/mount-fix.log - cp -rf /overlay/etc-upper/* /etc/ >> /tmp/mount-fix.log - /bin/touch /overlay/etc-upper/merged.done >> /tmp/mount-fix.log + /bin/echo "/overlay/etc-upper/merged.done not found, merging /overlay/etc-upper/* to /etc/" + cp -rf /overlay/etc-upper/* /etc/ + /bin/touch /overlay/etc-upper/merged.done else - /bin/echo "/overlay/etc-upper/merged.done found, skipping merge" >> /tmp/mount-fix.log + /bin/echo "/overlay/etc-upper/merged.done found, skipping merge" fi # Unmount /overlay - /bin/echo "Unmounting the no longer needed /overlay" >> /tmp/mount-fix.log - /bin/umount /overlay >> /tmp/mount-fix.log + /bin/echo "Unmounting the no longer needed /overlay" + /bin/umount /overlay # Check if /etc/opkg.conf has a line containing "option overlay_root /overlay" and remove it if it exists - /bin/echo "Lets be sure your opkg config isn't using the old overlay" >> /tmp/mount-fix.log + /bin/echo "Lets be sure your opkg config isn't using the old overlay" if grep -q "option overlay_root /overlay" /etc/opkg.conf; then - /bin/echo "Removing 'option overlay_root /overlay' from /etc/opkg.conf" >> /tmp/mount-fix.log - sed -i '/option overlay_root \/overlay/d' /etc/opkg.conf >> /tmp/mount-fix.log + /bin/echo "Removing 'option overlay_root /overlay' from /etc/opkg.conf" + sed -i '/option overlay_root \/overlay/d' /etc/opkg.conf else - /bin/echo "'option overlay_root /overlay' not found in /etc/opkg.conf, no changes made" >> /tmp/mount-fix.log + /bin/echo "'option overlay_root /overlay' not found in /etc/opkg.conf, no changes made" fi # Ensure necessary directories exist for overlay and pivot_root - /bin/echo "Creating new overlay system" >> /tmp/mount-fix.log + /bin/echo "Creating new overlay system" if [ ! -d /data/rootfs ]; then mkdir -p /data/rootfs fi @@ -53,7 +77,7 @@ start() { fi # Mount the new overlay filesystem - /bin/mount -t overlay overlay -o lowerdir=/,upperdir=/data/rootfs,workdir=/data/rootfs-workdir /rootfs >> /tmp/mount-fix.log + /bin/mount -t overlay overlay -o lowerdir=/,upperdir=/data/rootfs,workdir=/data/rootfs-workdir /rootfs # Create the real_rootfs directory in the new root if [ ! -d /rootfs/real_rootfs ]; then @@ -61,69 +85,238 @@ start() { fi # Pivot root to the new root - /bin/echo "Pivoting Root / to /rootfs; Be back soon!!" >> /tmp/mount-fix.log + /bin/echo "Pivoting Root / to /rootfs; Be back soon!!" /sbin/pivot_root /rootfs /rootfs/real_rootfs >/dev/null 2>&1 # Move the mounted filesystems to the new locations - /bin/mount --move /real_rootfs/sys /sys >> /tmp/mount-fix.log - /bin/mount --move /real_rootfs/proc /proc >> /tmp/mount-fix.log - /bin/mount --move /real_rootfs/tmp /tmp >> /tmp/mount-fix.log - /bin/mount --move /real_rootfs/dev /dev >> /tmp/mount-fix.log - /bin/mount --move /real_rootfs/firmware /firmware >> /tmp/mount-fix.log - /bin/mount --move /real_rootfs/persist /persist >> /tmp/mount-fix.log - /bin/mount --move /real_rootfs/cache /cache >> /tmp/mount-fix.log - /bin/mount --move /real_rootfs/data /data >> /tmp/mount-fix.log + /bin/mount --move /real_rootfs/sys /sys + /bin/mount --move /real_rootfs/proc /proc + /bin/mount --move /real_rootfs/tmp /tmp + /bin/mount --move /real_rootfs/dev /dev + /bin/mount --move /real_rootfs/firmware /firmware + /bin/mount --move /real_rootfs/persist /persist + /bin/mount --move /real_rootfs/cache /cache + /bin/mount --move /real_rootfs/data /data - # Synchronize /etc/rc.d/ and /real_rootfs/etc/rc.d/ - /bin/echo "Synchronizing /etc/rc.d/ and /real_rootfs/etc/rc.d/" >> /tmp/mount-fix.log - for link in /etc/rc.d/*; do - if [ -L "$link" ]; then - link_name=$(basename "$link") - if [ ! -e "/real_rootfs/etc/rc.d/$link_name" ]; then - /bin/echo "Copying $link_name to /real_rootfs/etc/rc.d/" >> /tmp/mount-fix.log - cp -a "$link" "/real_rootfs/etc/rc.d/$link_name" >> /tmp/mount-fix.log - fi - fi - done - - for link in /real_rootfs/etc/rc.d/*; do - if [ -L "$link" ]; then - link_name=$(basename "$link") - if [ ! -e "/etc/rc.d/$link_name" ]; then - /bin/echo "Removing $link_name from /real_rootfs/etc/rc.d/" >> /tmp/mount-fix.log - rm "/real_rootfs/etc/rc.d/$link_name" >> /tmp/mount-fix.log - fi - fi - done + # Synchronize between /etc/rc.d and /real_rootfs/etc/rc.d + synchronize_rc_d "/etc/rc.d" "/real_rootfs/etc/rc.d" # Final logs and remount the original root as read-only - /bin/echo "...and we're back! The original root now lives at /real_rootfs" >> /tmp/mount-fix.log - /bin/echo "Lets mount it as read-only for now, If you need it just remount it as read-write" >> /tmp/mount-fix.log + /bin/echo "...and we're back! The original root now lives at /real_rootfs" + /bin/echo "Lets mount it as read-only for now, If you need it just remount it as read-write" /bin/mount -o remount,ro /real_rootfs >/dev/null 2>&1 - /bin/echo "Overlay and pivot_root setup completed" >> /tmp/mount-fix.log + /bin/echo "Overlay and pivot_root setup completed" +} + +handle_new_firmware() { + # Redirect all output (stdout and stderr) to the log file + exec >>"$LOG_FILE" 2>&1 + /bin/echo "Begin mount fix process to make a usable userspace" + + # Forcefully unmount /etc + /bin/echo "Unmounting the 2 mounts over /etc" + /bin/umount -lf /etc >/dev/null 2>&1 + /bin/umount -lf /etc >/dev/null 2>&1 + + # Remount root filesystem as read-write + /bin/echo "Remounting / as read-write" + /bin/mount -o remount,rw / + + # Begin layer merge checks + # Layer 1 to 2 + # Check if /overlay/etc-upper/merged.done exists + /bin/echo "First time this is ran the stuff you have been putting in the old overlay and /usrdata/etc needs merged." + /bin/echo "Looking for evidence that this has already happened..." + if [ ! -f /usrdata/overlay-work/etc-upper/merged.done ]; then + /bin/echo "/usrdata/overlay-work/etc-upper/merged.done not found, merging /usrdata/overlay-work/etc-upper/* to /usrdata/etc/" + cp -rf /usrdata/overlay-work/etc-upper/* /usrdata/etc/ + /bin/touch /usrdata/overlay-work/etc-upper/merged.done + else + /bin/echo "/usrdata/overlay-work/etc-upper/merged.done found, skipping merge" + fi + # Layer 2 to 3 + # Check if /usrdata/etc/merged.done exists + /bin/echo "First time this is ran the stuff you have been putting in /usrdata/etc and /etc needs merged." + /bin/echo "Looking for evidence that this has already happened..." + if [ ! -f /usrdata/etc/merged.done ]; then + /bin/echo "/usrdata/etc/merged.done not found, merging /usrdata/etc/* to /etc/" + cp -rf /usrdata/etc/* /etc/ + /bin/touch /usrdata/etc/merged.done + else + /bin/echo "/usrdata/etc/merged.done found, skipping merge" + fi + + + # Check if /etc/opkg.conf has a line containing "option overlay_root /overlay" and remove it if it exists + /bin/echo "Lets be sure your opkg config isn't using the old overlay" + if grep -q "option overlay_root /overlay" /etc/opkg.conf; then + /bin/echo "Removing 'option overlay_root /overlay' from /etc/opkg.conf" + sed -i '/option overlay_root \/overlay/d' /etc/opkg.conf + else + /bin/echo "'option overlay_root /overlay' not found in /etc/opkg.conf, no changes made" + fi + + # Ensure necessary directories exist for overlay and pivot_root + /bin/echo "Creating new overlay system" + if [ ! -d /usrdata/rootfs ]; then + mkdir -p /usrdata/rootfs + fi + if [ ! -d /usrdata/rootfs-workdir ]; then + mkdir -p /usrdata/rootfs-workdir + fi + if [ ! -d /rootfs ]; then + mkdir -p /rootfs + fi + + # Mount the new overlay filesystem + /bin/mount -t overlay overlay -o lowerdir=/,upperdir=/usrdata/rootfs,workdir=/usrdata/rootfs-workdir /rootfs + + # Create the real_rootfs directory in the new root + if [ ! -d /rootfs/real_rootfs ]; then + mkdir -p /rootfs/real_rootfs + fi + + # Pivot root to the new root + /bin/echo "Pivoting Root / to /rootfs; Be back soon!!" + /sbin/pivot_root /rootfs /rootfs/real_rootfs >/dev/null 2>&1 + + # Move the mounted filesystems to the new locations + /bin/mount --move /real_rootfs/sys /sys + /bin/mount --move /real_rootfs/proc /proc + /bin/mount --move /real_rootfs/tmp /tmp + /bin/mount --move /real_rootfs/dev /dev + /bin/mount --move /real_rootfs/firmware /firmware + /bin/mount --move /real_rootfs/usrdata /usrdata + /bin/mount --move /real_rootfs/data /data + /bin/mount --move /real_rootfs/cache /cache + /bin/mount --move /real_rootfs/systemrw /systemrw + /bin/mount --move /real_rootfs/persist /persist + + + # Synchronize between /etc/rc.d and /real_rootfs/etc/rc.d + synchronize_rc_d "/etc/rc.d" "/real_rootfs/etc/rc.d" + + # Synchronize between /etc/rc.d and /usrdata/etc/rc.d + synchronize_rc_d "/etc/rc.d" "/usrdata/etc/rc.d" + + # Final logs and remount the original root as read-only + /bin/echo "...and we're back! The original root now lives at /real_rootfs" + /bin/echo "Lets mount it as read-only for now, If you need it just remount it as read-write" + /bin/mount -o remount,ro /real_rootfs >/dev/null 2>&1 + /bin/echo "Overlay and pivot_root setup completed" + +} + + +synchronize_rc_d() { + local source_dir="$1" + local target_dir="$2" + + /bin/echo "Synchronizing $source_dir with $target_dir" + for link in "$source_dir"/*; do + if [ -L "$link" ]; then + link_name=$(basename "$link") + if [ ! -e "$target_dir/$link_name" ]; then + /bin/echo "Copying $link_name to $target_dir" + cp -a "$link" "$target_dir/$link_name" + fi + fi + done + + for link in "$target_dir"/*; do + if [ -L "$link" ]; then + link_name=$(basename "$link") + if [ ! -e "$source_dir/$link_name" ]; then + /bin/echo "Removing $link_name from $target_dir" + rm "$target_dir/$link_name" + fi + fi + done } stop() { - /bin/echo "Stopping and reverting overlay and pivot_root" >> /tmp/mount-fix.log + # Initialize log + rm -f "$LOG_FILE" >/dev/null 2>&1 + touch "$LOG_FILE" + # Redirect all output (stdout and stderr) to the log file + exec >>"$LOG_FILE" 2>&1 + + # Check if /real_rootfs exists + if [ ! -d "/real_rootfs" ]; then + echo "Error: /real_rootfs does not exist. Cannot proceed with stop." >> "$LOG_FILE" + return 1 + fi + + # Determine firmware version based on mounts + if [ -d "/usrdata" ] && [ -d "/systemrw" ]; then + echo "New firmware scenario detected (with /usrdata and /systemrw)." >> "$LOG_FILE" + stop_handle_new_firmware + else + echo "Old firmware scenario detected (without /usrdata and /systemrw)." >> "$LOG_FILE" + stop_handle_old_firmware + fi +} + +stop_handle_new_firmware() { + # Redirect all output (stdout and stderr) to the log file + exec >>"$LOG_FILE" 2>&1 + /bin/echo "Stopping and reverting overlay and pivot_root" # Remount the original root filesystem as read-write - /bin/mount -o remount,rw /real_rootfs >> /tmp/mount-fix.log + /bin/mount -o remount,rw /real_rootfs # Move the mounted filesystems back to the original locations - /bin/mount --move /sys /real_rootfs/sys >> /tmp/mount-fix.log - /bin/mount --move /proc /real_rootfs/proc >> /tmp/mount-fix.log - /bin/mount --move /tmp /real_rootfs/tmp >> /tmp/mount-fix.log - /bin/mount --move /dev /real_rootfs/dev >> /tmp/mount-fix.log - /bin/mount --move /firmware /real_rootfs/firmware >> /tmp/mount-fix.log - /bin/mount --move /persist /real_rootfs/persist >> /tmp/mount-fix.log - /bin/mount --move /cache /real_rootfs/cache >> /tmp/mount-fix.log - /bin/mount --move /data /real_rootfs/data >> /tmp/mount-fix.log + /bin/mount --move /sys /real_rootfs/sys + /bin/mount --move /proc /real_rootfs/proc + /bin/mount --move /tmp /real_rootfs/tmp + /bin/mount --move /dev /real_rootfs/dev + /bin/mount --move /firmware /real_rootfs/firmware + /bin/mount --move /usrdata /real_rootfs/usrdata + /bin/mount --move /data /real_rootfs/data + /bin/mount --move /cache /real_rootfs/cache + /bin/mount --move /systemrw /real_rootfs/systemrw + /bin/mount --move /persist /real_rootfs/persist # Pivot root back to the original root - /sbin/pivot_root /real_rootfs /real_rootfs/rootfs >> /tmp/mount-fix.log + /sbin/pivot_root /real_rootfs /real_rootfs/rootfs - /bin/echo "Reverted pivot_root" >> /tmp/mount-fix.log - /bin/echo "Previous root overlay available at /rootfs" >> /tmp/mount-fix.log + /bin/echo "Reverted pivot_root" + + # Unmount /rootfs overlay + /bin/umount -lf /rootfs >/dev/null 2>&1 + + # Mount layer 2 /etc back + /bin/mount -t ubifs -o rw,relatime,bulk_read,assert=read-only,ubi=2,vol=0 /dev/ubi2_0 /etc + + # Mount layer 3 /etc back + /bin/mount -t overlay overlay -o lowerdir=/etc,upperdir=/usrdata/overlay-work/etc-upper,workdir=/usrdata/overlay-work/.etc-work /etc + df -h + echo -e "\e[31m / is read-write right now. Be careful\e[0m" + echo -e "\e[31m Reboot or run mount -o remount,ro / \e[0m" +} + +stop_handle_old_firmware() { + # Redirect all output (stdout and stderr) to the log file + exec >>"$LOG_FILE" 2>&1 + /bin/echo "Stopping and reverting overlay and pivot_root" + + # Remount the original root filesystem as read-write + /bin/mount -o remount,rw /real_rootfs + + # Move the mounted filesystems back to the original locations + /bin/mount --move /sys /real_rootfs/sys + /bin/mount --move /proc /real_rootfs/proc + /bin/mount --move /tmp /real_rootfs/tmp + /bin/mount --move /dev /real_rootfs/dev + /bin/mount --move /firmware /real_rootfs/firmware + /bin/mount --move /persist /real_rootfs/persist + /bin/mount --move /cache /real_rootfs/cache + /bin/mount --move /data /real_rootfs/data + + # Pivot root back to the original root + /sbin/pivot_root /real_rootfs /real_rootfs/rootfs + + /bin/echo "Reverted pivot_root" # Unmount /rootfs overlay /bin/umount -lf /rootfs >/dev/null 2>&1 @@ -132,7 +325,7 @@ stop() { mount -t ubifs /dev/ubi0_3 /overlay # Mount the old overlay filesystem back for etc - /bin/mount -t overlay overlay -o lowerdir=/etc,upperdir=/overlay/etc-upper,workdir=/overlay/.etc-work /etc >> /tmp/mount-fix.log + /bin/mount -t overlay overlay -o lowerdir=/etc,upperdir=/overlay/etc-upper,workdir=/overlay/.etc-work /etc echo -e "\e[31m / is read-write right now. Be careful\e[0m" echo -e "\e[31m Reboot or run mount -o remount,ro / \e[0m" diff --git a/ipk-source/sdxpinn-mount-fix/root/usr/bin/inotifywait b/ipk-source/sdxpinn-mount-fix/root/usr/bin/inotifywait old mode 100644 new mode 100755 diff --git a/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/inotifywait.postinst b/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/inotifywait.postinst old mode 100644 new mode 100755 diff --git a/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/inotifywait.prerm b/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/inotifywait.prerm old mode 100644 new mode 100755 diff --git a/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/libinotifytools.control b/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/libinotifytools.control old mode 100644 new mode 100755 diff --git a/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/libinotifytools.list b/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/libinotifytools.list old mode 100644 new mode 100755 diff --git a/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/libinotifytools.postinst b/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/libinotifytools.postinst old mode 100644 new mode 100755 diff --git a/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/libinotifytools.prerm b/ipk-source/sdxpinn-mount-fix/root/usr/lib/opkg/info/libinotifytools.prerm old mode 100644 new mode 100755 diff --git a/ipk-source/sdxpinn-mount-fix/root/usr/sbin/init-overlay-watchdog.sh b/ipk-source/sdxpinn-mount-fix/root/usr/sbin/init-overlay-watchdog.sh old mode 100644 new mode 100755 index 92a8d02..e1322c9 --- a/ipk-source/sdxpinn-mount-fix/root/usr/sbin/init-overlay-watchdog.sh +++ b/ipk-source/sdxpinn-mount-fix/root/usr/sbin/init-overlay-watchdog.sh @@ -2,33 +2,68 @@ # Paths to monitor and synchronize WATCH_DIR="/etc/rc.d" -TARGET_DIR="/real_rootfs/etc/rc.d" +TARGET_DIR1="/real_rootfs/etc/rc.d" +TARGET_DIR2="/usrdata/etc/rc.d" +LOG_FILE="/tmp/init-overlay-watchdog.log" # Function to synchronize init scripts synchronize_init_scripts() { + # Ensure /real_rootfs is writable for updates mount -o remount,rw /real_rootfs - # Copy new or updated symlinks from WATCH_DIR to TARGET_DIR + + # Synchronize with TARGET_DIR1 + echo "Synchronizing $WATCH_DIR with $TARGET_DIR1..." 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" + if [ ! -e "$TARGET_DIR1/$link_name" ] || [ "$link" -nt "$TARGET_DIR1/$link_name" ]; then + cp -af "$link" "$TARGET_DIR1/$link_name" fi fi done - # Remove symlinks in TARGET_DIR that no longer exist in WATCH_DIR - for link in "$TARGET_DIR"/*; do + for link in "$TARGET_DIR1"/*; do if [ -L "$link" ]; then link_name=$(basename "$link") if [ ! -e "$WATCH_DIR/$link_name" ]; then - rm -f "$TARGET_DIR/$link_name" + rm -f "$TARGET_DIR1/$link_name" fi fi done + + # Synchronize with TARGET_DIR2 if /usrdata exists + if [ -d "/usrdata" ]; then + echo "Synchronizing $WATCH_DIR with $TARGET_DIR2..." + for link in "$WATCH_DIR"/*; do + if [ -L "$link" ]; then + link_name=$(basename "$link") + if [ ! -e "$TARGET_DIR2/$link_name" ] || [ "$link" -nt "$TARGET_DIR2/$link_name" ]; then + cp -af "$link" "$TARGET_DIR2/$link_name" + fi + fi + done + + for link in "$TARGET_DIR2"/*; do + if [ -L "$link" ]; then + link_name=$(basename "$link") + if [ ! -e "$WATCH_DIR/$link_name" ]; then + rm -f "$TARGET_DIR2/$link_name" + fi + fi + done + fi + + # Restore /real_rootfs to read-only mount -o remount,ro /real_rootfs } +# Initialize log +rm -f "$LOG_FILE" >/dev/null 2>&1 +touch "$LOG_FILE" + +# Redirect all output (stdout and stderr) to the log file +exec >>"$LOG_FILE" 2>&1 + # Initial synchronization synchronize_init_scripts @@ -37,3 +72,4 @@ while true; do inotifywait -e create,delete,modify,move "$WATCH_DIR" synchronize_init_scripts done + diff --git a/opkg-feed/Packages b/opkg-feed/Packages index caf71b0..2704c29 100644 --- a/opkg-feed/Packages +++ b/opkg-feed/Packages @@ -55,14 +55,14 @@ License: GPLv3 Package: sdxpinn-mount-fix -Version: 1.1.0 +Version: 1.2.0 Depends: libc Section: base Architecture: aarch64_cortex-a53 Maintainer: iamromulan -MD5Sum: f8e8f830a7ba794d3d090c206df2b729 -Size: 29357 -Filename: sdxpinn-mount-fix_1.1.0_aarch64_cortex-a53.ipk +MD5Sum: 3f1279109adfba02bb7ca31026ec1c51 +Size: 55275 +Filename: sdxpinn-mount-fix_1.2.0_aarch64_cortex-a53.ipk Source: github/iamromulan Description: Creates a usable mount space and overlay for SDXPINN modems. Dependencies bundled: libinotifytools and inotifywait License: GPLv3 @@ -88,7 +88,7 @@ Depends: libc, tailscaled Section: net Architecture: aarch64_cortex-a53 Maintainer: Jan Pavlinec -MD5Sum: 44ee97f75f2a85ccf146b11ae1d906b1 +MD5Sum: bcf831b2c2cb9d32e6db3af2ea28610e Size: 9882827 Filename: tailscale_1.78.1-1_aarch64_cortex-a53.ipk Source: feeds/packages/net/tailscale diff --git a/opkg-feed/Packages.gz b/opkg-feed/Packages.gz index 785b2c9..a815786 100644 Binary files a/opkg-feed/Packages.gz and b/opkg-feed/Packages.gz differ diff --git a/opkg-feed/Packages.log b/opkg-feed/Packages.log index 6eb5209..884fc85 100644 --- a/opkg-feed/Packages.log +++ b/opkg-feed/Packages.log @@ -1,14 +1,15 @@ -Starting package analysis - Tue Dec 24 04:19:19 AM UTC 2024 +Starting package analysis - Sat Jan 11 02:06:48 AM EST 2025 No update needed for atinout (version 0.9.1, MD5: 6c8d3c910477e31940ee7740111a7fdf, size: 4226) No update needed for luci-app-atinout-mod (version 1.3.4-20241006, MD5: 2dac55de763333c37dd1728957fc8294, size: 4827) No update needed for ookla-speedtest (version 1.2.0, MD5: 2183f2df42a00380e761cace096e17c3, size: 1075762) No update needed for sdxpinn-console-menu (version 0.0.2, MD5: 42d2fd4c85b36a9c29e66092899080a4, size: 7365) -No update needed for sdxpinn-mount-fix (version 1.1.0, MD5: f8e8f830a7ba794d3d090c206df2b729, size: 29357) +Updating package info for sdxpinn-mount-fix... +Updated sdxpinn-mount-fix to version 1.2.0 with MD5: 3f1279109adfba02bb7ca31026ec1c51 and size: 55275 No update needed for sdxpinn-quecmanager (version 1.0.1, MD5: 142068c54af185e673b9e0ba0686b0f4, size: 715428) No update needed for sdxpinn-quecmanager-beta (version 1.1.0-2, MD5: 3411a804f72d4f275866cc93d3795643, size: 824527) -Updating package info for sms-tool... -Updated sms-tool to version 2024.07.25~fce2b931-r3 with MD5: 476cb439cf35180b228c3667e753680a and size: 9837 -No update needed for tailscale (version 1.78.1-1, MD5: 44ee97f75f2a85ccf146b11ae1d906b1, size: 9882827) +No update needed for sms-tool (version 2024.07.25~fce2b931-r3, MD5: 476cb439cf35180b228c3667e753680a, size: 9837) +Updating package info for tailscale... +Updated tailscale to version 1.78.1-1 with MD5: bcf831b2c2cb9d32e6db3af2ea28610e and size: 9882827 No update needed for tailscaled (version 1.78.1-1, MD5: 3a2eaf5f59c633379541d4e188a8c507, size: 17960526) Package file and signature updated successfully. -Package analysis completed - Tue Dec 24 04:19:20 AM UTC 2024 +Package analysis completed - Sat Jan 11 02:06:48 AM EST 2025 diff --git a/opkg-feed/Packages.sig b/opkg-feed/Packages.sig index b3a3a3e..549b673 100644 --- a/opkg-feed/Packages.sig +++ b/opkg-feed/Packages.sig @@ -1,2 +1,2 @@ untrusted comment: signed by key 6262698f038d1226 -RWRiYmmPA40SJktxOk6lFmG5MVm3DDhZQ71Fe0nBq0/l6oCQZtXduGo3/xt5MQTJmMWZ5XyE2zN0cRJNzYQUp1Oej2sXld1IBQU= +RWRiYmmPA40SJlY0ElPsA34J5wxYffh6aAOKWHUlZXrJFxC9I1dIPTO+IB931aA47rSrEyo8OU26cLnezwRhzg4LpKfy1cI+/wA= diff --git a/opkg-feed/sdxpinn-mount-fix_1.1.0_aarch64_cortex-a53.ipk b/opkg-feed/sdxpinn-mount-fix_1.1.0_aarch64_cortex-a53.ipk deleted file mode 100644 index 8c92c14..0000000 Binary files a/opkg-feed/sdxpinn-mount-fix_1.1.0_aarch64_cortex-a53.ipk and /dev/null differ diff --git a/opkg-feed/sdxpinn-mount-fix_1.2.0_aarch64_cortex-a53.ipk b/opkg-feed/sdxpinn-mount-fix_1.2.0_aarch64_cortex-a53.ipk new file mode 100644 index 0000000..5ef2cb6 Binary files /dev/null and b/opkg-feed/sdxpinn-mount-fix_1.2.0_aarch64_cortex-a53.ipk differ