forked from cms-sw/cmsdist
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cms-apt-migration.file
87 lines (80 loc) · 4.28 KB
/
cms-apt-migration.file
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
if [ X"$(id -u)" = X0 ]; then
echo "*** CMS SOFTWARE INSTALLATION ABORTED ***" 1>&2
echo "CMS software cannot be installed as the super-user." 1>&2
echo "(We recommend reading any standard unix security guide.)" 1>&2
exit 1
fi
repository=cms
rootdir=$PWD
while [ $# -gt 0 ]
do
arg=$1
shift
case $arg in
-path)
[ $# -gt 0 ] || { echo "Option \`$arg' requires an argument" 1>&2; exit 1; }
if [ "`echo $1 | cut -b 1`" != "/" ]; then
rootdir="$PWD/$1"
else
rootdir="$1"
fi
;;
-repository)
[ $# -gt 0 ] || { echo "Option \`$arg' requires an argument" 1>&2; exit 1; }
echo "WARNING: the repository option should be used only for testing!!"
repository=$1
;;
*)
echo "Unrecognized option: $1."
exit 1
;;
esac
shift
done
cd $rootdir
# Install the new apt/rpm packages.
rpmOptions="-r $rootdir --prefix $rootdir --dbpath $rootdir/@CMSPLATF@/var/lib/rpm --ignoreos --ignorearch"
rpmlock=$rootdir/@CMSPLATF@/var/lib/rpm/__db.0
url=http://cmsrep.cern.ch/cmssw/$repository/RPMS/@CMSPLATF@
downloadDir=$VO_CMS_SW_DIR/tmp/apt-migration
mkdir -p $downloadDir
mkdir -p $rootdir/@CMSPLATF@/var/tmp
old=$PWD
cd $downloadDir
wget -N $url/external+gcc+@GCC_VERSION@-1-@GCC_REVISION@.@[email protected]
wget -N $url/external+elfutils+@ELFUTILS_VERSION@-1-@ELFUTILS_REVISION@.@[email protected]
wget -N $url/external+expat+@EXPAT_VERSION@-1-@EXPAT_REVISION@.@[email protected]
wget -N $url/external+db4+@DB4_VERSION@-1-@DB4_REVISION@.@[email protected]
wget -N $url/external+beecrypt+@BEECRYPT_VERSION@-1-@BEECRYPT_REVISION@.@[email protected]
wget -N $url/external+zlib+@ZLIB_VERSION@-1-@ZLIB_REVISION@.@[email protected]
wget -N $url/external+bz2lib+@BZ2LIB_VERSION@-1-@BZ2LIB_REVISION@.@[email protected]
wget -N $url/external+openssl+@OPENSSL_VERSION@-1-@OPENSSL_REVISION@.@[email protected]
wget -N $url/external+neon+@NEON_VERSION@-1-@NEON_REVISION@.@[email protected]
wget -N $url/external+rpm+@RPM_VERSION@-1-@RPM_REVISION@.@[email protected]
wget -N $url/external+libxml2+@LIBXML2_VERSION@-1-@LIBXML2_REVISION@.@[email protected]
wget -N $url/external+apt+@APT_VERSION@-1-@APT_REVISION@.@[email protected]
cd $old
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+gcc+@GCC_VERSION@-1-@GCC_REVISION@.@[email protected]
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+elfutils+@ELFUTILS_VERSION@-1-@ELFUTILS_REVISION@.@[email protected]
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+expat+@EXPAT_VERSION@-1-@EXPAT_REVISION@.@[email protected]
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+db4+@DB4_VERSION@-1-@DB4_REVISION@.@[email protected]
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+beecrypt+@BEECRYPT_VERSION@-1-@BEECRYPT_REVISION@.@[email protected]
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+zlib+@ZLIB_VERSION@-1-@ZLIB_REVISION@.@[email protected]
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+bz2lib+@BZ2LIB_VERSION@-1-@BZ2LIB_REVISION@.@[email protected]
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+openssl+@OPENSSL_VERSION@-1-@OPENSSL_REVISION@.@[email protected]
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+neon+@NEON_VERSION@-1-@NEON_REVISION@.@[email protected]
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+rpm+@RPM_VERSION@-1-@RPM_REVISION@.@[email protected]
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+libxml2+@LIBXML2_VERSION@-1-@LIBXML2_REVISION@.@[email protected]
rpm -Uvh --define "_rpmlock_path $rpmlock" $rpmOptions $downloadDir/external+apt+@APT_VERSION@-1-@APT_REVISION@.@[email protected]
# Remove the old indexes for the rpmdb.
indexes="Basenames Dirnames Group Name Providename Pubkeys Requireversion Sigmd5 __db.001 __db.003
Conflictname Filemd5s Installtid Provideversion Requirename Sha1header Triggername __db.002
lock"
for olddbfile in $indexes
do
rm -f @CMSPLATF@/var/lib/rpm/$olddbfile
done
# Rebuild the db using the new rpm.
source $rootdir/@CMSPLATF@/external/rpm/@RPM_VERSION@/etc/profile.d/init.sh
rpm --dbpath $rootdir/@CMSPLATF@/var/lib/rpm --rebuilddb