summaryrefslogtreecommitdiffstats
path: root/mgaupdate
diff options
context:
space:
mode:
authorMageia SVN-Git Migration <svn-git-migration@mageia.org>2011-05-14 01:22:07 +0100
committerMageia SVN-Git Migration <svn-git-migration@mageia.org>2011-05-14 01:22:07 +0100
commite0ada251ac68dc91192c7ec7d10f3a1d7784916a (patch)
tree225ed465e93c82ad37c2794144850635b395d594 /mgaupdate
parent5d4a18c95ac1ef5a657b5dcefd8a47e429d74058 (diff)
downloadmgaonline-e0ada251ac68dc91192c7ec7d10f3a1d7784916a.tar
mgaonline-e0ada251ac68dc91192c7ec7d10f3a1d7784916a.tar.gz
mgaonline-e0ada251ac68dc91192c7ec7d10f3a1d7784916a.tar.bz2
mgaonline-e0ada251ac68dc91192c7ec7d10f3a1d7784916a.tar.xz
mgaonline-e0ada251ac68dc91192c7ec7d10f3a1d7784916a.zip
Synthesized commit during git-svn import combining previous Mandriva history with Mageia.2.77.22
This commit consitsts of the following subversion commits: ------------------------------------------------------------------------ r1310 | dmorgan | 2011-05-14 01:22:07 +0100 (Sat, 14 May 2011) | 1 line Import cleaned mgaonline ------------------------------------------------------------------------
Diffstat (limited to 'mgaupdate')
-rwxr-xr-xmgaupdate109
1 files changed, 109 insertions, 0 deletions
diff --git a/mgaupdate b/mgaupdate
new file mode 100755
index 00000000..7c1623ab
--- /dev/null
+++ b/mgaupdate
@@ -0,0 +1,109 @@
+#!/usr/bin/perl
+################################################################################
+# Mgaupdate #
+# #
+# Copyright (C) 2002-2006 Mandriva #
+# #
+# Daouda Lo #
+# Thierry Vignaud <tvignaud at mandriva dot com> #
+# #
+# This program is free software; you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License Version 2 as #
+# published by the Free Software Foundation. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program; if not, write to the Free Software #
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
+################################################################################
+
+# workaround standalone.pm eating "--auto" from @ARGV:
+BEGIN { $::no_global_argv_parsing = 1 }
+
+use strict;
+use POSIX;
+use lib qw(/usr/lib/libDrakX /usr/lib/libDrakX/drakfirsttime);
+use standalone; # for explanations
+use common;
+use interactive;
+use URI::Escape;
+use run_program;
+
+use mgaonline;
+
+use Getopt::Long;
+
+BEGIN { unshift @::textdomains, 'mgaupdate' }
+
+require_root_capability();
+
+my $confdir = '/root/.MdkOnline';
+my $conffile = "$confdir/mgaupdate";
+
+my $logfile = '/var/tmp/mgaupdate.log';
+
+
+my $CLIENT_VERSION = "4";
+my $YEARS = "2002-2006";
+my $MGA_YEARS = "2010-2011";
+
+#for compatibilities with former versions
+mkdir_p($confdir) if !-d $confdir;
+-e '/root/.mgaupdate' and system "/bin/mv", "/root/.mgaupdate", $conffile;
+
+
+sub usage() {
+ print STDERR N("mgaupdate version %s
+Copyright (C) %s Mandriva.
+Copyright (C) %s Mageia.
+This is free software and may be redistributed under the terms of the GNU GPL.
+
+usage:
+", $CLIENT_VERSION, $YEARS, $MGA_YEARS) . N(" --help - print this help message.
+") . N(" --auto - Mageia Update launched automatically.
+") . N(" --mnf - launch mnf specific scripts.
+") . N(" --noX - text mode version of Mageia Update.
+") . N(" --debug - log what is done
+");
+ exit(0);
+}
+
+my ($auto, $mnf, $noX, $debug);
+my %options = (
+ 'auto' => \$auto,
+ 'mnf' => \$mnf,
+ 'noX' => \$noX,
+ 'd|debug' => \$debug,
+ 'h|help' => \&usage,
+ );
+
+GetOptions(%options);
+
+-e $logfile and rm_rf($logfile);
+
+my $ret = update_pkgs();
+if ($ret != 1) {
+ output_p($logfile, "[mgaupdate] Error 100: Packages failed to upgrade");
+ log::explanations("[mgaupdate] Error 100: Packages failed to upgrade");
+}
+clean_dir();
+
+
+sub update_pkgs {
+ my (@pkgs) = @_;
+ eval {
+ run_program::raw({ timeout => 'never' }, '/usr/sbin/urpmi', '--auto-update', '--auto', '--keep', '--update', map { if_(/(.*)-[^-]*-[^-]*\.[^-.]*?\.rpm$/, $1) } @pkgs);
+ $? == 0 or die N("Unable to update packages from update_source medium.\n");
+ };
+ $@ and output_p($logfile, "[mgaupdate] Error 99: $@"), return 0;
+ return 1;
+}
+
+sub clean_dir() {
+ mgaonline::clean_confdir();
+ output_p($logfile, 'OK');
+}