File: BACKUP

package info (click to toggle)
cti-ifhp 2.2.8-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 904 kB
  • ctags: 673
  • sloc: ansic: 4,916; sh: 1,539; makefile: 287; perl: 99
file content (33 lines) | stat: -rwxr-xr-x 980 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/contrib/bin/perl5
($newvernum, $oldvernum) = @ARGV;
($dir) = `pwd`;
chomp $dir;
print "dir $dir\n";
($path, $prog) = ($dir =~ m,(.*)/(.*),);
($name, $ver) = ($prog =~ m,(.*)-(.*),);
print "prog $prog, name $name, ver $ver\n";
@subs = split( /\./, $ver );
@new = @subs;
@old = @subs;
$old[$#old] --;
$newvernum = join( '.', @new ) unless $newvernum;
$oldvernum = join( '.', @old ) unless $oldvernum;
$oldprog = $name . "-" . $oldvernum;
$olddir = $path . "/" . $oldprog;
print "prog $prog, name $name, ver $ver, oldprog $oldprog, olddir $olddir\n";

@err = `mv $dir $olddir`;
if( $? ){ die "mv $dir $newdir failed - @err $!\n"; }
if( -l "$path/$name" ){
 	print "removing link $path/$name\n";
 	@err = `rm $path/$name`;
	if( $? ){ die "rm link $prog failed - @err $!\n"; }
}
@err = `chdir ..; ln -s $oldprog $name`;
if( $? ){ die "ln -s $oldprog $name failed - @err $!\n"; }

# make new version
`gmake update 2>&1 1>/dev/tty`;
if( $? ){
	die "gmake update failed - $!\n";
}