-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-deb.sh
executable file
·69 lines (52 loc) · 1.5 KB
/
make-deb.sh
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
#!/bin/bash
set -e
if [ -z "$1" ]; then
echo "Missing version argument... Exiting."
exit 1
fi
dirn="lxc-nextdom"
vers=$1
set_root() {
local this=`readlink -n -f $1`
root=`dirname $this`
}
set_root $0
new=${root}/${dirn}-${vers}
if [ ! -d "${new}" ]; then
mkdir -p ${new}
fi
echo "Creation du contenu dans le repertoire ${new}"
#read -n1 -r -p "Press space to continue..." key
set -e
# -----------------------------------------------------------------------------------------
if [ -d "${root}/templates/${dirn}" ] ; then
cp -ax ${root}/templates/${dirn}/* ${new}/
else
echo "<F> Directory not present : ${root}/templates/${dirn} !"
exit 1
fi
# Debian config files
CONTROL="${new}/DEBIAN/control"
POSTINST="${new}/DEBIAN/postinst"
POSTRM="${new}/DEBIAN/postrm"
PREINST="${new}/DEBIAN/preinst"
PRERM="${new}/DEBIAN/prerm"
# Generation of control Debian file
sed -i "s/^Package:.*/Package: ${dirn}/g" ${CONTROL}
sed -i "s/^Version:.*/Version: ${vers}/g" ${CONTROL}
# Empty conf file
CONF="${new}/etc/lxc-nextdom/lxc-nextdom.conf"
sed -i "s/^primary=.*/primary=/g" ${CONF}
sed -i "s/^mac=.*/mac=/g" ${CONF}
sed -i "s/^dhcp=.*/dhcp=/g" ${CONF}
# Correction sur les droits
chmod 755 ${PREINST}
chmod 755 ${POSTINST}
chmod 755 ${PRERM}
chmod 755 ${POSTRM}
find ${new}/ -name "*.sh" -exec chmod 755 {} \;
chmod 755 ${new}/usr/bin/create-nextdom-container
chmod 755 ${new}/usr/bin/delete-nextdom-container
chmod 755 ${new}/etc/lxc-nextdom/bin/*.sh
dpkg-deb --build ${new}
echo " >>> COMPLETED <<<"