Add option to automatically remove unused dependency packages

This commit is contained in:
HummyPkg 2021-02-24 15:06:07 +00:00
parent c4afa7ac60
commit fc3b28e978
4 changed files with 16 additions and 1 deletions

View File

@ -2,7 +2,7 @@
package require cgi
source /mod/webif/lib/setup
require pkg.class system.class
require pkg.class system.class settings.class
cgi_input
#cgi_dump
@ -61,6 +61,11 @@ if {$cmd eq "dependinfo"} {
}
if {$cmd eq "upgrade"} { opkg update }
if {$cmd eq "remove" && [[settings] noautoremove] ne "1"} {
append cmd " --autoremove"
}
opkg "$cmd $cmdargs"
if {$cmd eq "update" || $cmd eq "upgrade"} {

View File

@ -28,6 +28,7 @@ if {[cgi_get act] eq "cryptokey"} {
set pkgdev [$settings pkgdev]
set rtschedule [$settings rtschedule]
set noautoremove [$settings noautoremove]
set logsize [$settings logsize]
set logkeep [$settings logkeep]
set logage [$settings logage]
@ -44,6 +45,7 @@ if {![catch {set ck_fd [open "/mod/boot/cryptokey"]}]} {
handle_int_update pkgdev $pkgdev "Development Package Display"
handle_int_update rtschedule $rtschedule "Real-time scheduling"
handle_int_update noautoremove $noautoremove "Package auto-remove"
handle_int_update logsize $logsize "Log rotation size"
handle_int_update logkeep $logkeep "Logs to keep"
handle_int_update logage $logage "Rotated log max age"

View File

@ -16,6 +16,9 @@ if {[system nuggeted]} {
setting_toggle "Real-time scheduling?" "rtschedule" $rtschedule
}
setting_toggle "Automatically remove unneeded dependent packages?" \
"noautoremove" $(!$noautoremove) 1
puts -nonewline "
<tr>
<form class=auto id=logsize method=get action=$env(SCRIPT_NAME)>

View File

@ -52,6 +52,7 @@ class settings {
logkeep 2
logage 0
rtschedule 0
noautoremove 0
}
proc {settings _safer_query} { queryText args } {
@ -257,6 +258,10 @@ settings method rtschedule {{val -1}} {
return [$self _nval_setting rtschedule $val]
}
settings method noautoremove {{val -1}} {
return [$self _nval_setting noautoremove $val]
}
settings method sortorder {{val -1}} {
return [$self _nval_setting sortorder $val]
}