[4/8] pakfire.cgi: Add UI to select repository

Message ID 20200211142853.8561-5-michael.tremer@ipfire.org
State Accepted
Commit f61be862c6404df0692341d446ba031af3f18e54
Headers
Series [1/8] pakfire: Automatically compose $version |

Commit Message

Michael Tremer Feb. 11, 2020, 2:28 p.m. UTC
  Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 doc/language_issues.de   |  5 +++++
 doc/language_issues.en   |  5 +++++
 doc/language_issues.es   |  5 +++++
 doc/language_issues.fr   |  5 +++++
 doc/language_issues.it   |  5 +++++
 doc/language_issues.nl   |  5 +++++
 doc/language_issues.pl   |  5 +++++
 doc/language_issues.ru   |  5 +++++
 doc/language_issues.tr   |  5 +++++
 doc/language_missings    | 40 +++++++++++++++++++++++++++++++++
 html/cgi-bin/pakfire.cgi | 48 +++++++++++++++++++++++++++++++++++++++-
 langs/en/cgi-bin/en.pl   |  5 +++++
 12 files changed, 137 insertions(+), 1 deletion(-)
  

Patch

diff --git a/doc/language_issues.de b/doc/language_issues.de
index 89a703fcb..361133708 100644
--- a/doc/language_issues.de
+++ b/doc/language_issues.de
@@ -829,6 +829,11 @@  WARNING: untranslated string: guardian no entries = unknown string
 WARNING: untranslated string: guardian service = unknown string
 WARNING: untranslated string: itlb multihit = iTLB MultiHit
 WARNING: untranslated string: not validating = Not validating
+WARNING: untranslated string: pakfire invalid tree = Invalid repository selected
+WARNING: untranslated string: pakfire tree = Repository
+WARNING: untranslated string: pakfire tree stable = Stable
+WARNING: untranslated string: pakfire tree testing = Testing
+WARNING: untranslated string: pakfire tree unstable = Unstable
 WARNING: untranslated string: route config changed = unknown string
 WARNING: untranslated string: routing config added = unknown string
 WARNING: untranslated string: routing config changed = unknown string
diff --git a/doc/language_issues.en b/doc/language_issues.en
index 10c2f87ce..2fd69f430 100644
--- a/doc/language_issues.en
+++ b/doc/language_issues.en
@@ -1440,12 +1440,17 @@  WARNING: untranslated string: pakfire core update level = Core-Update-Level
 WARNING: untranslated string: pakfire install description = Please choose one or more items from the list below and <br /> click the plus to install.
 WARNING: untranslated string: pakfire install package = You want to install the following packages: 
 WARNING: untranslated string: pakfire installed addons = Installed Addons:
+WARNING: untranslated string: pakfire invalid tree = Invalid repository selected
 WARNING: untranslated string: pakfire last core list update = Last core list update made
 WARNING: untranslated string: pakfire last package update = Last packages list update made
 WARNING: untranslated string: pakfire last serverlist update = Last server list update made
 WARNING: untranslated string: pakfire last update = Last update made
 WARNING: untranslated string: pakfire possible dependency =  There may be depending packages, here is a list of packages that need to be installed.
 WARNING: untranslated string: pakfire system state = System Status
+WARNING: untranslated string: pakfire tree = Repository
+WARNING: untranslated string: pakfire tree stable = Stable
+WARNING: untranslated string: pakfire tree testing = Testing
+WARNING: untranslated string: pakfire tree unstable = Unstable
 WARNING: untranslated string: pakfire uninstall description = Please choose one or more items from the list below and <br /> click the minus to uninstall.
 WARNING: untranslated string: pakfire uninstall package = You want to uninstall the following packages: 
 WARNING: untranslated string: pakfire working = Pakfire is working ... Please wait until all operations have completed successfully.
