-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-deb-depends
More file actions
executable file
·45 lines (37 loc) · 1.58 KB
/
Copy pathcreate-deb-depends
File metadata and controls
executable file
·45 lines (37 loc) · 1.58 KB
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
#!/bin/bash
# Idea from https://github.com/tpo/betriebssysteme/blob/master/ansible_demo/library/dpkg_dep
help() {
echo "Usage: create-deb-depends name version depends [file.deb]"
echo
echo "Create a deb package for Debian / Ubuntu only containing dependency"
echo "information. This helps recognizing relationship of packages and"
echo "installed software. It also avoids accidental uninstalls."
echo
echo "Examples: "
echo
echo " create-deb-depends mutt-dependencies 1.3.17-1 \"libc6 (>= 2.2.1), exim | mail-transport-agent\"" test.deb
echo " create-deb-depends config5-dependencies 0.1 \"perl-modules, libtemplate-perl, lsb-release, curl, udev\""
echo
exit 1
}
[ "$1" == "--help" ] && help
[ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] && help
DEB="${1}_${2}_all"
mkdir -p "/tmp/$DEB/DEBIAN"
echo "Package: $1" >> "/tmp/$DEB/DEBIAN/control"
echo "Priority: optional" >> "/tmp/$DEB/DEBIAN/control"
echo "Section: dependencies" >> "/tmp/$DEB/DEBIAN/control"
echo "Installed-Size: 0" >> "/tmp/$DEB/DEBIAN/control"
echo "Maintainer: unknown" >> "/tmp/$DEB/DEBIAN/control"
echo "Architecture: all" >> "/tmp/$DEB/DEBIAN/control"
echo "Source: none" >> "/tmp/$DEB/DEBIAN/control"
echo "Version: $2" >> "/tmp/$DEB/DEBIAN/control"
echo "Depends: $3" >> "/tmp/$DEB/DEBIAN/control"
echo "Description: dependencies for $1" >> "/tmp/$DEB/DEBIAN/control"
( cd "/tmp" ; dpkg-deb -b "$DEB" > /dev/null )
mv "/tmp/${DEB}.deb" .
rm -rf "/tmp/$DEB"
[ -z "$4" ] || mv "${DEB}.deb" "$4"
DEB="${DEB}.deb"
[ -z "$4" ] || DEB="$4"
echo "Done. Use \"dpkg -i $DEB ; apt-get install -f\" to install all dependencies"