aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/upgrade/stage2
Commit message (Collapse)AuthorAgeFilesLines
* base-files: change logging for upgrade on stage2Florian Eckert2021-06-201-4/+2
| | | | | | | Remove vn call in favour of v call. This commit serves as preparation for removing the vn function call. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* base-files: add syslog logging for v functionFlorian Eckert2021-06-201-1/+1
| | | | | | | | The logging output should not only be displayed in the calling shell session but also in the syslog. A sysupgrade and a configuration import, export can thus be traced in the syslog. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* busybox: disable bzip2Sergey Ponomarev2021-06-201-1/+1
| | | | | | | | | | bzip2 adds about 8kb of size. For tiny builds it's often disabled. It's not directly used by stock OpenWrt programs. Kernel images compressed with bzip2 are also not fully supported. Signed-off-by: Sergey Ponomarev <stokito@gmail.com> [fix \ indention] Signed-off-by: Paul Spooren <mail@aparcar.org>
* base-files: upgrade: use procd to kill managed daemonsMichael Pratt2021-06-121-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These processes are managed by procd and set to start again when killed via the procd instance parameter "respawn" being set during init. Example: procd_set_param respawn 3600 1 0 When they are killed manually during sysupgrade, they are started again in 5 seconds or less, depending on how the "respawn" parameter is set. Use procd through ubus to disable the instances that respawn them, however, allow dnsmasq, netifd, and logd to restart for remote logging. Properly closing all these processes increases free memory by about 3 MB, which should help low memory devices upgrade without crashing. For very low memory devices (set to 32 MB for now) also kill dnsmasq, netifd, and logd for an additional 3 MB of free memory. Also, bump sleep values to allow at least 10 seconds for network interfaces and daemons to come up after they are killed and restarted before caches are dropped. Signed-off-by: Michael Pratt <mcpratt@pm.me>
* base-files: upgrade: take down loop and LVM before upgradeDaniel Golle2021-05-051-0/+10
| | | | | | | | | | | | | | Users of devices with large block storage may choose to have an LVM partition on the same device which is used for booting OpenWrt. The presents a problem during sysupgrade as the root device is then still busy and changing partitions will not work as desired, leading to data corruption in case the newly flashed image is larger than the currently installed one. Having loop devices setup causes similar havoc. Make sure all volume groups are offline and all loop devices have been released before sysupgrade. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: flush kernel memory cache during sysupgradeHannu Nyman2020-12-221-0/+1
| | | | | | | | | | | Flush kernel memory caches during sysupgrade in order to mitigate the impact from memory consumption spikes in low-RAM devices. This may help to prevent sysupgrade causing a reboot before the actual flashing starts. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
* base-files: upgrade: stage2: use v for log linesYousong Zhou2020-11-111-7/+7
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* base-files: upgrade: log with date prefixYousong Zhou2020-11-111-1/+1
| | | | | | And log to stderr Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* treewide: replace `which` with `command -v`Paul Spooren2020-08-121-1/+1
| | | | | | | | | | | | | | | | | Fix shellcheck SC2230 > which is non-standard. Use builtin 'command -v' instead. Using `command -v` is POSIX compliant while `which` is not. Also to mention, `command -v` is a shell builtin whereas `which` is a separate busybox applet. Once applied to everything concerning OpenWrt we can disable the busybox feature `which` and save 3.8kB. Acked-by: Stijn Tintel <stijn@linux-ipv6.be> Signed-off-by: Paul Spooren <mail@aparcar.org> [also replace cases in zram-swap] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: switch_to_ramfs: add nand-utilsÁlvaro Fernández Rojas2020-05-181-1/+1
| | | | Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* base-files: add /usr/share/libubox/jshn.sh to sysupgrade stage2Russell Senior2019-11-131-1/+1
| | | | | | | | Discovered recent changes had broken sysupgrade for ar71xx mikrotik rb-493g, traced the problem to missing /usr/share/libubox/jshn.sh after switching to tmpfs. Signed-off-by: Russell Senior <russell@personaltelco.net>
* treewide: use new procd sysupgrade $UPGRADE_BACKUP variableRafał Miłecki2019-09-051-1/+0
| | | | | | | | | | It's a variable set by procd that should replace hardcoded /tmp/sysupgrade.tgz. This change requires the most recent procd with the commit 0f3c136 ("sysupgrade: set UPGRADE_BACKUP env variable"). Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* treewide: sysupgrade: pass "save_partitions" option to the "sysupgrade" methodRafał Miłecki2019-08-221-5/+0
| | | | | | | This explicitly lets stage2 know if partitions should be preserved. No more "touch /tmp/sysupgrade.always.overwrite.bootdisk.partmap" hack. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* base-files: pass "save_config" option to the "sysupgrade" methodRafał Miłecki2019-08-221-2/+0
| | | | | | This explicitly lets stage2 know if config should be preserved. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* base-files: don't set ARGV and ARGCRafał Miłecki2019-07-171-3/+0
| | | | | | Those are not used by any image check function anymore. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* base-files: move stage2 upgrade to separated fileRafał Miłecki2019-07-111-1/+1
| | | | | | | | | do_upgrade_stage2() isn't really any common code. It isn't used anywhere except for /sbin/sysupgrade that passes it to the stage2. Moving its code to separated file also simplifies COMMAND variable. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* base-files: drop support for NAND upgrade in platform_pre_upgrade()Rafał Miłecki2019-07-081-4/+1
| | | | | | | With bcm53xx switched to the new procedure there is no more need for keeping that backward compatibility code. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* treewide: consolidate upgrade state setMathias Kresin2018-08-161-0/+1
| | | | | | | | | | Set the (sys)upgrade state when sourcing the stage2 script instead of setting the state for each target individual. This change fixes the, due to a missing state set, not working upgrade led on ath79 and apm821xx. Signed-off-by: Mathias Kresin <dev@kresin.me>
* sysupgrade: don't kill our own parentMat Trudel2017-11-151-2/+3
| | | | | | | | Add the parent of the sysupgrade script to the list of pids not getting killed Signed-off-by: Mat Trudel <mat@geeky.net> Signed-off-by: John Crispin <john@phrozen.org>
* base-files: upgrade: don't loop forever trying to kill processesMatthias Schiffer2017-07-201-1/+10
| | | | | | | | | | When processes don't die on SIGKILL (usually because of kernel bugs), it's better to give up instead of looping forever. upgraded will trigger a reboot in this case (and if this fails, a hardware watchdog will eventually time out and reset the system, if present). Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* base-files: automatically handle paths and symlinks for RAMFS_COPY_BINMatthias Schiffer2017-07-111-26/+17
| | | | | | | | | | | | Depending on busybox applet selection, paths of basic utiilties may differ, and may not work as symlinks to busybox. Simply using whatever binary is found in PATH and detecting symlinks automatically is more robust and easier to maintain. The list of binaries is also slightly cleaned up and duplicates are removed. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* bcm53xx: upgrade: fix RAMFS_COPY_*Matthias Schiffer2017-07-111-1/+1
| | | | | Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade" Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* mvebu: fix sysupgradeMatthias Schiffer2017-06-011-1/+1
| | | | | | | | | | | | | | | | | mvebu was modifying RAMFS_COPY_BIN and RAMFS_COPY_DATA from a sysupgrade_pre_upgrade hook. As the ramfs is created from stage2, this did not have an effect anymore after the staged sysupgrade changes. As it doesn't really hurt to copy fw_printenv and fw_setenv unconditionally, simply add them in /lib/upgrade/platform.sh, so stage2 will see them. Config copying is moved to a function called by platform_copy_config, where it belongs. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> Fixes: FS#821 Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
* base-files: sysupgrade cleanupMatthias Schiffer2017-05-291-3/+102
| | | | | | | | | | | | Some functions only used by stage2 are moved there from common.sh. One piece that could still use more cleanup is platform_pre_upgrade: many targets reference files from there are aren't available in the ramfs, so we need to evaluate it before the switch; conversely, flash writes happen in that function on some targets. Targets that do the latter should be fixed eventually to use platform_do_upgrade for that purpose. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* base-files: always use staged sysupgradeMatthias Schiffer2017-05-291-0/+50
Support for the -d and -p options is dropped; it may be added again at some point by adding these flags to the ubus sysupgrade call. A downside of this is that we get a lot less information about the progress of the upgrade: as soon as the actual upgrade starts, all shell sessions are killed to allow unmounting the root filesystem. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>