Fix mount-fix issue
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
Package: sdxpinn-mount-fix
|
||||
Version: 1.3.1
|
||||
Version: 1.3.2
|
||||
Architecture: aarch64_cortex-a53
|
||||
Maintainer: Cameron Thompson iamromulan@github.com
|
||||
Source: github.com/iamromulan
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
#!/bin/ash
|
||||
|
||||
# Enable and start the services
|
||||
echo "Starting services..."
|
||||
echo "Starting and enabling services..."
|
||||
service mount-fix enable
|
||||
service mount-fix-final enable
|
||||
|
||||
if grep -qs '/usrdata' /proc/mounts; then
|
||||
echo "/usrdata is mounted. Enabling at /usrdata..."
|
||||
cp -P /etc/rc.d/S03mount-fix /usrdata/etc/rc.d/S03mount-fix
|
||||
rm /usrdata/overlay-work/etc-upper/rc.d/S03mount-fix
|
||||
cp -P /etc/rc.d/S03mount-fix /usrdata/overlay-work/etc-upper/rc.d/S03mount-fix
|
||||
cp -P /etc/rc.d/S04mount-fix-final /usrdata/etc/rc.d/S04mount-fix-final
|
||||
rm /usrdata/overlay-work/etc-upper/rc.d/S04mount-fix-final
|
||||
cp -P /etc/rc.d/S04mount-fix-final /usrdata/overlay-work/etc-upper/rc.d/S04mount-fix-final
|
||||
fi
|
||||
|
||||
service mount-fix start
|
||||
service mount-fix enable
|
||||
service mount-fix-final enable
|
||||
|
||||
echo -e "\e[32m sdxpinn-mount-fix installed! Here is the new file structure! \e[0m"
|
||||
echo -e "\e[32m ============================================================ \e[0m"
|
||||
|
||||
@@ -33,6 +33,8 @@ stop_handle_new_firmware() {
|
||||
/bin/echo "Stopping and reverting overlay and pivot_root"
|
||||
service init-overlay-watchdog stop
|
||||
service init-overlay-watchdog disable
|
||||
# Unmount /etc/rc.d bind
|
||||
/bin/umount -lf /etc/rc.d
|
||||
# Remount the original root filesystem as read-write
|
||||
/bin/mount -o remount,rw /real_rootfs
|
||||
|
||||
@@ -73,6 +75,10 @@ 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"
|
||||
service init-overlay-watchdog stop
|
||||
service init-overlay-watchdog disable
|
||||
# Unmount /etc/rc.d bind
|
||||
/bin/umount -lf /etc/rc.d
|
||||
|
||||
# Remount the original root filesystem as read-write
|
||||
/bin/mount -o remount,rw /real_rootfs
|
||||
@@ -110,7 +116,6 @@ if grep -qs '/real_rootfs' /proc/mounts; then
|
||||
echo "Upgrade scenario detected."
|
||||
mount_factory
|
||||
service mount-fix disable
|
||||
rm /usrdata/etc/rc.d/S03mount-fix
|
||||
echo "Filesystem structure returned to Quectel Stock"
|
||||
echo "Backup exists at /usrdata/rootfs or /data/rootfs"
|
||||
fi
|
||||
@@ -131,4 +136,8 @@ if grep -qs '/usrdata' /proc/mounts; then
|
||||
umount -lf /etc
|
||||
fi
|
||||
|
||||
echo "Preinst complete...."
|
||||
echo "View Results here:..."
|
||||
mount
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -97,13 +97,9 @@ handle_old_firmware() {
|
||||
/bin/mount --move /real_rootfs/persist /persist
|
||||
/bin/mount --move /real_rootfs/cache /cache
|
||||
/bin/mount --move /real_rootfs/data /data
|
||||
|
||||
# Synchronize rc.d
|
||||
synchronize_rc_d "/real_rootfs/etc/rc.d" "/etc/rc.d"
|
||||
|
||||
# Bind the orignal rc.d back and make writable
|
||||
/bin/mount -o bind,rw /real_rootfs/etc/rc.d /etc/rc.d
|
||||
/bin/mount -o remount,rw /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"
|
||||
@@ -195,16 +191,9 @@ handle_new_firmware() {
|
||||
/bin/mount --move /real_rootfs/cache /cache
|
||||
/bin/mount --move /real_rootfs/systemrw /systemrw
|
||||
/bin/mount --move /real_rootfs/persist /persist
|
||||
|
||||
# Synchronize between rc.d layer 1 to Final
|
||||
synchronize_rc_d "/real_rootfs/etc/rc.d" "/etc/rc.d"
|
||||
|
||||
# Synchronize between rc.d layer 2 to Final
|
||||
synchronize_rc_d "/usrdata/etc/rc.d" "/etc/rc.d"
|
||||
|
||||
# Bind the orignal rc.d back and make writable
|
||||
# Bind the orignal rc.d back
|
||||
/bin/mount -o bind,rw /real_rootfs/etc/rc.d /etc/rc.d
|
||||
/bin/mount -o remount,rw /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"
|
||||
@@ -214,31 +203,6 @@ handle_new_firmware() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
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 "Copying $link_name to $source_dir"
|
||||
cp -a "$link" "$source_dir/$link_name"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
stop() {
|
||||
# Initialize log
|
||||
rm -f "$LOG_FILE" >/dev/null 2>&1
|
||||
@@ -266,7 +230,10 @@ 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"
|
||||
|
||||
|
||||
# Unmount /etc/rc.d bind
|
||||
/bin/umount -lf /etc/rc.d
|
||||
|
||||
# Remount the original root filesystem as read-write
|
||||
/bin/mount -o remount,rw /real_rootfs
|
||||
|
||||
@@ -304,6 +271,9 @@ 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"
|
||||
|
||||
# Unmount /etc/rc.d bind
|
||||
/bin/umount -lf /etc/rc.d
|
||||
|
||||
# Remount the original root filesystem as read-write
|
||||
/bin/mount -o remount,rw /real_rootfs
|
||||
|
||||
18
ipk-source/sdxpinn-mount-fix/root/etc/init.d/mount-fix-final
Executable file
18
ipk-source/sdxpinn-mount-fix/root/etc/init.d/mount-fix-final
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=04
|
||||
|
||||
start() {
|
||||
# mount the bind mount as rw
|
||||
/bin/mount -o remount,rw /etc/rc.d
|
||||
}
|
||||
|
||||
stop() {
|
||||
# mount the bind mount as ro
|
||||
/bin/mount -o remount,ro /etc/rc.d
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
@@ -97,13 +97,9 @@ handle_old_firmware() {
|
||||
/bin/mount --move /real_rootfs/persist /persist
|
||||
/bin/mount --move /real_rootfs/cache /cache
|
||||
/bin/mount --move /real_rootfs/data /data
|
||||
|
||||
# Synchronize rc.d
|
||||
synchronize_rc_d "/real_rootfs/etc/rc.d" "/etc/rc.d"
|
||||
|
||||
# Bind the orignal rc.d back and make writable
|
||||
/bin/mount -o bind,rw /real_rootfs/etc/rc.d /etc/rc.d
|
||||
/bin/mount -o remount,rw /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"
|
||||
@@ -195,16 +191,9 @@ handle_new_firmware() {
|
||||
/bin/mount --move /real_rootfs/cache /cache
|
||||
/bin/mount --move /real_rootfs/systemrw /systemrw
|
||||
/bin/mount --move /real_rootfs/persist /persist
|
||||
|
||||
# Synchronize between rc.d layer 1 to Final
|
||||
synchronize_rc_d "/real_rootfs/etc/rc.d" "/etc/rc.d"
|
||||
|
||||
# Synchronize between rc.d layer 2 to Final
|
||||
synchronize_rc_d "/usrdata/etc/rc.d" "/etc/rc.d"
|
||||
|
||||
# Bind the orignal rc.d back and make writable
|
||||
# Bind the orignal rc.d back
|
||||
/bin/mount -o bind,rw /real_rootfs/etc/rc.d /etc/rc.d
|
||||
/bin/mount -o remount,rw /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"
|
||||
@@ -214,31 +203,6 @@ handle_new_firmware() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
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 "Copying $link_name to $source_dir"
|
||||
cp -a "$link" "$source_dir/$link_name"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
stop() {
|
||||
# Initialize log
|
||||
rm -f "$LOG_FILE" >/dev/null 2>&1
|
||||
@@ -266,7 +230,10 @@ 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"
|
||||
|
||||
|
||||
# Unmount /etc/rc.d bind
|
||||
/bin/umount -lf /etc/rc.d
|
||||
|
||||
# Remount the original root filesystem as read-write
|
||||
/bin/mount -o remount,rw /real_rootfs
|
||||
|
||||
@@ -304,6 +271,9 @@ 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"
|
||||
|
||||
# Unmount /etc/rc.d bind
|
||||
/bin/umount -lf /etc/rc.d
|
||||
|
||||
# Remount the original root filesystem as read-write
|
||||
/bin/mount -o remount,rw /real_rootfs
|
||||
|
||||
18
ipk-source/sdxpinn-mount-fix/root/usrdata/etc/init.d/mount-fix-final
Executable file
18
ipk-source/sdxpinn-mount-fix/root/usrdata/etc/init.d/mount-fix-final
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=04
|
||||
|
||||
start() {
|
||||
# mount the bind mount as rw
|
||||
/bin/mount -o remount,rw /etc/rc.d
|
||||
}
|
||||
|
||||
stop() {
|
||||
# mount the bind mount as ro
|
||||
/bin/mount -o remount,ro /etc/rc.d
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
Reference in New Issue
Block a user