diff --git a/doc/language_issues.es b/doc/language_issues.es
index b97d017c3..af006fcdf 100644
--- a/doc/language_issues.es
+++ b/doc/language_issues.es
@@ -1233,6 +1233,11 @@  WARNING: untranslated string: ovpn warning rfc3280 = Your host certificate is no
 WARNING: untranslated string: p2p block = P2P networks
 WARNING: untranslated string: p2p block save notice = Please reload the firewall ruleset in order to apply your changes.
 WARNING: untranslated string: pakfire ago = ago.
+WARNING: untranslated string: pakfire invalid tree = Invalid repository selected
+WARNING: untranslated string: pakfire tree = Repository
+WARNING: untranslated string: pakfire tree stable = Stable
+WARNING: untranslated string: pakfire tree testing = Testing
+WARNING: untranslated string: pakfire tree unstable = Unstable
 WARNING: untranslated string: please reboot to apply your changes = Please reboot to apply your changes
 WARNING: untranslated string: pptp netconfig = My Net Config
 WARNING: untranslated string: pptp peer = Peer
diff --git a/doc/language_issues.fr b/doc/language_issues.fr
index 8e9d7babb..928c37a46 100644
--- a/doc/language_issues.fr
+++ b/doc/language_issues.fr
@@ -861,6 +861,11 @@  WARNING: untranslated string: info messages = unknown string
 WARNING: untranslated string: no data = unknown string
 WARNING: untranslated string: not validating = Not validating
 WARNING: untranslated string: pakfire ago = ago.
+WARNING: untranslated string: pakfire invalid tree = Invalid repository selected
+WARNING: untranslated string: pakfire tree = Repository
+WARNING: untranslated string: pakfire tree stable = Stable
+WARNING: untranslated string: pakfire tree testing = Testing
+WARNING: untranslated string: pakfire tree unstable = Unstable
 WARNING: untranslated string: route config changed = unknown string
 WARNING: untranslated string: routing config added = unknown string
 WARNING: untranslated string: routing config changed = unknown string
diff --git a/doc/language_issues.it b/doc/language_issues.it
index a4ea5e618..6471e0d41 100644
--- a/doc/language_issues.it
+++ b/doc/language_issues.it
@@ -1013,6 +1013,11 @@  WARNING: untranslated string: ovpn error dh = The Diffie-Hellman parameter needs
 WARNING: untranslated string: ovpn error md5 = You host certificate uses MD5 for the signature which is not accepted anymore. <br>Please update to the latest IPFire version and generate a new root and host certificate.</br><br>All OpenVPN clients needs then to be renewed!</br>
 WARNING: untranslated string: ovpn tls auth = TLS Channel Protection:
 WARNING: untranslated string: ovpn warning rfc3280 = Your host certificate is not RFC3280 compliant. <br>Please update to the latest IPFire version and generate as soon as possible a new root and host certificate.</br><br>All OpenVPN clients needs then to be renewed!</br>
+WARNING: untranslated string: pakfire invalid tree = Invalid repository selected
+WARNING: untranslated string: pakfire tree = Repository
+WARNING: untranslated string: pakfire tree stable = Stable
+WARNING: untranslated string: pakfire tree testing = Testing
+WARNING: untranslated string: pakfire tree unstable = Unstable
 WARNING: untranslated string: please reboot to apply your changes = Please reboot to apply your changes
 WARNING: untranslated string: pptp netconfig = My Net Config
 WARNING: untranslated string: pptp peer = Peer
diff --git a/doc/language_issues.nl b/doc/language_issues.nl
index ca1dee9b5..cc6cbe966 100644
--- a/doc/language_issues.nl
+++ b/doc/language_issues.nl
@@ -1045,6 +1045,11 @@  WARNING: untranslated string: ovpn generating the root and host certificates = G
 WARNING: untranslated string: ovpn ha = Hash algorithm
 WARNING: untranslated string: ovpn tls auth = TLS Channel Protection:
 WARNING: untranslated string: ovpn warning rfc3280 = Your host certificate is not RFC3280 compliant. <br>Please update to the latest IPFire version and generate as soon as possible a new root and host certificate.</br><br>All OpenVPN clients needs then to be renewed!</br>
