-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmake.sh
58 lines (54 loc) · 1.99 KB
/
make.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
#!/usr/bin/env bash
##############################################################################################################
function priv_clippit
(
cat <<EOF
Usage: bash ${0} [OPTIONS]
Options:
build Build program
EOF
)
function priv_dpkg
(
# Linux shell script to create .deb package
# Go to the repository local folder. For example, cd /home/User/ShellRemoteBot
declare -r STAGING_DIR=./deb.staging
find "${STAGING_DIR}" -type d -exec chmod 0755 {} +
find "${STAGING_DIR}" -type f -exec chmod 0644 {} +
find "${STAGING_DIR}/usr/bin" -type f -exec chmod 0755 {} +
echo "Installed-Size: $(du -s ${STAGING_DIR} | awk '{print $1;}')" >>"${STAGING_DIR}/DEBIAN/control"
gzip -9 -n 'deb.staging/usr/share/doc/tgshd/changelog.Debian'
read -rp "Input package filename: "
dpkg-deb --root-owner-group --build "${STAGING_DIR}" "${REPLY}.deb"
)
function priv_main
(
set -euo pipefail
if ((${#})); then
case ${1} in
build)
if ! (which 'lazbuild'); then
source '/etc/os-release'
case ${ID:?} in
debian | ubuntu)
sudo apt-get update
sudo apt-get install -y lazarus
;;
esac
fi
if [[ -d 'use' ]]; then
git submodule update --recursive --init
git submodule update --recursive --remote
find 'use' -type 'f' -name '*.lpk' -exec lazbuild --add-package-link {} +
fi
find 'src' -type 'f' -name '*.lpi' -exec \
lazbuild --no-write-project --recursive --no-write-project --build-mode=release {} + 1>&2
;;
dpkg) priv_dpkg ;;
esac
else
priv_clippit
fi
)
##############################################################################################################
priv_main "${@}" >/dev/null