Commit Graph

53 Commits (a5428244d969fda2b32e24b7cda589c2c65cbf7c)

Author SHA1 Message Date
Matthias Schiffer a5428244d9
base-files: add support for staged sysupgrades from failsafe mode
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
7 years ago
Matthias Schiffer b2adb9a7b5
base-files: sysupgrade cleanup
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>
7 years ago
Matthias Schiffer 30f61a34b4
base-files: always use staged sysupgrade
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>
7 years ago
Jo-Philipp Wich 361c8b4ee4 Revert "sysupgrade: run only one instance at a time."
This reverts commit e96a9a9af8.

The change breaks sysupgrade through LuCI and two-stage sysupgrade on
NAND targets. There is also a mismatch of file paths in lock and unlock
operations.

This commit was apparently neither properly tested, nor reviewed, so
drop it for now.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Kenneth Johansson e96a9a9af8 sysupgrade: run only one instance at a time.
Things do not work well if running multiple instances of
upgrade at the same time.

Signed-off-by: Kenneth Johansson <kenneth.johansson@inteno.se>
7 years ago
Felix Fietkau cc853810a4 base-files: validate metadata of sysupgrade images
Use fwtool to extract it, only require metadata to be present if the
platform sysupgrade script sets REQUIRE_IMAGE_METADATA=1

Image metadata is in JSON format and contains a list of supported
devices, along with version information that could be displayed by a UI
later before the actual upgrade happens.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Jo-Philipp Wich 4aeeead303 x86: preserve partition table on sysupgrade
With this patch sysupgrade will write directly to the partitions
instead of to the main disk.  The UUID is copied from the image
to the MBR as well.  This prevents the mbr from being completely
overwritten and losing the partition table.  The -p option has
been added to maintain the original behavior and overwite the
entire disk with the new image.  Tests have been added to ensure
that the image partitions match up with the active partitions.

Signed-off-by: Rob Mosher <nyt-openwrt@countercultured.net>

SVN-Revision: 48682
8 years ago
Jo-Philipp Wich 740a2ee163 base-files: Fix sysupgrade overlay saving
A previous change to sysupgrade moved the overlay files into upper/
The -c switch generates a list of files to backup, but the sed
calls did not take this into consideration.

Signed-off-by: Rob Mosher <nyt-openwrt@countercultured.net>

SVN-Revision: 48281
8 years ago
John Crispin 5d8f9e03f1 base-files: add support for platform_pre_upgrade function
Current NAND sysupgrade process is a bit hard to follow due to the way
of triggering stage1. Currently this is done by leaving a /mark/ in the
form of /tmp/sysupgrade-nand-path during nand_do_platform_check.
Existence of this mark stops standard sysupgrade process (as the result
of sysupgrade_pre_upgrade exit). This may be a bit misleading.

Proposed solution adds a new function that will allow platform.sh
trigger NAND sysupgrade consciously. This will also allow cleaning
nand_do_platform_check limiting it to just checking the image.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45338
9 years ago
Imre Kaloz 2e3b84c3b5 fix sysupgrade on overlayfs v23+
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>

SVN-Revision: 43365
10 years ago
John Crispin 7860c9707a sysupgrade: preserve symlinks in backups
Signed-off-by: Catalin Patulea <catalinp@google.com>

SVN-Revision: 42783
10 years ago
John Crispin 3dca5a158d procd: various cleanups to /lib/upgrade/nand.sh
Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 41222
10 years ago
John Crispin c43d614f89 base-files: add an ugly hack for nand to sysupgrade
Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 41126
10 years ago
Felix Fietkau 4a9ea80ef0 /lib/functions.sh: move rarely used mtd and macaddr related functions to /lib/functions/system.sh
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 40411
10 years ago
John Crispin f18112883f sysupgrade: do not kill any processes in failsafe
sysugrade killed the lock causing failsafe to stop

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>

SVN-Revision: 39318
11 years ago
Luka Perkov 3ceb6b3274 base-files: fix whitespaces
Signed-off-by: Luka Perkov <luka@openwrt.org>

SVN-Revision: 39006
11 years ago
Felix Fietkau ff17114ba1 ar71xx: Unifi AP Pro sysupgrade patch
The current implementation of mtd will not append the backup
file created by sysupgrade to the correct partition, as mtd will append
the data to first jffs2 partition it finds. As the kernel is also
stored on a jffs2 partition (which resides before the overlay
partition), the data will be appended to this partition.

To fix this problem, a new option

-s <number>             skip the first n bytes when appending data to the jffs2 partiton, defaults to "0"

is added to mtd.

Signed-off-by: Peter Wagner <tripolar@gmx.at>

SVN-Revision: 38807
11 years ago
Jo-Philipp Wich b7f8f212ae base-files: implement -l (--list-backup) sysupgrade parameter to list the files that would be backed up
SVN-Revision: 37627
11 years ago
Jo-Philipp Wich 2a1ccf1830 base-files: abort sysupgrade if file specified with --restore-config is not found
SVN-Revision: 37624
11 years ago
Jo-Philipp Wich 2771edf647 base-files: implement -T (--test) sysupgrade parameter to verify image without actually flashing it
SVN-Revision: 37620
11 years ago
John Crispin 1f52c5a72c sysupgrade: create state file so procd knows when a sysupgrade is in progress
Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 36893
11 years ago
John Crispin 811d90ff40 mount_root: prepare base-files
Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 36429
11 years ago
Jo-Philipp Wich 70b0ef6322 sysupgrade: clarify online help
Fixes #12346.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>