+WARNING: untranslated string: pakfire invalid tree = Invalid repository selected
+WARNING: untranslated string: pakfire tree = Repository
+WARNING: untranslated string: pakfire tree stable = Stable
+WARNING: untranslated string: pakfire tree testing = Testing
+WARNING: untranslated string: pakfire tree unstable = Unstable
 WARNING: untranslated string: please reboot to apply your changes = Please reboot to apply your changes
 WARNING: untranslated string: pptp netconfig = My Net Config
 WARNING: untranslated string: pptp peer = Peer
diff --git a/doc/language_issues.pl b/doc/language_issues.pl
index b97d017c3..af006fcdf 100644
--- a/doc/language_issues.pl
+++ b/doc/language_issues.pl
@@ -1233,6 +1233,11 @@  WARNING: untranslated string: ovpn warning rfc3280 = Your host certificate is no
 WARNING: untranslated string: p2p block = P2P networks
 WARNING: untranslated string: p2p block save notice = Please reload the firewall ruleset in order to apply your changes.
 WARNING: untranslated string: pakfire ago = ago.
+WARNING: untranslated string: pakfire invalid tree = Invalid repository selected
+WARNING: untranslated string: pakfire tree = Repository
+WARNING: untranslated string: pakfire tree stable = Stable
+WARNING: untranslated string: pakfire tree testing = Testing
+WARNING: untranslated string: pakfire tree unstable = Unstable
 WARNING: untranslated string: please reboot to apply your changes = Please reboot to apply your changes
 WARNING: untranslated string: pptp netconfig = My Net Config
 WARNING: untranslated string: pptp peer = Peer
diff --git a/doc/language_issues.ru b/doc/language_issues.ru
index b76c83e56..a8cdef8b4 100644
--- a/doc/language_issues.ru
+++ b/doc/language_issues.ru
@@ -1229,6 +1229,11 @@  WARNING: untranslated string: ovpn tls auth = TLS Channel Protection:
 WARNING: untranslated string: ovpn warning rfc3280 = Your host certificate is not RFC3280 compliant. <br>Please update to the latest IPFire version and generate as soon as possible a new root and host certificate.</br><br>All OpenVPN clients needs then to be renewed!</br>
 WARNING: untranslated string: p2p block = P2P networks
 WARNING: untranslated string: p2p block save notice = Please reload the firewall ruleset in order to apply your changes.
+WARNING: untranslated string: pakfire invalid tree = Invalid repository selected
+WARNING: untranslated string: pakfire tree = Repository
+WARNING: untranslated string: pakfire tree stable = Stable
+WARNING: untranslated string: pakfire tree testing = Testing
+WARNING: untranslated string: pakfire tree unstable = Unstable
 WARNING: untranslated string: please reboot to apply your changes = Please reboot to apply your changes
 WARNING: untranslated string: pptp netconfig = My Net Config
 WARNING: untranslated string: pptp peer = Peer
diff --git a/doc/language_issues.tr b/doc/language_issues.tr
index ef28f6ac8..c6c6ad599 100644
--- a/doc/language_issues.tr
+++ b/doc/language_issues.tr
@@ -923,6 +923,11 @@  WARNING: untranslated string: ovpn error dh = The Diffie-Hellman parameter needs
 WARNING: untranslated string: ovpn error md5 = You host certificate uses MD5 for the signature which is not accepted anymore. <br>Please update to the latest IPFire version and generate a new root and host certificate.</br><br>All OpenVPN clients needs then to be renewed!</br>
 WARNING: untranslated string: ovpn tls auth = TLS Channel Protection:
 WARNING: untranslated string: ovpn warning rfc3280 = Your host certificate is not RFC3280 compliant. <br>Please update to the latest IPFire version and generate as soon as possible a new root and host certificate.</br><br>All OpenVPN clients needs then to be renewed!</br>
