mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
iop upgrade: add -r option to jump into a chroot of other system.
useful for developing testing upgrade configuration migration.
This commit is contained in:
parent
4fa352c5fc
commit
27800f2100
2 changed files with 51 additions and 11 deletions
|
|
@ -109,6 +109,19 @@ function umount_newroot {
|
||||||
umount /tmp/newroot
|
umount /tmp/newroot
|
||||||
run_mount_cleanup=0
|
run_mount_cleanup=0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo "usage: $0 iopu [opts] "
|
||||||
|
echo ""
|
||||||
|
echo "opts:"
|
||||||
|
echo ""
|
||||||
|
echo " -n Do not do the final reboot of the target board"
|
||||||
|
echo " -c Keep configuration"
|
||||||
|
echo " -x Force install even if firmware is not for this board"
|
||||||
|
echo " -b Force install of bootloader regardless of version installed"
|
||||||
|
echo " -r Jump into chroot env of other system"
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# just one instance
|
# just one instance
|
||||||
|
|
@ -124,6 +137,26 @@ trap finish EXIT
|
||||||
trap timeout SIGALRM
|
trap timeout SIGALRM
|
||||||
trap sig_pipe SIGPIPE
|
trap sig_pipe SIGPIPE
|
||||||
|
|
||||||
|
while getopts "nr" opt; do
|
||||||
|
case $opt in
|
||||||
|
n)
|
||||||
|
upd_noreboot=1
|
||||||
|
;;
|
||||||
|
r)
|
||||||
|
upd_vol=$(get_flashbank_next)
|
||||||
|
mount_newroot
|
||||||
|
(ENV=/sbin/iopu_chroot_env chroot /tmp/newroot_overlay /bin/sh)
|
||||||
|
echo ""
|
||||||
|
umount_newroot
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
h)
|
||||||
|
upd_usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# put a timeout on this if it takes longer than 120 seconds we should abort and clean up
|
# put a timeout on this if it takes longer than 120 seconds we should abort and clean up
|
||||||
(
|
(
|
||||||
sleep 120 # if 2 minutes pass
|
sleep 120 # if 2 minutes pass
|
||||||
|
|
@ -131,17 +164,6 @@ kill -ALRM $$ 2>/dev/null # send it a SIGALRM signal
|
||||||
)&
|
)&
|
||||||
TIMEOUT_PID=$!
|
TIMEOUT_PID=$!
|
||||||
|
|
||||||
|
|
||||||
while getopts "n" opt; do
|
|
||||||
case $opt in
|
|
||||||
n)
|
|
||||||
upd_noreboot=1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
log "Firmware upgrade started"
|
log "Firmware upgrade started"
|
||||||
|
|
||||||
#find out board name
|
#find out board name
|
||||||
|
|
|
||||||
18
iopupgrade/files/sbin/iopu_chroot_env
Executable file
18
iopupgrade/files/sbin/iopu_chroot_env
Executable file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# this is run when "iopr -r" is executed.
|
||||||
|
# intended to just show what environment is actually started.
|
||||||
|
|
||||||
|
cat /etc/banner
|
||||||
|
|
||||||
|
echo "/tmp/oldroot:"
|
||||||
|
echo " Contains the running root filesystem. It is live so files are in use"
|
||||||
|
echo " Anything copying/reading files from there needs to make sure it is done safely."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
Color_Off='\033[0m' # Text Reset
|
||||||
|
Red='\033[0;31m' # Red
|
||||||
|
|
||||||
|
PS1="${Red}chroot_new${Color_Off}:\w\#"
|
||||||
|
export PS1
|
||||||
|
export Red
|
||||||
|
export Color_Off
|
||||||
Loading…
Add table
Reference in a new issue