SVN-Revision: 34975
12 years ago
Jo-Philipp Wich 58070b0083 sysupgrade: do not require an extra argument after --restore-backup
Neither --create-backup nor --restore-backup need an image name (following
the backup filename). Treat them in uniform way.

Mostly fixes #12346.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>

SVN-Revision: 34974
12 years ago
Jo-Philipp Wich 70aaa116eb base-files: provide a sysupgrade -r (--restore-backup) option as convenience wrapper for tar -C / -x(v)zf
SVN-Revision: 33147
12 years ago
Jo-Philipp Wich 17dc1d5c44 base-files: fix option parsing of -F/--force parameter
SVN-Revision: 33075
12 years ago
Jo-Philipp Wich 9ae901445b /etc/functions.sh => /lib/functions.sh
SVN-Revision: 32062
12 years ago
Jo-Philipp Wich 4e88bcfb00 base-files: implement a --force option for sysupgrade to override image checks, useful to upgrade old ar71xx installations to current trunk ones
SVN-Revision: 29688
13 years ago
Jo-Philipp Wich 1c6821b42e base-files: add -b (--create-backup) option to sysupgrade, which generates a backup .tar.gz according to the user settings. This will also be reused by LuCI.
SVN-Revision: 29587
13 years ago
Jo-Philipp Wich d46e17548b base-files: kill remaining processes after running user hooks (#10461)
SVN-Revision: 29256
13 years ago
Jo-Philipp Wich 52e93e54bc base-files: sysupgrade: kill all but essential processes before starting the update
SVN-Revision: 28626
13 years ago
Jo-Philipp Wich 1e34c02e3e base-files: add -h and --help options to sysupgrade (#9728)
SVN-Revision: 27630
13 years ago
Jo-Philipp Wich d80f82d7a4 base-files: - add sysupgrade support for keepfile hints * introduces /lib/upgrade/keep.d/ for per-package keepfile lists * introduces /etc/sysupgrade.conf for user defined keepfile hints - prime /lib/upgrade/keep.d/base-files-essential to keep sysupgrade usable for images without opkg - change sysupgrade to build the keepfile list from /lib/upgrade/keep.d/, /etc/sysupgrade.conf and opkg list-changed-conffiles
SVN-Revision: 23258
14 years ago
Jo-Philipp Wich 978ecae685 base-files: sysupgrade: merge info from "opkg list-changed-conffiles" to backup file list
SVN-Revision: 23233
14 years ago
Jo-Philipp Wich 91118a9500 base-files: add an experimental "-c" flag which tries to preserve *all* changed files in /overlay/etc minus some system files
SVN-Revision: 22977
14 years ago
Travis Kemen 32f6e6c44d revert r19964 for now, there are issues with opkg/ipkg.py generating the status db
SVN-Revision: 19970
14 years ago
Travis Kemen 249d48a68e grab all config files for installed packages, closes #3718
SVN-Revision: 19964
14 years ago
Jo-Philipp Wich 4d9b1d6c75 base-files: sysupgrade: restrict find command to plain files to avoid duplicates when generating the conffiles tgz archive
SVN-Revision: 18455
15 years ago
Jo-Philipp Wich 8962270fec base-files: add /etc/rc.local to the default save file list
SVN-Revision: 17572
15 years ago
Vasilis Tsiligiannis baa9053e7a base-files: Fix sysupgrade .tar.gz configuration restoring
SVN-Revision: 16626
15 years ago
Vasilis Tsiligiannis 57d7cc7666 base-files: Detect and decompressed gzipped images automatically when flashing with sysupgrade
SVN-Revision: 16407
15 years ago
Nicolas Thill 06413b783e base-files: initialize GZIPED to 0 in sysupgrade since it's used later in numeric comparisons
SVN-Revision: 15890
15 years ago
Jo-Philipp Wich 7da25b844c Don't try to pivot to new ramfs if already running on one This patch allows the sysupgrade script to continue with the upgrade if openwrt is already running on a ramfs. This allows the use of the sysupgrade script as an _installer_ when running from an iso image. A user could boot the system from a bootable cd and invoke sysupgrade -n <URL> to write an image to the hard disk or CF.
Signed-off-by: Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr>

SVN-Revision: 15683
15 years ago
Jo-Philipp Wich 71e0f59b80 Add option in sysupgrade to flash gzipped images
SVN-Revision: 15672
15 years ago
Felix Fietkau 2b2884293a add option in sysupgrade to restore config from file or URL (patch from #4043)
SVN-Revision: 12772
16 years ago
Felix Fietkau e2daafdb1d fix typo from last sysupgrade commit
SVN-Revision: 12715
16 years ago
Travis Kemen 3770c99cf8 add switch to not save configuration over the reflash in noninteractive mode
SVN-Revision: 12714
16 years ago
Felix Fietkau 22585e578b sysupgrade: add optional delay before rebooting
SVN-Revision: 12572
16 years ago
Travis Kemen b3b5e54099 add /etc/firewall.user to be backed up becuase it is an example in /etc/config/firewall
SVN-Revision: 12326
16 years ago
Travis Kemen 0b2111d1fb remove /etc/firewall.* from being kept as they no longer are used in trunk
SVN-Revision: 12320
16 years ago