+WARNING: untranslated string: pakfire invalid tree = Invalid repository selected
+WARNING: untranslated string: pakfire tree = Repository
+WARNING: untranslated string: pakfire tree stable = Stable
+WARNING: untranslated string: pakfire tree testing = Testing
+WARNING: untranslated string: pakfire tree unstable = Unstable
 WARNING: untranslated string: please reboot to apply your changes = Please reboot to apply your changes
 WARNING: untranslated string: processor vulnerability mitigations = Processor Vulnerability Mitigations
 WARNING: untranslated string: ptr = PTR
diff --git a/doc/language_missings b/doc/language_missings
index 40724a80b..a427f5706 100644
--- a/doc/language_missings
+++ b/doc/language_missings
@@ -63,6 +63,11 @@ 
 < notes
 < not validating
 < okay
+< pakfire invalid tree
+< pakfire tree
+< pakfire tree stable
+< pakfire tree testing
+< pakfire tree unstable
 < quick control
 < shaping add options
 < show areas
@@ -705,6 +710,11 @@ 
 < ovpn warning rfc3280
 < p2p block
 < p2p block save notice
+< pakfire invalid tree
+< pakfire tree
+< pakfire tree stable
+< pakfire tree testing
+< pakfire tree unstable
 < please reboot to apply your changes
 < pptp netconfig
 < pptp peer
@@ -942,6 +952,11 @@ 
 < dns use protocol for dns queries
 < not validating
 < okay
+< pakfire invalid tree
+< pakfire tree
+< pakfire tree stable
+< pakfire tree testing
+< pakfire tree unstable
 < standard
 < strict
 < working
@@ -1182,6 +1197,11 @@ 
 < ovpn error md5
 < ovpn tls auth
 < ovpn warning rfc3280
+< pakfire invalid tree
+< pakfire tree
+< pakfire tree stable
+< pakfire tree testing
+< pakfire tree unstable
 < please reboot to apply your changes
 < pptp netconfig
 < pptp peer
@@ -1564,6 +1584,11 @@ 
 < ovpn reneg sec
 < ovpn tls auth
 < ovpn warning rfc3280
+< pakfire invalid tree
+< pakfire tree
+< pakfire tree stable
+< pakfire tree testing
+< pakfire tree unstable
 < please reboot to apply your changes
 < pptp netconfig
 < pptp peer
@@ -2285,6 +2310,11 @@ 
 < ovpn warning rfc3280
 < p2p block
 < p2p block save notice
+< pakfire invalid tree
+< pakfire tree
+< pakfire tree stable
+< pakfire tree testing
+< pakfire tree unstable
 < please reboot to apply your changes
 < pptp netconfig
 < pptp peer
@@ -3121,6 +3151,11 @@ 
 < ovpn warning rfc3280
 < p2p block
 < p2p block save notice
+< pakfire invalid tree
+< pakfire tree
+< pakfire tree stable
+< pakfire tree testing
+< pakfire tree unstable
 < please reboot to apply your changes
 < pptp netconfig
 < pptp peer
@@ -3429,6 +3464,11 @@ 
 < ovpn error md5
 < ovpn tls auth
 < ovpn warning rfc3280
+< pakfire invalid tree
+< pakfire tree
+< pakfire tree stable
+< pakfire tree testing
+< pakfire tree unstable
 < please reboot to apply your changes
 < processor vulnerability mitigations
 < ptr
diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi
index f785b2594..dacbe11f4 100644
--- a/html/cgi-bin/pakfire.cgi
+++ b/html/cgi-bin/pakfire.cgi
@@ -143,7 +143,19 @@  END
 	system("$command");
 	system("/bin/sleep 1");
 } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") {
