-
Notifications
You must be signed in to change notification settings - Fork 25
/
extract_transaction_scripts_and_triggers.sh
executable file
·104 lines (83 loc) · 4.42 KB
/
extract_transaction_scripts_and_triggers.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# This script extracts transaction scripts of deb packages to a file, so it is possible to read it and compare with previous version.
# After that its needed to carefully convert them to pacman .install files or hooks if needed
. ./versions
majornew=$pkgver_base
minornew=$pkgver_build
ubuntuvernew=$ubuntu_ver
majorold=$old_pkgver_base
minorold=$old_pkgver_build
ubuntuverold=$old_ubuntu_ver
function extract_them() {
major="$1"
minor="$2"
ubuntu="$3"
FOLDER=amdgpu-pro-$major-$minor-ubuntu-$ubuntu
cd $FOLDER
cd unpacked_debs
rm -f *.install_scripts.sh
rm -rf ../install_scripts_"$major"-"$minor"
rm -rf ../install_scripts
mkdir -p ../install_scripts
> transaction_scripts_and_triggers_md5sums.txt # clear file
echo -e "md5sums of transaction scripts and triggers of deb packages from archive ${ARCHIVE}\n" > transaction_scripts_and_triggers_md5sums.txt
for dir in $(ls); do
for file in postinst preinst prerm; do
if [ -f $dir/$file ]; then
file_md5=$(md5sum $dir/$file)
# echo -e "# $file_md5" >> $dir.install_scripts.sh
echo -e "$file_md5" >> transaction_scripts_and_triggers_md5sums.txt
#cat $dir/$file >> $dir.install_scripts.sh
cat $dir/$file > ../install_scripts/"$dir"_"$file".sh
fi
done
done
cd ..
# As of 19.30-934563, all (except two) libs debian packages have just ldconfig awaiting trigger. It is done automatically by pacman, so we skip them.
# Two exceptions are:
#libgl1-amdgpu-mesa-dri_18.3.0-812932_amd64.deb
#interest /usr/lib/x86_64-linux-gnu/dri
#libgl1-amdgpu-mesa-dri_18.3.0-812932_i386.deb
#interest /usr/lib/i386-linux-gnu/dri
# They are triggered when files are changed in interest path. I (Ashark) created corresponding alpm hooks.
cd unpacked_debs
for dir in $(ls -d *deb);
do
if [ -f "$dir"/triggers ]; then
if [[ $(cat "$dir"/triggers) == "# Triggers added by dh_makeshlibs/13.6ubuntu1
activate-noawait ldconfig" ]];
then continue; fi
file_md5=$(md5sum $dir/triggers)
echo -e "$file_md5" >> transaction_scripts_and_triggers_md5sums.txt
cat $dir/triggers > ../install_scripts/"$dir"_"triggers".sh
fi
done
sed -i -e "1 ! s/$major/XX.XX/g" -e "1 ! s/$minor/XXXXXX/g" transaction_scripts_and_triggers_md5sums.txt
cd ..
rename "$major" "XX.XX" install_scripts/*.sh
rename "$minor" "XXXXXX" install_scripts/*.sh
rename "_2.1.0" "_C.C.C" install_scripts/*.sh # new comgr version
rename "_2.0.0" "_C.C.C" install_scripts/*.sh # old comgr version
rename "1.2.0" "_H.H.H" install_scripts/*.sh # old hsa-runtime-rocr-amdgpu version
rename "1.3.0" "_H.H.H" install_scripts/*.sh # new hsa-runtime-rocr-amdgpu version
rename "21.1.0" "YY.Y.Y" install_scripts/*.sh # new mesa version
rename "20.3.4" "YY.Y.Y" install_scripts/*.sh # old mesa version
rename "5.11.19.98" "Y.Y.Y.YY" install_scripts/*.sh # new amdgpu-dkms version
rename "5.11.5.26" "Y.Y.Y.YY" install_scripts/*.sh # old amdgpu-dkms version
rename "rocm_13.0" "rocm_RR.R" install_scripts/*.sh # new libllvm-amdgpu-pro-rocm
rename "rocm_12.0" "rocm_RR.R" install_scripts/*.sh # old libllvm-amdgpu-pro-rocm
rename "libllvm12.0-amdgpu_12.0" "libllvmZZ.Z-amdgpu_ZZ.Z" install_scripts/*.sh # new llvm-amdgpu version
rename "libllvm11.0-amdgpu_11.0" "libllvmZZ.Z-amdgpu_ZZ.Z" install_scripts/*.sh # old llvm-amdgpu version
rename "12.0-runtime_12.0" "LL.L-runtime_LL.L" install_scripts/*.sh # new llvm-amdgpu-XX.X-runtime_XX.X
rename "11.0-runtime_11.0" "LL.L-runtime_LL.L" install_scripts/*.sh # old llvm-amdgpu-XX.X-runtime_XX.X
rename "dev_12.0" "dev_DD.D" install_scripts/*.sh # new llvm-amdgpu-dev_XX.X
rename "dev_11.0" "dev_DD.D" install_scripts/*.sh # old llvm-amdgpu-dev_XX.X
mv install_scripts install_scripts_"$major"-"$minor"
cd ..
}
# Specify the versions to run for (comment one of them if you want to disable running for it).
# extract_them $majorold $minorold # Run for old version
extract_them $majornew $minornew $ubuntuvernew # Run for new version
echo "Opening meld for comparison..."
pwd
meld amdgpu-pro-$majorold-$minorold-ubuntu-$ubuntuverold/install_scripts_"$majorold"-"$minorold" amdgpu-pro-$majornew-$minornew-ubuntu-$ubuntuvernew/install_scripts_"$majornew"-"$minornew"