mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
minidlna: Implement force upgrading from older version
Fixes: #2026. Upgrade from 1.2.1+dfsg-1+b1 to 1.3.x. Tests: - Install version 1.2.1+dfsg-1+b1. Change the default media directory. Run unattended upgrades it will fail to upgrade. With the new patch, run apt update. This will force upgrade. After upgrade the earlier set media directory is retained. - Functional tests run. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
5cd1289198
commit
0b9c4c92e9
@ -11,6 +11,7 @@ from plinth.modules.apache.components import Webserver
|
||||
from plinth.modules.backups.components import BackupRestore
|
||||
from plinth.modules.firewall.components import Firewall
|
||||
from plinth.modules.users.components import UsersAndGroups
|
||||
from plinth.utils import Version
|
||||
|
||||
from . import manifest
|
||||
|
||||
@ -103,3 +104,20 @@ def get_media_dir():
|
||||
def set_media_dir(media_dir):
|
||||
"""Set the media directory from which files will be scanned for sharing."""
|
||||
actions.superuser_run('minidlna', ['set-media-dir', '--dir', media_dir])
|
||||
|
||||
|
||||
def force_upgrade(helper, packages):
|
||||
"""Force upgrade minidlna to resolve conffile prompt."""
|
||||
if 'minidlna' not in packages:
|
||||
return False
|
||||
|
||||
# Allow upgrade from 1.2.1+dfsg-1+b1 to 1.3.x
|
||||
package = packages['minidlna']
|
||||
if Version(package['new_version']) > Version('1.4~'):
|
||||
return False
|
||||
|
||||
media_dir = get_media_dir()
|
||||
helper.install(['minidlna'], force_configuration='new')
|
||||
set_media_dir(media_dir)
|
||||
|
||||
return True
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user