-
Notifications
You must be signed in to change notification settings - Fork 35
/
make_deb
executable file
·95 lines (85 loc) · 1.93 KB
/
make_deb
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
#!/usr/bin/env bash
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
export COPYFILE_DISABLE=true
drop="$HOME/Dropbox/EdgeOS"
arch=${2}
dep=''
desc='Adds EdgeOS dnsmasq blacklist configuration templates for "service dns forwarding"'
dir='/tmp/'
dist='deb'
exc1=\**/.DS_Store
exc2=\**/*.bak
exe=${1}
host='dev1'
lic='https://opensource.org/licenses/BSD-2-Clause'
pkg='edgeos-dnsmasq-blacklist'
mntr="${pkg}@helmrock.com"
# preinst='./.payload/pre-install.sh'
postinst='./.payload/post-install.sh'
postrm='./.payload/post-remove.sh'
prerm='./.payload/pre-remove.sh'
prov=${pkg}
purge='./.payload/purge.sh'
pwd=$(pwd)
sdir="${pwd}/.payload"
src1='opt/'
src2='config/'
scripts="${sdir}/${src2}/scripts"
url='https://github.com/britannic/blacklist'
vend='Helm Rock Consulting'
ver=$(cat VERSION)
pver=$(cat OLDVERSION)
zver='s/'${pkg}'_'${pver}'_/'${pkg}'_'${ver}'_/g'
deb="${pkg}_${ver}_${arch}.${dist}"
bundle() {
cwd=$(pwd)
local dir='./.payload/'
local templt='decompress_pre-install'
cat "${templt}" >"${postinst}"
cd "${dir}"
tar -zc \
--exclude='._*' \
--exclude='.svn' \
--exclude='.DS_Store' \
--exclude='*.bak' \
--exclude='*~' \
./* >>"${cwd}/${postinst}"
cd "${cwd}"
}
# --after-remove "${postrm}"
# --before-install "${preinst}" \
# --deb-pre-depends "${dep}" \
# --before-remove "${prerm}" \
make_debian() {
fpm \
-f \
--description "${desc}" \
--license "${lic}" \
--after-install "${postinst}" \
--deb-after-purge "${purge}" \
--before-remove "${prerm}" \
--provides "${prov}" \
--url "${url}" \
--vendor "${vend}" \
--verbose \
-a "${arch}" \
-C "${sdir}" \
-m "${mntr}" \
-n "${pkg}" \
-t "${dist}" \
-v "${ver}" \
-x "${exc1}" \
-x "${exc2}" \
-s dir "${src1}" "${src2}"
}
compress_deb() {
tar -zcvf "${deb}.tgz" "${deb}"
}
update_dropbox() {
[[ -d "${drop}/" ]] && install -m 0755 "${deb}.tgz" "${drop}/"
}
upload() {
scp "${deb}" "${host}:${dir}"
}
# Build it!
make_debian && compress_deb