-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebbackport
More file actions
executable file
·43 lines (31 loc) · 866 Bytes
/
debbackport
File metadata and controls
executable file
·43 lines (31 loc) · 866 Bytes
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
#!/usr/bin/env bash
ask() {
read -r -n1 -p "$1 " ans
printf '\n'
[[ ${ans^} == Y* ]]
}
declare pkg="$*"
declare version
declare -a versions
declare builddir='/tmp/backport-build/'
if [[ -z "$pkg" ]]; then
printf 'nothing to search for\n'
exit 1
fi
set -e
mapfile -t versions < <(apt-cache showsrc "$pkg" | awk '/^Version/{ print $2 }' | sort -uh)
printf '%s has the following versions available:\n' "$pkg"
PS3="choose a number between 1 and ${#versions[@]}: "
select v in "${versions[@]}"; do
version="$v";
break
done
[[ -z $version ]] && exit
builddir+="$pkg"
mkdir -p "$builddir" && cd "$builddir"
sudo apt-get build-dep "$pkg"
apt-get source "${pkg}=${version}"
cd "${pkg}-${version%-*}"
[[ -e debian/rules ]] && ask 'edit debian/rules?' && $EDITOR debian/rules
dpkg-buildpackage -uc -us -tc
sudo dpkg -i ../"${pkg}_${version%-*}"-*.deb