Devuan bans some packages so I need to host them myself, with the dependencies
altered to work in Devuan. Specifically, I wrote this solution for
python3-ipalib (python-ipalib originally, back in February 2019). I wrote a
process that helps Devuan join a freeipa
domain. It involves manually manipulating the install dependencies for
package python3-ipalib. There's no need to rebuild the package; you can just
alter the listed dependencies. This script turns the manual process into a
single command.
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 |
#!/bin/sh
# File: /mnt/public/www/example/repo/devuan-deb/newest-package-for-devuan.sh
# License: CC-BY-SA 4.0
# Author: bgstack15
# Startdate: 2019-11-29 21:28
# Title: Script that Manipulates Dependencies for a Binary Dpkg
# Purpose: Download latest version of python3-ipalib and modify it for internal use
# History:
# Usage:
# /mnt/public/www/example/repo/devuan-deb/
# Next steps include running update-devuan-deb.sh to update the apt repo.
# Reference:
# Original research
# dpkg-architecture --list-known
# Improve:
# Dependencies:
# curl, dpkg-deb, sed, grep
# FUNCTIONS
#customize_package "${PACKAGE}" "${DEPENDS_REMOVE}" "${DEPENDS_ADD}" "${SOURCE_DIR}" "${OUT_DIR}"
customize_package() {
# weaknesses: this might struggle with adding or removing "foobar (>= 0.1.1~bz2)" or other complex version numbers.
___cp_package="${1}"
___cp_depends_remove="${2}"
___cp_depends_add="${3}"
___cp_source_dir="${4}"
___cp_out_dir="${5}"
# Learn latest version to fetch
___cp_newfile="$( curl -L -s "${___cp_source_dir}" | grep -oE ">${___cp_package}.*<\/a" | sed -r -e 's/^>//;' -e 's/<\/a$//;' )" echo "Discovered filename ${___cp_newfile}" curl -L -s "${___cp_source_dir}/${___cp_newfile}" -o "${___cp_newfile}" 1>/dev/null 2>&1
___cp_tmpdir="temp_${$}_deb"
mkdir -p "${___cp_tmpdir}"
dpkg-deb -R "${___cp_newfile}" "${___cp_tmpdir}"
# Remove the requested dependencies
echo "${___cp_depends_remove}" | tr ',' '\n' | while read word ;
do
if test "${word}" != "" ;
then
echo "Removing dependency ${word}"
sed -i -r -e "s/[:,]\s+${word}[^,]{0,13}(,)?/\1/;" "${___cp_tmpdir}/DEBIAN/control"
fi
done
# Add the requested dependencies
echo "${___cp_depends_add}" | tr ',' '\n' | while read word ;
do
if test "${word}" != "" ;
then
echo "Adding dependency ${word}"
sed -i -r -e "/^Depends:/s/$/, ${word}/" "${___cp_tmpdir}/DEBIAN/control"
fi
done
# Remove trailing comma, just in case
sed -i -r -e '/^Depends:/s/,\s*$//;' "${___cp_tmpdir}/DEBIAN/control"
# Calculate new file name
___cp_newfile2="$( echo "${___cp_newfile}" | sed -r -e 's/((_(amd64|i386|all))?\..{1,6})$/+stackrpms\1/;' )"
dpkg-deb -b "${___cp_tmpdir}" "${___cp_newfile2}"
# Move to outdir
test -e "${___cp_newfile2}" && mv "${___cp_newfile2}" "${___cp_out_dir}/"
# Clean up
rm -rf "${___cp_tmpdir}" "${___cp_newfile}"
}
PACKAGE=python3-ipalib
DEPENDS_REMOVE="systemd"
DEPENDS_ADD=""
SOURCE_DIR="http://ftp.us.debian.org/debian/pool/main/f/freeipa"
OUT_DIR="/mnt/public/www/example/repo/devuan-deb/p"
customize_package "${PACKAGE}" "${DEPENDS_REMOVE}" "${DEPENDS_ADD}" "${SOURCE_DIR}" "${OUT_DIR}"
|
If for some reason new packages come up with different dependencies I need to
alter, it will just be a one-liner at the bottom.
References
Weblinks
https://gitlab.com/bgstack15/former-gists/tree/master/newest-package-for-
devuan
Comments