summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMystery Man <unknown@mandriva.org>2000-11-08 00:01:16 +0000
committerMystery Man <unknown@mandriva.org>2000-11-08 00:01:16 +0000
commitd5c526273db473a7d87a26000585900fc10dda7d (patch)
tree0fdaabe7a00921b6cc556601b103d344fc7ac781 /tools
parent9c164312d4bfff6d93e1c4529de6b992f2bebc44 (diff)
downloaddrakx-backup-do-not-use-d5c526273db473a7d87a26000585900fc10dda7d.tar
drakx-backup-do-not-use-d5c526273db473a7d87a26000585900fc10dda7d.tar.gz
drakx-backup-do-not-use-d5c526273db473a7d87a26000585900fc10dda7d.tar.bz2
drakx-backup-do-not-use-d5c526273db473a7d87a26000585900fc10dda7d.tar.xz
drakx-backup-do-not-use-d5c526273db473a7d87a26000585900fc10dda7d.zip
This commit was manufactured by cvs2svn to create branch
'unlabeled-1.1.1'.
Diffstat (limited to 'tools')
-rw-r--r--tools/.cvsignore1
-rw-r--r--tools/2adsldb.pm17
-rw-r--r--tools/2isdndb.pm23
-rw-r--r--tools/Makefile44
-rw-r--r--tools/alpha/cd/Makefile6
-rw-r--r--tools/alpha/cd/README9
-rw-r--r--tools/alpha/cd/aboot.cnf6
-rwxr-xr-xtools/alpha/cd/up1000/apb.cfg4
-rwxr-xr-xtools/alpha/cd/up1000/apb.exebin120832 -> 0 bytes
-rw-r--r--tools/ddcprobe/Makefile10
-rw-r--r--tools/ddcprobe/lrmi.c2
-rw-r--r--tools/extractchangelog2
-rwxr-xr-xtools/gencompss4
-rwxr-xr-xtools/i386/netboot/stage1.via-rhinebin0 -> 512 bytes
-rw-r--r--tools/i386/netboot/stage2.via-rhinebin0 -> 88208 bytes
-rwxr-xr-xtools/i386/shbin0 -> 153752 bytes
-rwxr-xr-xtools/make_mdkinst_stage242
-rwxr-xr-xtools/syncrpms157
18 files changed, 119 insertions, 208 deletions
diff --git a/tools/.cvsignore b/tools/.cvsignore
index 21a6d396b..e570b13fa 100644
--- a/tools/.cvsignore
+++ b/tools/.cvsignore
@@ -1,3 +1,2 @@
rpm2header
gendepslist
-xhost+
diff --git a/tools/2adsldb.pm b/tools/2adsldb.pm
new file mode 100644
index 000000000..23328aafc
--- /dev/null
+++ b/tools/2adsldb.pm
@@ -0,0 +1,17 @@
+open F, "isplist.txt" or die "file $file not found";
+open G, ">tutu" or die "file $file not found";
+foreach (<F>) {
+ s/\#.*//;
+ /.*ADSL.*/ or next;
+#| NOM | PAYS | CONNECTION | MAILTYPE | SMTP | MAILSERVER | NEWS | MY1DNS | MY2DNS | PROXY | PROXYSERVER | DHCP | EMAIL
+ s/(.*)france(.*)/$1France$2/;
+ s/(.*)FRANCE(.*)/$1France$2/;
+ s/(.*)USA(.*)/$1United States$2/;
+ s/(.*)U.S.A(.*)/$1United States$2/;
+ s/(.*)US(.*)/$1United States$2/;
+ s/(.*)usa(.*)/$1United States$2/;
+ s/(.*)club-internet(.*)/$1club internet$2/;
+ my ($name, $country, $connexion, $mailtype, $smtp, $popserver, $mailserver, $news, $dns1, $dns2, $proxy, $proxyserver, $dhcp, $email) = split /\|/;
+ print G join("|", $country, join("=>", $name, $dns1, $dns2)), "\n"; #$domain,
+}
+
diff --git a/tools/2isdndb.pm b/tools/2isdndb.pm
new file mode 100644
index 000000000..4b0f9d8f7
--- /dev/null
+++ b/tools/2isdndb.pm
@@ -0,0 +1,23 @@
+open F, "isdndb.txt" or die "file $file not found";
+open G, ">tutu" or die "file $file not found";
+foreach (<F>) {
+ s/\#.*//;
+ s/\[City\]\s+National//;
+ /\[Country\]\s*(.*)/ and $country = $1;
+ /\[City\]\s*(.*)/ and $city = $1;
+ /\[Name\]\s*(.*)/ and $name = $1;
+ /\[Prefix\]\s*(.*)/ and $prefix = $1;
+ /\[ISDN\]\s*(.*)/ and $isdn = $1;
+ /\[Domain\]\s*(.*)/ and $domain = $1;
+ /\[DNS\]\s*(.*)/ and ($dns1 ? $dns2 : $dns1) = $1;
+ if ($isdn && !$prefix) { $prefix = "" }
+ if (defined $name && defined $prefix && defined $isdn && defined $domain && defined $dns1 && defined $dns2) {
+ print G join("|", $country, $city, join("=>", $name, $prefix . $isdn, $domain, $dns1, $dns2)), "\n";
+ undef $name;
+ undef $prefix;
+ undef $isdn;
+ undef $domain;
+ undef $dns1;
+ undef $dns2;
+ }
+}
diff --git a/tools/Makefile b/tools/Makefile
index 822d17a33..c76c5fc6d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,41 +1,25 @@
ROOTDEST = /export
-DEST = $(ROOTDEST)/Mandrake/mdkinst
-RPMS = $(wildcard $(ROOTDEST)/Mandrake/RPMS/*.rpm)
-DIRS = ddcprobe serial_probe
BASE = $(ROOTDEST)/Mandrake/base
-CFLAGS = -Wall
-.PHONY: clean install $(DIRS)
-
-all: $(BASE)/depslist $(BASE)/filelist $(BASE)/compss $(DIRS) xhost+ install
-
-$(DIRS):
- make -C $@
+ALL = gendepslist rpm2header
+.PHONY: clean install
install:
- install make_mdkinst_stage2 gencompss $(ROOTDEST)/misc
- cd /usr/bin ; install build_archive $(ROOTDEST)/misc || { echo "build_archive is missing"; exit 1; }
- cd /usr/bin ; install gendepslist2 rpm2header genhdlist_cz2 $(ROOTDEST)/misc || { echo "install rpmtools first!" ; exit 1; }
- mkdir -p $(DEST)/usr/bin
-
-xhost+: %: %.c
- $(CC) $(CFLAGS) $< -L/usr/X11R6/lib -lX11 -o $@
-
-ddcprobe/ddcxinfos:
- $(MAKE) -C ddcprobe ddcxinfos
+ $(MAKE) gendepslist rpm2header
+ install make_mdkinst_stage2 gendepslist rpm2header genhdlist $(ROOTDEST)/misc
-$(BASE)/compss: $(BASE)/hdlists $(BASE)/hdlist.cz2
- ./gencompss `cat $< | perl -pe 's|(.*)|'$(BASE)'/$$1|' ` > $@
+gendepslist: %: %.cc
+ $(CXX) -I/usr/include/rpm $(CFLAGS) $< -lrpm -ldb1 -lz -o $@
-$(BASE)/depslist: $(BASE)/hdlists $(BASE)/hdlist.cz2
-# gendepslist2 -o $@ `cat $< | perl -pe 's|^(\S*).*|'$(BASE)'/$$1|' `
+rpm2header: %: %.c
+ $(CC) -I/usr/include/rpm $(CFLAGS) $< -lrpm -ldb1 -lz -o $@
-$(BASE)/filelist: $(RPMS)
-# genfilelist $(ROOTDEST)/Mandrake/RPMS* >$@
+$(BASE)/depslist: $(BASE)/hdlist gendepslist
+ ./gendepslist -h $@ $<
-$(BASE)/hdlist.cz2: $(BASE)/hdlists $(RPMS)
-# genhdlists --noclean --distrib $(ROOTDEST)
+$(BASE)/hdlist: $(RPMS)
+ $(MAKE) install
+ ./genhdlist $(ROOTDEST)
clean:
- for i in $(DIRS); do $(MAKE) -C $$i clean; done
- rm -rf *~ xhost+ ddcprobe/ddcxinfos */*.o
+ rm -rf *~ gendepslist rpm2header
diff --git a/tools/alpha/cd/Makefile b/tools/alpha/cd/Makefile
index 67af70f2f..c5235660b 100644
--- a/tools/alpha/cd/Makefile
+++ b/tools/alpha/cd/Makefile
@@ -1,8 +1,4 @@
install:
- cp -f README README.milo $(ROOTDEST)
+ cp -f README $(ROOTDEST)
install -d $(ROOTDEST)/etc
cp -f aboot.cnf $(ROOTDEST)/etc
-
- install -d $(ROOTDEST)/boot
- cp -a up1000 $(ROOTDEST)/boot
- mv -f $(ROOTDEST)/boot/up1000/apb.* $(ROOTDEST)
diff --git a/tools/alpha/cd/README b/tools/alpha/cd/README
index 78eb94bd5..98dc50fda 100644
--- a/tools/alpha/cd/README
+++ b/tools/alpha/cd/README
@@ -1,9 +1,6 @@
!! beta version !!
-Mandrake Alpha short Howto-Install
-
-this doc is for SRM, if you have alphabios, see README.milo
-
+Mandrake Alpha short Howto-Install :
* to install from the cdrom:
@@ -23,8 +20,8 @@ this doc is for SRM, if you have alphabios, see README.milo
the system
- if the device is not available via SRM, use the
-cdrom: `boot dqa0 -file boot/v.gz -fl root=/dev/sda1' (replace sda1 by the
-root you installed on, and dqa0 by the cdrom device)
+cdrom: `boot -file boot/v.gz -root /dev/sda1' (replace sda1 by the
+root you installed on)
* to install from the network:
diff --git a/tools/alpha/cd/aboot.cnf b/tools/alpha/cd/aboot.cnf
index 42c7a4382..4ddaaf949 100644
--- a/tools/alpha/cd/aboot.cnf
+++ b/tools/alpha/cd/aboot.cnf
@@ -1,3 +1,3 @@
-0:boot/instboot.gz initrd=boot/cdrom.rdz mdkinst rw ramdisk=32000 cdrom
-1:boot/instboot.gz initrd=boot/network.rdz mdkinst rw ramdisk=32000 network
-2:boot/instboot.gz initrd=boot/hd.rdz mdkinst rw ramdisk=32000 hd
+0:boot/instboot.gz initrd=boot/cdrom.rdz mdkinst rw ramdisk=32000
+1:boot/instboot.gz initrd=boot/network.rdz mdkinst rw ramdisk=32000
+2:boot/instboot.gz initrd=boot/hd.rdz mdkinst rw ramdisk=32000
diff --git a/tools/alpha/cd/up1000/apb.cfg b/tools/alpha/cd/up1000/apb.cfg
index 06614adcb..366e42bb4 100755
--- a/tools/alpha/cd/up1000/apb.cfg
+++ b/tools/alpha/cd/up1000/apb.cfg
@@ -1,2 +1,2 @@
-floppy|bootl boot\up1000\up1000.pal boot\instboot.gz root=/dev/fd0 load_ramdisk=1 mdkinst rw ramdisk_size=32000
-floppy_text|bootl boot\up1000\up1000.pal boot\instboot.gz root=/dev/fd0 load_ramdisk=1 mdkinst rw ramdisk_size=32000 text
+floppy|bootl boot/up1000/up1000.pal boot/instboot.gz root=/dev/fd0 load_ramdisk=1 mdkinst rw ramdisk_size=32000
+floppy_text|bootl boot/up1000/up1000.pal boot/instboot.gz root=/dev/fd0 load_ramdisk=1 mdkinst rw ramdisk_size=32000 text
diff --git a/tools/alpha/cd/up1000/apb.exe b/tools/alpha/cd/up1000/apb.exe
deleted file mode 100755
index 4b3aa6099..000000000
--- a/tools/alpha/cd/up1000/apb.exe
+++ /dev/null
Binary files differ
diff --git a/tools/ddcprobe/Makefile b/tools/ddcprobe/Makefile
index 07ba43786..e2bf84011 100644
--- a/tools/ddcprobe/Makefile
+++ b/tools/ddcprobe/Makefile
@@ -1,11 +1,6 @@
CFLAGS=-Wall -O # -g -DDEBUG
TARGETS=ddcxinfos
-ARCH := $(patsubst i%86,i386,$(shell uname -m))
-ARCH := $(patsubst sparc%,sparc,$(ARCH))
-
-ifeq (i386,$(ARCH))
-
ddcxinfos: lrmi.o vesamode.o vbe.o ddcxinfos.o
libvbe.a: lrmi.o vesamode.o vbe.o
@@ -19,10 +14,5 @@ $(DESTDIR)/usr/include/vbe.h:
$(DESTDIR)/usr/lib/libvbe.a:
install -m 644 libvbe.a $(DESTDIR)/usr/lib/libvbe.a
-else
-ddcxinfos: not_handled.c
- gcc -o $@ $<
-endif
-
clean:
$(RM) $(TARGETS) *.o core
diff --git a/tools/ddcprobe/lrmi.c b/tools/ddcprobe/lrmi.c
index e7e25ce2e..ca8af0a1e 100644
--- a/tools/ddcprobe/lrmi.c
+++ b/tools/ddcprobe/lrmi.c
@@ -727,7 +727,7 @@ static int
lrmi_vm86(struct vm86_struct *vm)
{
int r;
-#if 1
+#ifdef __PIC__
asm volatile (
"pushl %%ebx\n\t"
"movl %2, %%ebx\n\t"
diff --git a/tools/extractchangelog b/tools/extractchangelog
new file mode 100644
index 000000000..d838a0b68
--- /dev/null
+++ b/tools/extractchangelog
@@ -0,0 +1,2 @@
+#!/usr/bin/perl
+
diff --git a/tools/gencompss b/tools/gencompss
index 333d02f0c..b26ef7c2c 100755
--- a/tools/gencompss
+++ b/tools/gencompss
@@ -4,11 +4,11 @@ open F, "bzip2 -dc @ARGV 2>/dev/null | hdlist2groups - |";
foreach (<F>) {
chop;
/(.*):(.*)/;
- $l{$2}{$1} = undef;
+ push @{$l{$2}}, $1;
}
close F or die;
foreach (sort keys %l) {
print "$_\n";
- print "\t$_\n" foreach sort keys %{$l{$_}};
+ print "\t$_\n" foreach sort @{$l{$_}};
print "\n";
}
diff --git a/tools/i386/netboot/stage1.via-rhine b/tools/i386/netboot/stage1.via-rhine
new file mode 100755
index 000000000..c15d90622
--- /dev/null
+++ b/tools/i386/netboot/stage1.via-rhine
Binary files differ
diff --git a/tools/i386/netboot/stage2.via-rhine b/tools/i386/netboot/stage2.via-rhine
new file mode 100644
index 000000000..7fb5cb251
--- /dev/null
+++ b/tools/i386/netboot/stage2.via-rhine
Binary files differ
diff --git a/tools/i386/sh b/tools/i386/sh
new file mode 100755
index 000000000..084a97837
--- /dev/null
+++ b/tools/i386/sh
Binary files differ
diff --git a/tools/make_mdkinst_stage2 b/tools/make_mdkinst_stage2
index f480634b2..724808dd7 100755
--- a/tools/make_mdkinst_stage2
+++ b/tools/make_mdkinst_stage2
@@ -13,13 +13,6 @@ REP4PMS=/usr/bin/perl-install
DEST=$1
STAGE2=$2
-testandset() { [ -x $1/build_archive ] && BUILD_ARCHIVE=$1/build_archive; }
-testandset `pwd`/misc
-testandset `pwd`/.
-testandset /$DEST/../../misc
-testandset `pwd`/$DEST/../../misc
-[ -z "$BUILD_ARCHIVE" ] && { echo "can't find build_archive"; exit 1; }
-
if [ $EUID != "0" ]; then
SUDO="sudo"
PATH="/sbin:/usr/sbin:$PATH"
@@ -29,42 +22,21 @@ $SUDO rm -rf $STAGE2TMP
install -d $STAGE2TMP
$SUDO cp -a $DEST/* $STAGE2TMP
-#mkdir -p $MNTPOINT 2>/dev/null
-#for i in $MNTPOINT $STAGE2; do $SUDO umount $i 2>/dev/null ; done
-#dd if=/dev/zero of=$STAGE2 bs=1k count=24000
-#$MKE2FS -N 1000 $STAGE2
-#$SUDO mount -t ext2 $STAGE2 $MNTPOINT -o loop
-# hack to reduce the STAGE2 image (do not edit without modifying in DrakX)
-# be sure to keep the biggest server
-rm -f $STAGE2TMP/usr/X11R6/bin/XF86_{VGA16,3DLabs,TGA,S3}
-rm -f $STAGE2TMP/$REP4PMS/po/DrakX.pot
-#for i in /usr/share/locale; do \
-# name=`basename $i` ; \
-# (cd $STAGE2TMP/$i ; find * | cpio -o 2>/dev/null | bzip2 > ../$name.cpio.bz2 ; cd .. ; rm -rf $name) \
-#done
-for i in /usr/share/locale; do
- name=`basename $i`
- (cd $STAGE2TMP/$i ; find * | $BUILD_ARCHIVE ../$name.cz2 4000000)
- rm -rf $STAGE2TMP/$i
-done
-for i in /usr/share/keymaps /usr/share/xmodmap $REP4PMS/po; do
- name=`basename $i`
- (cd $STAGE2TMP/$i ; ls * | $BUILD_ARCHIVE ../$name.cz2 400000)
- rm -rf $STAGE2TMP/$i
-done
-
-
-
mkdir -p $MNTPOINT 2>/dev/null
for i in $MNTPOINT $STAGE2; do $SUDO umount $i 2>/dev/null ; done
-dd if=/dev/zero of=$STAGE2 bs=1k count=$[ `du -s $STAGE2TMP | cut -f1` + 1024 ]
+dd if=/dev/zero of=$STAGE2 bs=1M count=15
$MKE2FS -N 1000 $STAGE2
$SUDO mount -t ext2 $STAGE2 $MNTPOINT -o loop
+# hack to reduce the STAGE2 image (do not edit without modifying in DrakX)
+rm $STAGE2TMP/usr/X11R6/bin/XF86_VGA16
+for i in /usr/share/locale /usr/share/keymaps /usr/share/xmodmap $REP4PMS/po; do \
+ name=`basename $i` ; \
+ (cd $STAGE2TMP/$i ; find * | cpio -o 2>/dev/null | bzip2 > ../$name.cpio.bz2 ; cd .. ; rm -rf $name) \
+done
$SUDO cp -a $STAGE2TMP/* $MNTPOINT
$SUDO rm -rf $STAGE2TMP
-df $MNTPOINT
$SUDO umount $STAGE2
rmdir $MNTPOINT
diff --git a/tools/syncrpms b/tools/syncrpms
index ccb806d6c..1c7eea761 100755
--- a/tools/syncrpms
+++ b/tools/syncrpms
@@ -28,7 +28,7 @@ sub version_compare {
my ($a, $b) = @_;
local $_;
- while ($a || $b) {
+ while ($a && $b) {
my ($sb, $sa) = map { $1 if $a =~ /^\W*\d/ ? s/^\W*0*(\d+)// : s/^\W*(\D+)// } ($b, $a);
$_ = length($sa) cmp length($sb) || $sa cmp $sb and return $_;
}
@@ -43,14 +43,6 @@ sub cp {
exec '/bin/cp', @_;
}
}
-sub mv {
- my $pid;
- if ($pid = fork()) {
- waitpid($pid, 0);
- } else {
- exec '/bin/mv', @_;
- }
-}
sub rm {
my $pid;
if ($pid = fork()) {
@@ -62,57 +54,39 @@ sub rm {
#- get a hash on name of srpms/rpms in a directory.
sub get_rpms {
- my ($dir, $rpms, $flag, $modifiable) = @_;
+ my ($dir, $rpms, $flag) = @_;
opendir D, $dir or die "cannot open directory $dir\n";
map {
- if (/([^\/]*?)-([^-]*)-([^-]*)\.([^-\.]*)\.rpm$/) {
- my $key = "$1 $4"; #- get name including architecture.
- if ($rpms->{$key}) {
- if (version_compare($2, $rpms->{$key}{version}) > 0 ||
- version_compare($2, $rpms->{$key}{version}) == 0 && version_compare($3, $rpms->{$key}{release}) > 0) {
- if ($modifiable) {
- if ($flag->{sorted}) {
- print "you said rpms directory are sorted, so I keep obseleted $rpms->{$key}{file} by $_ in $rpms->{$key}{dir}\n" if $flag->{verbose};
- } else {
- if (-d $flag->{conflict}) {
- print "moving obseleted $rpms->{$key}{file} by $_ in $rpms->{$key}{dir}\n" if $flag->{verbose};
- mv("$rpms->{$key}{dir}/$rpms->{$key}{file}", $flag->{conflict});
- } elsif ($flag->{clean}) {
- print "removing obseleted $rpms->{$key}{file} by $_ in $rpms->{$key}{dir}\n" if $flag->{verbose};
- rm("$rpms->{$key}{dir}/$rpms->{$key}{file}");
- }
- }
+ if (/([^\/]*?)-([^-]*)-([^-]*)\.([^-]*)(?:\.src)?\.rpm$/) {
+ if ($rpms->{$1}) {
+ if (version_compare($rpms->{$1}{version}, $2) > 0 ||
+ version_compare($rpms->{$1}{version}, $2) == 0 && version_compare($rpms->{$1}{release}, $3) > 0) {
+ if ($flag->{clean}) {
+ print "removing obseleted $rpms->{$1}{file} by $_ in $rpms->{$1}{dir}\n" if $flag->{verbose};
+ rm("$rpms->{$1}{dir}/$rpms->{$1}{file}");
}
- $rpms->{$key} = { key => $key,
- name => $1,
- version => $2,
- release => $3,
- arch => $4,
- dir => $dir,
- file => $_,
- };
+ $rpms->{$1} = { name => $1,
+ version => $2,
+ release => $3,
+ arch => $4,
+ dir => $dir,
+ file => $_,
+ };
} else {
- if ($modifiable) {
- if (-d $flag->{conflict}) {
- print "copying older or equal $_ by $rpms->{$key}{file} in $flag->{conflict}\n" if $flag->{verbose};
- cp("$dir/$_", $flag->{conflict});
- chmod 0644, "$flag->{conflict}/$_";
- } elsif ($flag->{clean}) {
- print "removing older or equal $_ by $rpms->{$key}{file} in $dir\n" if $flag->{verbose};
- rm("$dir/$_");
- }
+ if ($flag->{clean}) {
+ print "removing older or equal $_ by $rpms->{$1}{file} in $dir\n" if $flag->{verbose};
+ rm("$dir/$_");
}
}
} else {
- $rpms->{$key} = { key => $key,
- name => $1,
- version => $2,
- release => $3,
- arch => $4,
- dir => $dir,
- file => $_,
- };
+ $rpms->{$1} = { name => $1,
+ version => $2,
+ release => $3,
+ arch => $4,
+ dir => $dir,
+ file => $_,
+ };
}
} else {
print STDERR "unable to parse filename $_\n";
@@ -121,39 +95,6 @@ sub get_rpms {
closedir D;
}
-#- sync packages list according to hashes of rpms.
-sub sync_medium {
- my ($rpmsdirs, $list, $rpms, $flag) = @_;
- my %pkg2dir;
-
- #- build a hash according to rpmsdirs and list for package name.
- my $i = 0;
- foreach (@$list) {
- local *F;
- open F, $_ or die "unable to open packages list file \"$_\"\n";
- foreach (<F>) {
- chomp;
- print STDERR "package \"$_\" is listed in mulitple list files!\n" if $pkg2dir{$_};
- $pkg2dir{$_} = $rpmsdirs->[$i];
- print "package \"$_\" listed in list files does not exists in rpms directory\n" if $flag->{verbose} && !$rpms->{$_};
- }
- close F;
-
- ++$i;
- }
-
- #- check for right directory, and move if necessary.
- foreach (values %$rpms) {
- unless ($pkg2dir{$_->{key}}) {
- print "file $_->{file} in $_->{dir} define package \"$_->{name}\" not listed in list files\n" if $flag->{verbose};
- } elsif ($_->{dir} ne $pkg2dir{$_->{key}}) {
- print "moving file $_->{file} in $_->{dir} to $pkg2dir{$_->{key}}\n" if $flag->{verbose};
- mv("$_->{dir}/$_->{file}", $pkg2dir{$_->{key}});
- $_->{dir} = $pkg2dir{$_->{key}};
- }
- }
-}
-
#- sync two hashes of rpms, update rpms and printer newer version that are not taken into account.
sub sync_rpms {
my ($source, $target, $flag) = @_;
@@ -166,7 +107,6 @@ sub sync_rpms {
}
if (-d $flag->{add}) {
cp("$source->{$_}{dir}/$source->{$_}{file}", $flag->{add});
- chmod 0644, "$flag->{add}/$source->{$_}{file}";
}
}
}
@@ -182,16 +122,15 @@ sub sync_rpms {
}
if ($flag->{update}) {
cp("$source->{$_}{dir}/$source->{$_}{file}", $target->{$_}{dir});
- chmod 0644, "$target->{$_}{dir}/$source->{$_}{file}";
unless (-e "$target->{$_}{dir}/$source->{$_}{file}") {
die "unable to copy $source->{$_}{file} from $source->{$_}{dir} into $target->{$_}{dir}\n";
}
- rm("$target->{$_}{dir}/$target->{$_}{file}") unless $source->{$_}{file} eq $target->{$_}{file}; #- copy on eq
+ rm("$target->{$_}{dir}/$target->{$_}{file}");
}
} elsif (version_compare($source->{$_}{version}, $target->{$_}{version}) != 0 ||
version_compare($source->{$_}{release}, $target->{$_}{release}) != 0) {
if ($flag->{verbose}) {
- print STDERR "keeping more up-to-date version $target->{$_}{dir}/$target->{$_}{file} against $source->{$_}{dir}/$source->{$_}{file}, check your repository !\n";
+ print STDERR "keeping more up-to-date version $target->{$_}{dir}/$source->{$_}{file} against $source->{$_}{dir}/$source->{$_}{file}, check your repository !\n";
}
} #- say nothing if source is equal to target.
}
@@ -201,9 +140,8 @@ sub sync_rpms {
foreach (keys %$target) {
unless ($source->{$_}) {
if ($flag->{verbose}) {
- print "removing $target->{$_}{file}" . ($flag->{remove} ? " from $target->{$_}{dir}\n" : " is neccessary!\n");
- my $k = $_;
- }
+ print "removing $target->{$_}{file}" . ($flag->{remove} ? " from $target->{$_}{dir}\n" : " is neccessary!\n")
+ }
if ($flag->{remove}) {
rm("$target->{$_}{dir}/$target->{$_}{file}");
}
@@ -215,24 +153,21 @@ sub sync_rpms {
sub main {
my @from_rpms;
my @to_rpms;
- my @list;
- my $target;
+ my $target_rpms;
my %flag;
my %source;
my %target;
foreach (@_) {
if (/^--(\w*)$/) {
- if ($1 eq 'verbose' || $1 eq 'update' || $1 eq 'remove' || $1 eq 'clean' || $1 eq 'sorted') {
+ if ($1 eq 'verbose' || $1 eq 'update' || $1 eq 'remove' || $1 eq 'clean') {
$flag{$1} = 1;
- } elsif ($1 eq 'add' || $1 eq 'conflict') {
- $flag{$1} = undef;
+ } elsif ($1 eq 'add') {
+ $flag{add} = undef;
} elsif ($1 eq 'from') {
- $target = \@from_rpms;
+ $target_rpms = \@from_rpms;
} elsif ($1 eq 'to') {
- $target = \@to_rpms;
- } elsif ($1 eq 'list') {
- $target = \@list;
+ $target_rpms = \@to_rpms;
} else {
die "unknown option: $1\n";
}
@@ -240,30 +175,26 @@ sub main {
if (exists $flag{add} && ! $flag{add}) {
$flag{add} = $_;
die "cannot add to non-directory: $_\n" unless -d $flag{add};
- } elsif (exists $flag{conflict} && ! $flag{conflict}) {
- $flag{conflict} = $_;
- die "cannot add to non-directory: $_\n" unless -d $flag{conflict};
} else {
- die "unknown parameter: $_\n" unless $target;
- push @$target, $_;
+ die "unknown parameter: $_\n" unless $target_rpms;
+ push @$target_rpms, $_;
}
}
}
- die "usage: syncrpms [--update] [--remove] [--clean] [--sorted] [--add <dir>] [--conflict <dir>] --from <dir_sources> --to <dir_targets> [--list <files>]\n"
- unless scalar(@from_rpms) > 0 || scalar(@to_rpms) > 0;
+ die "usage: syncrpms [--update] [--remove] [--clean] [--add <dir>] --from <dir_sources> --to <dir_target>\n"
+ unless scalar(@from_rpms) > 0 && scalar(@to_rpms) > 0;
#- parse directory structures.
- get_rpms($_, \%source, \%flag, 0) foreach @from_rpms;
+ get_rpms($_, \%source, \%flag) foreach @from_rpms;
+ get_rpms($_, \%target, \%flag) foreach @to_rpms;
+
print STDERR "reading " . scalar(keys %source) . " packages as source rpms from\n";
print STDERR " $_\n" foreach @from_rpms;
-
- get_rpms($_, \%target, \%flag, 1) foreach @to_rpms;
print STDERR "reading " . scalar(keys %target) . " packages as target rpms from\n";
print STDERR " $_\n" foreach @to_rpms;
- sync_medium(\@to_rpms, \@list, \%target, \%flag) if scalar(@list) > 0 && scalar(@to_rpms) > 0;
- sync_rpms(\%source, \%target, \%flag) if scalar(@from_rpms) > 0 && scalar(@to_rpms) > 0;
+ sync_rpms(\%source, \%target, \%flag);
}
main(@ARGV);