-	&General::writehash("${General::swroot}/pakfire/settings", \%pakfiresettings);
+	$pakfiresettings{"TREE"} = $cgiparams{"TREE"};
+
+	# Check for valid input
+	if ($pakfiresettings{"TREE"} !~ m/^(stable|testing|unstable)$/) {
+		$errormessage .= $Lang::tr{'pakfire invalid tree'};
+	}
+
+	unless ($errormessage) {
+		&General::writehash("${General::swroot}/pakfire/settings", \%pakfiresettings);
+
+		# Update lists
+		system("/usr/local/bin/pakfire update --force --no-colors &>/dev/null &");
+	}
 }
 
 &General::readhash("${General::swroot}/pakfire/settings", \%pakfiresettings);
@@ -151,6 +163,12 @@  END
 my %selected=();
 my %checked=();
 
+$selected{"TREE"} = ();
+$selected{"TREE"}{"stable"} = "";
+$selected{"TREE"}{"testing"} = "";
+$selected{"TREE"}{"unstable"} = "";
+$selected{"TREE"}{$pakfiresettings{"TREE"}} = "selected";
+
 # DPC move error message to top so it is seen!
 if ($errormessage) {
 	&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
@@ -263,6 +281,34 @@  print <<END;
 	</table>
 END
 
+&Header::closebox();
+&Header::openbox("100%", "center", "$Lang::tr{'settings'}");
+
+print <<END;
+	<form method='POST' action='$ENV{'SCRIPT_NAME'}'>
+		<table width='95%'>
+			<tr>
+				<td align='left' width='45%'>$Lang::tr{'pakfire tree'}</td>
+				<td width="55%" align="left">
+					<select name="TREE">
+						<option value="stable" $selected{"TREE"}{"stable"}>$Lang::tr{'pakfire tree stable'}</option>
+						<option value="testing" $selected{"TREE"}{"testing"}>$Lang::tr{'pakfire tree testing'}</option>
+						<option value="unstable" $selected{"TREE"}{"unstable"}>$Lang::tr{'pakfire tree unstable'}</option>
+					</select>
+				</td>
+			</tr>
+			<tr>
+				<td colspan="2">&nbsp;</td>
+			</tr>
+			<tr>
+				<td colspan="2" align="center">
+					<input type="submit" name="ACTION" value="$Lang::tr{'save'}" />
+				</td>
+			</tr>
+		</table>
+	</form>
+END
+
 &Header::closebox();
 &Header::closebigbox();
 &Header::closepage();
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
index 1f81108f1..a68c8f411 100644
--- a/langs/en/cgi-bin/en.pl
+++ b/langs/en/cgi-bin/en.pl
@@ -1982,6 +1982,7 @@ 
 'pakfire install description' => 'Please choose one or more items from the list below and <br /> click the plus to install.',
 'pakfire install package' => 'You want to install the following packages: ',
 'pakfire installed addons' => 'Installed Addons:',
+'pakfire invalid tree' => 'Invalid repository selected',
 'pakfire last core list update' => 'Last core list update made',
 'pakfire last package update' => 'Last packages list update made',
 'pakfire last serverlist update' => 'Last server list update made',
@@ -1989,6 +1990,10 @@ 
 'pakfire possible dependency' => ' There may be depending packages, here is a list of packages that need to be installed.',
 'pakfire register' => 'Register at pakfire-server:',
 'pakfire system state' => 'System Status',
+'pakfire tree' => 'Repository',
+'pakfire tree stable' => 'Stable',
+'pakfire tree testing' => 'Testing',
+'pakfire tree unstable' => 'Unstable',
 'pakfire uninstall description' => 'Please choose one or more items from the list below and <br /> click the minus to uninstall.',
 'pakfire uninstall package' => 'You want to uninstall the following packages: ',
 'pakfire update daily' => 'Search for updates daily:',