-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenpkg.sh
executable file
·72 lines (61 loc) · 2.08 KB
/
genpkg.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
#!/bin/bash
# Exit immediately on first error
set -e
#
# Script parameters
#
###################
# Boost libraries
BOOST_LIBS="filesystem system iostreams locale program-options thread"
# We are generating symlinks that point this version of the library:
UPSTREAM_OLD_VERS="1.67.0"
# ... to this newer version:
UPSTREAM_NEW_VERS="1.74.0"
# Revision of the generated bedian packages
DEBIAN_REVISION="1"
# Directory where we store all files generated by this script; ignored by git
TARGET="target"
# Save all generated .deb packages in this directory
PKGDIR="libboost${UPSTREAM_OLD_VERS}-debian11-${UPSTREAM_OLD_VERS}-${DEBIAN_REVISION}"
#
# Script execution
#
###################
rm -rf "${TARGET}"
mkdir -p "${TARGET}/${PKGDIR}"
for L in ${BOOST_LIBS}
do
LL=$(echo "${L}" | tr "-" "_")
OLD_PKG_NAME="libboost-${L}${UPSTREAM_OLD_VERS}"
OLD_PKG_FULL_NAME="${OLD_PKG_NAME}-${UPSTREAM_OLD_VERS}-${DEBIAN_REVISION}"
OLD_LIB_NAME="libboost_${LL}.so.${UPSTREAM_OLD_VERS}"
NEW_PKG_NAME="libboost-${L}${UPSTREAM_NEW_VERS}"
NEW_LIB_NAME="libboost_${LL}.so.${UPSTREAM_NEW_VERS}"
mkdir -p "${TARGET}/${OLD_PKG_FULL_NAME}/DEBIAN"
cat > "${TARGET}/${OLD_PKG_FULL_NAME}/DEBIAN/control" << EOF
Section: misc
Priority: optional
Standards-Version: 3.9.2
Package: ${OLD_PKG_NAME}
Version: ${UPSTREAM_OLD_VERS}-${DEBIAN_REVISION}
Architecture: all
Maintainer: Dario Nicodemi
Depends: ${NEW_PKG_NAME} (>= ${UPSTREAM_NEW_VERS})
Description: compat symlink ${UPSTREAM_OLD_VERS} -> ${UPSTREAM_NEW_VERS}
EOF
cat > "${TARGET}/${OLD_PKG_FULL_NAME}/DEBIAN/postinst" << EOF
#!/bin/sh
(cd "/lib/\$(dpkg-architecture -qDEB_HOST_MULTIARCH)" && ln -sf "${NEW_LIB_NAME}" "${OLD_LIB_NAME}")
EOF
chmod 0755 "${TARGET}/${OLD_PKG_FULL_NAME}/DEBIAN/postinst"
cat > "${TARGET}/${OLD_PKG_FULL_NAME}/DEBIAN/prerm" << EOF
#!/bin/sh
(cd "/lib/\$(dpkg-architecture -qDEB_HOST_MULTIARCH)" && rm "${OLD_LIB_NAME}")
EOF
chmod 0755 "${TARGET}/${OLD_PKG_FULL_NAME}/DEBIAN/prerm"
dpkg-deb --build "${TARGET}/${OLD_PKG_FULL_NAME}" "${TARGET}/${PKGDIR}"
done
(
cd ${TARGET}
tar czvf "${PKGDIR}.tar.gz" "${PKGDIR}"
)