blob: 33633532960a7c3ec2904315cea9d27eacfcf464 (
plain)
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
105
|
#!/bin/bash
set -e
apt()
{
(set -x; command apt "$@")
}
[ "$(id -u)" = 0 ] || exec sudo bash "$0" "$@"
basics='etckeeper git par ssh tmux vim w3m'
#xorg='xorg xterm i3'
xorg='xorg xterm'
media='libdbus-glib-1-2 mpv pulseaudio'
apt install --no-upgrade $basics $xorg $media
apt_backport()
{
(
set -e
apt install --no-upgrade debhelper
SOURCES_DIR=$1
TARGET_URL=$2
TARGET_PKG=$3
case "$TARGET_PKG" in
'' | */*) exit 1 ;;
esac
mkdir -p "$SOURCES_DIR"
cd "$SOURCES_DIR"
if [ -e "$TARGET_PKG" ]
then
cd "$TARGET_PKG"
git pull --ff-only
else
rm -rf "$TARGET_PKG"~tmp
git clone --depth=1 "$TARGET_URL" "$TARGET_PKG"~tmp
mv -T "$TARGET_PKG"~tmp "$TARGET_PKG"
cd "$TARGET_PKG"
fi
arch=$(dpkg-architecture -q DEB_BUILD_ARCH)
version=$(dpkg-parsechangelog --show-field Version)
pkgs=$(dh_listpackages)
debs=
for pkg in $pkgs
do
debs="$debs ${pkg}_${version}_${arch}.deb"
done
set -x
pwd
for deb in $debs
do
[ -e ../"$deb" ] && continue || true
# We are missing a deb, therefore build.
if command -v mk-build-deps >/dev/null
then
mk-build-deps "$TARGET_PKG" --install
else
# We could 'apt install devscripts' but it pulls
# in like 50MB of perl deps, possibly nullifying
# the savings from removing unneeded build deps.
# However, we cannot simply use 'apt build-dep'
# because that would use the build-deps from the
# version of the package in the repo, which may
# differ from the source version.
# Arguably we do want to try that though, since
# it's a backport...
if [ "$try_newer_build_deps" ]
then
build_deps=$(get_build_deps)
apt install $build_deps
else
apt build-dep "$TARGET_PKG"
fi
fi
fakeroot ./debian/rules binary
break
done
set --
for deb in $debs
do
set -- "$@" ../"$deb"
done
apt install "$@"
)
}
get_build_deps()
{
# credit: Archemar @ https://unix.stackexchange.com/a/648927
build_deps=$(dpkg-checkbuilddeps 2>&1 |
sed -n -e 's/dpkg-checkbuilddeps:\serror:\sUnmet build dependencies: //gp' \
-e 's/[\(][^)]*[\)] //g')
}
try_newer_build_deps=y
apt_backport /usr/local/src https://salsa.debian.org/i3-team/i3-wm.git i3-wm
|