Skip to content

Commit

Permalink
Update Debian packaging files
Browse files Browse the repository at this point in the history
Signed-off-by: Gerard Hickey <[email protected]>
  • Loading branch information
hickey committed Jul 31, 2024
1 parent c39a8e4 commit 90b5a6b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 39 deletions.
2 changes: 1 addition & 1 deletion package/debian/control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: meshchat
Version:
Depends: lua5.4
Depends: lua5.4, nginx
Provides:
Source: package/meshchat
Section: net
Expand Down
32 changes: 0 additions & 32 deletions package/debian/postinst
Original file line number Diff line number Diff line change
@@ -1,38 +1,6 @@
#!/bin/sh

grep "|8080|meshchat" /etc/config.mesh/_setup.services.dmz &> /dev/null
DMZPRESENT=$?
grep "|8080|meshchat" /etc/config.mesh/_setup.services.nat &> /dev/null
NATPRESENT=$?
NODEMODE=$(uci -q -c /etc/local/uci/ get hsmmmesh.settings.config)
RAND=$(awk 'BEGIN{srand();print int(rand()*10000) }')
RESTART=0

if [ "$DMZPRESENT" != 0 ]; then
echo "MeshChat-$RAND|1|http|$(uname -n)|8080|meshchat" >> /etc/config.mesh/_setup.services.dmz
RESTART=1
fi

if [ "$NATPRESENT" != 0 ]; then
echo "MeshChat-$RAND|1|http|$(uname -n)|8080|meshchat" >> /etc/config.mesh/_setup.services.nat
RESTART=1
fi

if [ "$NODEMODE" = "mesh" -a "$RESTART" = "1" ]; then
echo "Applying service announcement"
/usr/local/bin/node-setup -a -p mesh &> /dev/null
/etc/init.d/olsrd restart &> /dev/null
fi

/etc/init.d/meshchatsync enable
/etc/init.d/meshchatsync start

echo "<br>"

echo "Mesh Chat has been setup at http://$(uname -n):8080/meshchat"
echo "<br>"
if [ "$RESTART" = "1" ]; then
echo "An advertised service has been added for Mesh Chat on the Services configuration page"
fi

exit 0
12 changes: 6 additions & 6 deletions package/debian/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

/etc/init.d/meshchatsync stop > /dev/null 2> /dev/null

mkdir -p /www/meshchat
mkdir -p /var/www/html/meshchat

# if there is not a meshchat_local.lua, then prepare one
if [ ! -f /www/cgi-bin/meshchat_local.lua ]; then
if [ -f /www/cgi-bin/meshchatconfig.lua ]; then
cp /www/cgi-bin/meshchatconfig.lua /www/cgi-bin/meshchat_local.lua
if [ ! -f /usr/lib/cgi-bin/meshchat_local.lua ]; then
if [ -f /usr/lib/cgi-bin/meshchatconfig.lua ]; then
cp /usr/lib/cgi-bin/meshchatconfig.lua /usr/lib/cgi-bin/meshchat_local.lua

# remove vars that should not be in meshchat_local.lua
sed -i "/^protocol_version/d; /^app_version/d" /www/cgi-bin/meshchat_local.lua
sed -i "/^protocol_version/d; /^app_version/d" /usr/lib/cgi-bin/meshchat_local.lua
else
touch /www/cgi-bin/meshchat_local.lua
touch /usr/lib/cgi-bin/meshchat_local.lua
fi
fi

Expand Down

0 comments on commit 90b5a6b

Please sign in to comment.