[meta-swupdate] Move webpages to safer location

Message ID 20190123142042.11365-1-o.mandel@menlosystems.com
State New
Headers show
Series
  • [meta-swupdate] Move webpages to safer location
Related show

Commit Message

Olaf Mandel Jan. 23, 2019, 2:20 p.m.
Installing the document-root for the swupdate-www package in /www may be
unsafe as e.g. lighttpd also installs files and symbolic links into this
directory. So move the document root to /www/swupdate, which should be
unique enough.

Signed-off-by: Olaf Mandel <o.mandel@menlosystems.com>
---
 recipes-support/swupdate/swupdate.inc              | 8 ++++----
 recipes-support/swupdate/swupdate/swupdate         | 2 +-
 recipes-support/swupdate/swupdate/swupdate.service | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

Patch

diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
index 5412952..558c79f 100644
--- a/recipes-support/swupdate/swupdate.inc
+++ b/recipes-support/swupdate/swupdate.inc
@@ -20,7 +20,7 @@  INSANE_SKIP_${PN} = "ldflags"
 PACKAGES =+ "${PN}-www ${PN}-lua"
 
 FILES_${PN}-lua += "${libdir}/lua/"
-FILES_${PN}-www = "/www/*"
+FILES_${PN}-www = "/www/swupdate/*"
 
 S = "${WORKDIR}/git/"
 
@@ -116,11 +116,11 @@  do_install () {
 
   oe_runmake install
 
-  install -m 0755 -d ${D}/www
+  install -m 0755 -d ${D}/www/swupdate
   if [ -d ${S}/web-app ];then
-	cp -R --no-dereference --preserve=mode,links -v ${S}/examples/www/v2/* ${D}/www
+	cp -R --no-dereference --preserve=mode,links -v ${S}/examples/www/v2/* ${D}/www/swupdate
   else
-	install -m 0755 ${S}/www/* ${D}/www
+	install -m 0755 ${S}/www/* ${D}/www/swupdate
   fi
 
   install -d ${D}${sysconfdir}/init.d
diff --git a/recipes-support/swupdate/swupdate/swupdate b/recipes-support/swupdate/swupdate/swupdate
index d3debb2..a60bdd8 100644
--- a/recipes-support/swupdate/swupdate/swupdate
+++ b/recipes-support/swupdate/swupdate/swupdate
@@ -57,7 +57,7 @@  do_start() {
 	*)
 		echo "Starting $DESC ..."
 		cd /home/root
-		exec $DAEMON -v -w "-r /www" $SWUPDATE_EXTRA_ARGS &
+		exec $DAEMON -v -w "-r /www/swupdate" $SWUPDATE_EXTRA_ARGS &
 		exit 0
 		;;
 	esac
diff --git a/recipes-support/swupdate/swupdate/swupdate.service b/recipes-support/swupdate/swupdate/swupdate.service
index 59f6c10..0ab0da9 100644
--- a/recipes-support/swupdate/swupdate/swupdate.service
+++ b/recipes-support/swupdate/swupdate/swupdate.service
@@ -6,7 +6,7 @@  Documentation=https://sbabic.github.io/swupdate
 [Service]
 ExecStartPre=-/usr/bin/swupdate-env
 EnvironmentFile=-/tmp/swupdate.env
-ExecStart=/usr/bin/swupdate -v -w "-r /www" $SWUPDATE_EXTRA_ARGS
+ExecStart=/usr/bin/swupdate -v -w "-r /www/swupdate" $SWUPDATE_EXTRA_ARGS
 
 [Install]
 WantedBy=multi-user.target