[PATCH v2] base-files: restore status of system-services after sysupgrade

Adrian Schmutzler mail at adrianschmutzler.de
Tue Jan 12 07:01:45 EST 2021


> > @@ -231,8 +235,7 @@ do_save_conffiles() {
> >   	run_hooks "$CONFFILES" $sysupgrade_init_conffiles
> >   	ask_bool 0 "Edit config file list" && vi "$CONFFILES"
> >
> > -	if [ "$SAVE_INSTALLED_PKGS" -eq 1 ]; then
> > -		echo "${INSTALLED_PACKAGES}" >> "$CONFFILES"
> > +	if [ "$SAVE_INSTALLED_PKGS" -eq 1 ] || [ "$SAVE_SERVICE_STATUS"
> -eq
> > +1 ]; then
> >   		mkdir -p "$ETCBACKUP_DIR"
> >   		# Avoid touching filesystem on each backup
> >   		RAMFS="$(mktemp -d -t sysupgrade.XXXXXX)"
> > @@ -243,13 +246,28 @@ do_save_conffiles() {
> >   				ask_bool 0 "Abort" && exit
> >   			}
> >
> > -		# Format: pkg-name<TAB>{rom,overlay,unkown}
> > -		# rom is used for pkgs in /rom, even if updated later
> > -		find /usr/lib/opkg/info -name "*.control" \( \
> > -			\( -exec test -f /rom/{} \; -exec echo {} rom \; \) -o \
> > -			\( -exec test -f /overlay/upper/{} \; -exec echo {}
> overlay \; \) -o \
> > -			\( -exec echo {} unknown \; \) \
> > -			\) | sed -e 's,.*/,,;s/\.control /\t/' >
> ${INSTALLED_PACKAGES}
> > +		if [ "$SAVE_INSTALLED_PKGS" -eq 1 ]; then
> > +			echo "${INSTALLED_PACKAGES}" >> "$CONFFILES"
> > +			# Format: pkg-name<TAB>{rom,overlay,unkown}
> > +			# rom is used for pkgs in /rom, even if updated later
> > +			find /usr/lib/opkg/info -name "*.control" \( \
> > +				\( -exec test -f /rom/{} \; -exec echo {} rom \;
> \) -o \
> > +				\( -exec test -f /overlay/upper/{} \; -exec
> echo {} overlay \; \) -o \
> > +				\( -exec echo {} unknown \; \) \
> > +					\) | sed -e 's,.*/,,;s/\.control /\t/' >
> ${INSTALLED_PACKAGES}
> > +		fi
> > +
> > +		if [ "$SAVE_SERVICE_STATUS" -eq 1 ]; then
> > +			echo "${SERVICE_STATUS}" >> "$CONFFILES"
> > +			# Format: /etc/init.d/servicename {enable,disable}
> > +			rm -f ${SERVICE_STATUS}
> > +			for service in /etc/init.d/* ; do \
> > +				${service} enabled && \
> > +					echo >> ${SERVICE_STATUS}
> "$service" "enable" || \
> > +					echo >> ${SERVICE_STATUS}
> "$service" "disable" \
> > +				; \
> > +			done
> > +		fi
> >   	fi
> >
> >   	v "Saving config files..."
> Hello,
> You don't have to run such complicated script. Just restore /etc/rc.d/
> directory after upgrade.
> 

Well, that depends on how we want to deal with new services. If I upgrade from 19.07.5 to master, I'd expect new services to be in their default initial state. Restoring "old" rc.d would have everything new disabled. That's counter-intuitive for me.

Best

Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20210112/6c0cd412/attachment.sig>


More information about the openwrt-devel mailing list