-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcopyall.sh
executable file
·86 lines (69 loc) · 2.98 KB
/
copyall.sh
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
#!/bin/bash
arch="$1"
#source the ips.sh
. ./ips.sh
ips_contents=$(cat ./ips.sh)
for line in $ips_contents; do
vm_name="$(cut -d'=' -f1 <<<$line)"
version="$(cut -d'_' -f4 <<<$vm_name)"
hardware="$(cut -d'_' -f5 <<<$vm_name)"
update_number="$(cut -d'_' -f6 <<<$vm_name)"
echo "$vm_name : $version : $hardware: $update_number"
#Define the source directory
if [[ "$hardware" == "x64" ]]; then
arch_source_dir="x86_64"
arch_destination_dir=$arch_source_dir
else
arch_source_dir="i686"
arch_destination_dir="x86"
fi
lis_rpm_build_source="/root/rpmbuild/RPMS/$arch_source_dir"
lis_srpm_source="/root/rpmbuild/SRPMS"
echo "lis_rpm_build_source: $lis_rpm_build_source"
echo "lis_srpm_source: $lis_srpm_source"
#Define the destination directory
lis_srpm_build_destination="LISISO/RPMS${version}"
lis_rpm_build_destination="LISISO/RPMS${version}"
if [[ "$version" =~ ^5.* ]]; then
if [[ "$update_number" =~ "update" ]]; then
lis_rpm_build_destination="${lis_rpm_build_destination}_UPDATE"
fi
lis_srpm_build_destination="${lis_rpm_build_destination}/"
lis_rpm_build_destination="${lis_rpm_build_destination}/lis-$version/${arch_destination_dir}"
elif [[ "$version" =~ ^6.* ]]; then
if [[ "$update_number" =~ "update" ]]; then
lis_rpm_build_destination="$lis_rpm_build_destination/$update_number"
fi
elif [[ "$version" =~ ^7.* ]]; then
if [[ "$update_number" =~ "update" ]]; then
lis_rpm_build_destination="$lis_rpm_build_destination/$update_number"
fi
else
echo "EXCEPTION: Incorrect Version : $version - $vm_name - $line "
exit 1
fi
ip=$(eval echo \$$vm_name)
echo "${ip}:${lis_rpm_build_source} -> $lis_rpm_build_destination"
# In case of new update, update folder will not be present.
# Create a new update<number> folder.
[ ! -d $lis_rpm_build_destination ] && mkdir -p $lis_rpm_build_destination
#Copy the new generated RPMs
scp -r root@${ip}:${lis_rpm_build_source}/* $lis_rpm_build_destination
#Generate the errata kernel list which will used for installation.
if [[ "$update_number" =~ "update" ]]; then
lis_rpm_install_destination="LISISO/RPMS${version}"
kernel=$(ssh root@$ip "uname -r" 2> /dev/null)
echo "errata_kerver_$update_number=$kernel" >> "$lis_rpm_install_destination/errata_kernel_list"
# RH5X needs to be handled differently as updates are created as seperate RPMS folder.
if [[ ! "$version" =~ ^5.* ]]; then
#Source rpms need not to be copied for the update folder.
lis_srpm_build_destination=""
fi
fi
#Copy the SRPMs
if [[ x"$lis_srpm_build_destination" != x ]];then
scp -r root@${ip}:${lis_srpm_source}/* $lis_srpm_build_destination
fi
# For 32 bit build RPMS7X folders are not required and should be cleaned up.
[[ ! -z ${arch} && ${arch} == "x32" ]] && rm -rf LISISO/RPMS7* || echo "${arch} build"
done