Skip to content

Commit

Permalink
Apache replaced by ngnix, http service descript and php now optional
Browse files Browse the repository at this point in the history
  • Loading branch information
julienblitte committed Mar 4, 2024
1 parent ac70155 commit 05b5a35
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 29 deletions.
5 changes: 3 additions & 2 deletions arch-armhf/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Package: tiny-ssdp
Version: 0.24
Version: 0.3
Architecture: armhf
Maintainer: Julien Blitte <julien.blitte@gmail.com>
Installed-Size: 1024
Depends: libc6, apache2, php5
Depends: libc6
Recommends: nginx, php
Conflicts: minissdpd, miniupnpc
Section: net
Priority: optional
Expand Down
44 changes: 32 additions & 12 deletions arch-armhf/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -1,27 +1,47 @@
#!/bin/sh

set -e
site=tiny-ssdp

# apache
site=tiny-ssdp.conf
if [ -d "/etc/apache2/sites-available/" -a -d "/etc/apache2/sites-enabled/" ]
# nginx
if [ -d "/etc/nginx/sites-available/" ]
then
cp "/usr/lib/tiny-ssdp/apache2/$site" "/etc/apache2/sites-available/"
cd "/etc/apache2/sites-enabled/"
ln -sf "../sites-available/$site" .
cp "/usr/lib/tiny-ssdp/nginx/$site" "/etc/nginx/sites-available/"
#if [ -d "/etc/nginx/sites-enabled/" ]
#then
# cd "/etc/nginx/sites-enabled/"
# ln -sf "../sites-available/$site" .
# nginx=true
#fi
fi

# apache2
if [ -d "/etc/apache2/sites-available/" ]
then
cp "/usr/lib/tiny-ssdp/apache2/$site.conf" "/etc/apache2/sites-available/"
#if [ -d "/etc/apache2/sites-enabled/" ]
#then
# cd "/etc/apache2/sites-enabled/"
# ln -sf "../sites-available/$site.conf" .
# apache2=true
#fi
fi
invoke-rc.d apache2 restart

if which systemd > /dev/null
then
# configure and enable systemd
cp -f "/usr/lib/tiny-ssdp/startup/tiny-ssdp.service" /etc/systemd/system/
systemctl enable tiny-ssdp.service
systemctl start tiny-ssdp.service
systemctl enable tiny-ssdp.service && systemctl start tiny-ssdp.service

[ ! -z "$nginx" ] && systemctl reload nginx
[ ! -z "$apache2" ] && systemctl restart apache2
else
# configure and enable systemV-init
cp -f "/usr/lib/tiny-ssdp/startup/tiny-ssdp" /etc/init.d/
update-rc.d -f tiny-ssdp defaults
service tiny-ssdp start
update-rc.d -f tiny-ssdp defaults && service tiny-ssdp start

[ ! -z "$nginx" ] && invoke-rc.d nginx reload
[ ! -z "$apache2" ] && invoke-rc.d apache2 restart
fi

exit 0

41 changes: 30 additions & 11 deletions arch-armhf/DEBIAN/postrm
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
#!/bin/sh

set -e
# nginx
site=tiny-ssdp
if [ -f "/etc/nginx/sites-enabled/$site" ]
then
nginx=true
fi

if [ -f "/etc/apache2/sites-available/$site.conf" ]
then
apache2=true
fi

# apache2
rm -f "/etc/apache2/sites-enabled/tiny-ssdp.conf" || :
rm -f "/etc/apache2/sites-available/tiny-ssdp.conf" || :
invoke-rc.d apache2 restart || :
rm -f "/etc/nginx/sites-available/$site"
rm -f "/etc/nginx/sites-enabled/$site"

rm -f "/etc/apache2/sites-available/$site"
rm -f "/etc/apache2/sites-enabled/$site"

if which systemd > /dev/null
then
# remove sytemd
systemctl disable tiny-ssdp.service
rm -f "/etc/systemd/system/tiny-ssdp.service" || :
# remove systemd
systemctl is-active --quiet tiny-ssdp.service && systemctl disable tiny-ssdp.service
rm -f "/etc/systemd/system/tiny-ssdp.service"

[ ! -z "$nginx" ] && systemctl reload nginx
[ ! -z "$apache2" ] && systemctl restart apache2
else
# remove systemV-init
update-rc.d -f tiny-ssdp remove
rm -f "/etc/init.d/tiny-ssdp" || :
# remove SystemV-init
update-rc.d -f tiny-ssdp remove || :
rm -f "/etc/init.d/tiny-ssdp"

[ ! -z "$nginx" ] && invoke-rc.d nginx reload
[ ! -z "$apache2" ] && invoke-rc.d apache2 restart
fi

exit 0

6 changes: 3 additions & 3 deletions arch-armhf/DEBIAN/prerm
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh

set -e

if which systemd > /dev/null
then
# stop systemd
systemctl stop tiny-ssdp.service || :
systemctl is-active --quiet tiny-ssdp.service && systemctl stop tiny-ssdp.service
else
# stop systemV-init
service tiny-ssdp stop || :
fi

exit 0

19 changes: 19 additions & 0 deletions arch-armhf/usr/lib/tiny-ssdp/nginx/tiny-ssdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
server {
server_name ssdp;
root /usr/lib/tiny-ssdp/www/;
index index.html index.php;
autoindex off;
server_tokens off;

listen 1900 default_server;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_read_timeout 60s;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_ADMIN_VALUE session.cookie_secure=On;
}
}
Binary file added arch-armhf/usr/sbin/tiny-ssdpd
Binary file not shown.
Binary file modified arch-armhf/usr/share/doc/tiny-ssdp/changelog.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion arch-armhf/usr/share/doc/tiny-ssdp/copyright
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2017 Julien Blitte <julien.blitte@gmail.com> for tiny-ssdp package.
Copyright (C) 2017-2024 Julien Blitte <julien.blitte@gmail.com> for tiny-ssdp.
All rights reserved, package released under bellow restrictions and licences.

This package content is free software: you can redistribute it and/or modify
Expand Down

0 comments on commit 05b5a35

Please sign in to comment.