-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathpack_dpkg
More file actions
executable file
·91 lines (81 loc) · 2.58 KB
/
pack_dpkg
File metadata and controls
executable file
·91 lines (81 loc) · 2.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
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
#!/bin/bash
IFS='-' read -ra a <<< `git describe --long --always --dirty`
REVID="${a[0]}-${a[1]}"
ubuntu_version=${ubuntu_version:-$(lsb_release -r -s)}
architecture=$(uname -m)
if [ "$architecture" == "x86_64" ]
then
architecture=amd64
else
architecture=arm64
fi
debbuild_dir=$(realpath si-csh_${ubuntu_version}_${architecture}_$REVID)
rm -R $debbuild_dir
mkdir -p $debbuild_dir/usr/bin
mkdir -p $debbuild_dir/usr/lib/csh
mkdir -p $debbuild_dir/usr/share/si-csh
# build csh_si
cd ../csh_si
prefix=/usr ./configure
DESTDIR=$debbuild_dir ./install
# build csh_obc
cd -
cd ../csh_obc
prefix=/usr ./configure
DESTDIR=$debbuild_dir ./install
# build csh
cd -
./configure
./build
if [ "$ubuntu_version" == "20.04" ]
then
Depends="libcap2-bin (>=2.44), libcurl4 (>=7.68), libzmq5 (>=4.3.2), libc6 (>=2.31), libsocketcan2 (>=0.0.11), can-utils (>= 2018.02), fonts-powerline (>=2.7), python3 (>=3.8)"
elif [ "$ubuntu_version" == "22.04" ]
then
Depends="libcap2-bin (>=2.44), libcurl4 (>=7.81.0), libzmq5 (>=4.3.4), libc6 (>=2.35), libsocketcan2 (>=0.0.12), can-utils (>= 2020.11.0), fonts-powerline (>= 2.8.2), python3 (>=3.10)"
elif [ "$ubuntu_version" == "24.04" ]
then
Depends="libcap2-bin (>=2.44), libzmq5 (>=4.3.5), libc6 (>=2.39), libsocketcan2 (>=0.0.12), can-utils (>= 2023.03), fonts-powerline (>= 2.8.3), python3 (>=3.12)"
fi
cp builddir/csh $debbuild_dir/usr/bin
cp build-doc/CSH_MAN.pdf $debbuild_dir/usr/share/si-csh
mkdir -p $debbuild_dir/DEBIAN
cat << EOF > $debbuild_dir/DEBIAN/control
Package: si-csh
Version: $REVID
Section: base
Priority: optional
Architecture: ${architecture}
Depends: $Depends
Maintainer: Space Inventor A/S <sales@space-inventor.com>
Description: CSP shell client application
For easy operation of Space Inventor
satellites and modules based on CSP and libparam
EOF
cat << EOF > $debbuild_dir/DEBIAN/postinst
#!/bin/sh
setcap cap_net_raw,cap_net_admin+ep /usr/bin/csh
USER_FOLDER=\`echo /home/\$SUDO_USER\`
if [ -f "\$USER_FOLDER/.local/bin/csh" ]
then
echo "Removing CSH from local installation"
rm \$USER_FOLDER/.local/bin/csh
fi
if [ -f "\$USER_FOLDER/.local/lib/csh/libcsh_obc.so" ]
then
echo "Removing libcsh_obc from local installation"
rm "\$USER_FOLDER/.local/lib/csh/libcsh_obc.so"
fi
if [ -f "\$USER_FOLDER/.local/lib/csh/liblua_sub.a" ]
then
rm "\$USER_FOLDER/.local/lib/csh/liblua_sub.a"
fi
if [ -f "\$USER_FOLDER/.local/lib/csh/libcsh_si.so" ]
then
echo "Removing libcsh_si from local installation"
rm "\$USER_FOLDER/.local/lib/csh/libcsh_si.so"
fi
EOF
chmod +x $debbuild_dir/DEBIAN/postinst
dpkg -b $debbuild_dir
rm -R $debbuild_dir