-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompact.sh
More file actions
executable file
·42 lines (31 loc) · 778 Bytes
/
compact.sh
File metadata and controls
executable file
·42 lines (31 loc) · 778 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
#!/bin/bash
if [ -z "${1}" ]
then
echo "Usage: $0 <package/basename>"
exit 1
fi
package="$(<<< "${1}" sed -e 's/\.deb$//')"
if ! [ -d "${package}_mod" ]
then
echo "${package} was not extracted"
exit 1
fi
pushd "${package}_mod"
pushd output
newname="$(grep -oP 'Package: \K.+' control/control)"
newvers="$(grep -oP 'Version: \K.+' control/control)"
newarch="$(grep -oP 'Architecture: \K.+' control/control)"
newfile="${newname}_${newvers}_${newarch}"
pushd data
for checksum in md5sum sha256sum sha512sum
do
find * -type f -exec "${checksum}" {} \; > "../control/${checksum}s"
done
tar zcf ../data.tar.gz .
popd
pushd control
tar zcf ../control.tar.gz .
popd
ar rcs "${newfile}.deb" debian-binary control.* data.*
popd
popd