[PATCH] base-files: sysupgrade: store status of system-services

Andre Heider a.heider at gmail.com
Sun Jan 10 03:47:27 EST 2021


On 10/01/2021 02:37, Alberto Bursi wrote:
> 
> 
> On 09/01/21 12:28, Stijn Segers wrote:
>> Hi,
>>
>> Op zondag 3 januari 2021 om 23u14 schreef Sven Roederer 
>> <devel-sven at geroedel.de>:
>>> When saving the list of installed pkgs, also store the status of the
>>> system services. The list is created in the etc/backup folder also
>>> and formated as:
>>>
>>> /etc/init.d/<service> {enable|disable}
>>>
>>> This way it can be sourced after sysupgrade, to restore the previous
>>> state.
>>>
>>> Signed-off-by: Sven Roederer <devel-sven at geroedel.de>
>>> ---
>>>
>>> Currently all services get enabled during image creation. This can cause
>>> issues after upgrade with services explicitly disabled by the user.
>>> With this created list sourced by a simple uci-defaults script the state
>>> can be restored automatically.
>>> Not including such a uci-defaults script by default, as currently the
>>> stored package list is also not reinstalled.
>>>
>>>
>>>  package/base-files/Makefile              |  2 +-
>>>  package/base-files/files/sbin/sysupgrade | 11 +++++++++++
>>>  2 files changed, 12 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/package/base-files/Makefile b/package/base-files/Makefile
>>> index 0c612b73ca..fbcb694592 100644
>>> --- a/package/base-files/Makefile
>>> +++ b/package/base-files/Makefile
>>> @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
>>>  include $(INCLUDE_DIR)/feeds.mk
>>>
>>>  PKG_NAME:=base-files
>>> -PKG_RELEASE:=239
>>> +PKG_RELEASE:=240
>>>  PKG_FLAGS:=nonshared
>>>
>>>  PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
>>> diff --git a/package/base-files/files/sbin/sysupgrade 
>>> b/package/base-files/files/sbin/sysupgrade
>>> index 79927a2b5c..cadce36172 100755
>>> --- a/package/base-files/files/sbin/sysupgrade
>>> +++ b/package/base-files/files/sbin/sysupgrade
>>> @@ -57,6 +57,7 @@ export CONFFILES=/tmp/sysupgrade.conffiles
>>>  export CONF_TAR=/tmp/sysupgrade.tgz
>>>  export ETCBACKUP_DIR=/etc/backup
>>>  export INSTALLED_PACKAGES=${ETCBACKUP_DIR}/installed_packages.txt
>>> +export SERVICE_STATUS=${ETCBACKUP_DIR}/service_status.txt
>>>
>>>  IMAGE="$1"
>>>
>>> @@ -228,6 +229,7 @@ do_save_conffiles() {
>>>
>>>      if [ "$SAVE_INSTALLED_PKGS" -eq 1 ]; then
>>>          echo "${INSTALLED_PACKAGES}" >> "$CONFFILES"
>>> +        echo "${SERVICE_STATUS}" >> "$CONFFILES"
>>>          mkdir -p "$ETCBACKUP_DIR"
>>
>>
>> Am I reading this correctly and is this only keeping track of service 
>> status if you tell sysupgrade to save packages? What's the rationale 
>> behind that?
>>
>> I have a personal build with all packages preinstalled, so I don't 
>> need that. Would like to keep track of service status though. Can 
>> those two things be entangled?
>>
> 
> Same. I would personally like this as default sysupgrade procedure, as 
> that's what makes most sense imho.
> If I have disabled a service it makes sense that after a firmware 
> upgrade it remains disabled.

Seconded.

Use case: Two identical routers for which I build a single image 
including all the packages I required. One has a workround to disable 
dnsmasq in rc.local, because it's always enabled after a sysupgrade and 
acts as a additional interfering dhcp server (I can probably configure 
it otherwise, but I don't require that instance at all).

Thanks,
Andre



More information about the openwrt-devel mailing list