openwrt / luci

LuCI - OpenWrt Configuration Interface
Apache License 2.0
6.21k stars 2.48k forks source link

add additional sysupgrade switches (-k -u) to Generate Archive button #5555

Open shoulders opened 2 years ago

shoulders commented 2 years ago

I would like the additional (-k -u) switches added to the Generate Archive option.

image

These options would allow me to create a backup config file without unmodified files to allow better compatibility when I do a manually upgrade or restore my settings to another router and make it much easier too re-install all of the missing required packages because they will be listed in /etc/backup/installed_packages.txt

grep "\toverlay" /etc/backup/installed_packages.txt | cut -f1 | xargs -r opkg install

I can imagine it will look similar to the Flash new firmware image

142461901-0df83eac-1433-4b78-9edb-38600e726dfc

Related: #5530 #4160

jospezial commented 2 years ago

@Ansuel @ynezz @rmilecki @aparcar @jow- @hnyman I am also interested in more options from sysupgrade in luci for "Generate Archive" I could make use of -u , -c and -o.

I could not find the file in luci source with the command sysupgrade -b or sysupgrade --create-backup

On the device:

grep -r create-backup /www/
/www/cgi-bin/cgi-backup:--create-backup
/www/cgi-bin/cgi-download:--create-backup
/www/cgi-bin/cgi-exec:--create-backup
/www/cgi-bin/cgi-upload:--create-backup
jospezial commented 2 years ago

See also: https://github.com/openwrt/openwrt/issues/9348

jospezial commented 2 years ago

@shoulders Another way is to modify /sbin/sysupgrade on the device (or package/base-files/files/sbin/sysupgrade in openwrt source)

# initialize defaults
export MTD_ARGS=""
export MTD_CONFIG_ARGS=""
export INTERACTIVE=0
export VERBOSE=1
export SAVE_CONFIG=1
export SAVE_OVERLAY=0
export SAVE_OVERLAY_PATH=
export SAVE_PARTITIONS=1
export SAVE_INSTALLED_PKGS=0
export SKIP_UNCHANGED=0
export CONF_IMAGE=
export CONF_BACKUP_LIST=0
export CONF_BACKUP=
export CONF_RESTORE=
export NEED_IMAGE=
export HELP=0
export FORCE=0
export TEST=0
export UMOUNT_ETCBACKUP_DIR=0

After editing export SKIP_UNCHANGED=0 to export SKIP_UNCHANGED=1 "Generate Archive" does skip from backup files that are equal to those in /rom. Edit also export SAVE_INSTALLED_PKGS=0 to export SAVE_INSTALLED_PKGS=1

If you want to backup the script too then you have to add /sbin/sysupgrade into /etc/sysupgrade.conf because even -o does not catch it. But beware of that the sysupgrade script then never gets updates if you always restore it.

Ansuel commented 2 years ago

What I still didn't understand is if these options are available from CMD Or we should add supporto for them in sysupgrade first.

Il Dom 27 Feb 2022, 02:18 jospezial @.***> ha scritto:

@shoulders https://github.com/shoulders Another way is to modify /sbin/sysupgrade on the device (or package/base-files/files/sbin/sysupgrade in openwrt source)

initialize defaults

export MTD_ARGS="" export MTD_CONFIG_ARGS="" export INTERACTIVE=0 export VERBOSE=1 export SAVE_CONFIG=1 export SAVE_OVERLAY=0 export SAVE_OVERLAY_PATH= export SAVE_PARTITIONS=1 export SAVE_INSTALLED_PKGS=0 export SKIP_UNCHANGED=0 export CONF_IMAGE= export CONF_BACKUP_LIST=0 export CONF_BACKUP= export CONF_RESTORE= export NEED_IMAGE= export HELP=0 export FORCE=0 export TEST=0 export UMOUNT_ETCBACKUP_DIR=0

After editing export SKIP_UNCHANGED=0 to export SKIP_UNCHANGED=1 "Generate Archive" does skip from backup files that are equal to those in /rom. Edit also export SAVE_INSTALLED_PKGS=0 to export SAVE_INSTALLED_PKGS=1

If you want to backup the script too then you have to add /sbin/sysupgrade into /etc/sysupgrade.conf because even -o does not catch it. But beware of that the sysupgrade script then never gets updates if you always restore it.

— Reply to this email directly, view it on GitHub https://github.com/openwrt/luci/issues/5555#issuecomment-1052899601, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2ZMQUXBLVDMDY5XRYRNKDU5F3XHANCNFSM5I37OC7A . You are receiving this because you were mentioned.Message ID: @.***>

luizluca commented 2 years ago

Luci could offer all sysupgrade backup flags (-k -u -o -c) to the user as options independently from any sysupgrade behavior changes. However, it is still valid to question if the default sysupgrade behavior should change.

The '-k' flag could easily become the default behavior for sysupgrade as it simply adds a file. The '-u' flag skips those files the user never touched. I believe it will avoid more breaks than it could cause (like avoiding to propagate old /etc/profile to new versions). I believe it should be default but someone might argue it is "removing" something from the backup. If they become default, they might be replaced by a negative flag (-K, -U) that will revert them. An they should also be exposed to the luci user.