summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xetc/init.d/commissioning30
-rwxr-xr-xetc/init.d/php-fpm-commission7
2 files changed, 17 insertions, 20 deletions
diff --git a/etc/init.d/commissioning b/etc/init.d/commissioning
index 4fc7366..82bda67 100755
--- a/etc/init.d/commissioning
+++ b/etc/init.d/commissioning
@@ -7,26 +7,28 @@ NAME=commissioning
DESC="Lighttpd Web Server"
OPTS="-f /etc/lighttpd-commission.conf"
PIDFILE=/var/run/lighttpd-commission.pid
-
+CONF_DIR=/var/config
ENABLED=yes
-[ -f /etc/default/$NAME ] && . /etc/default/$NAME
-# If we are not enabled, see if anybody has a password
-if [[ ENABLED == no ]] ; then
- PASSWORDS=$(passwd -Sa | egrep '^[^[:space:]]+[[:space:]]P[[:space:]]' | wc -l)
- if (($PASSWORDS == 0)) ; then
- # No password, so turn on commissioning (php-fpm-commision will see this)
- rm /etc/default/$NAME
- ENABLED="yes"
- fi
-fi
+[ -f "/etc/default/${NAME}" ] && . "/etc/default/${NAME}"
-# To disable commissioning across a factory reset (and image install):
-# echo 'ENABLED="no"' >/var/config/.no-commissioning
-# ln -sf /var/config/.no-commissioning /etc/default/no-commissioning
+PASSWORDS=$(passwd -Sa | egrep '^[^[:space:]]+[[:space:]]P[[:space:]]' | wc -l)
+if (($PASSWORDS == 0)) ; then
+ # No password, so indicate commissioning mode
+ # php-fpm-commision will be turned on as well
+ rm -f /etc/default/$NAME
+ ENABLED="yes"
+fi
[ -f "/etc/default/no-${NAME}" ] && . "/etc/default/no-${NAME}"
+if [ ! -f $CONF_DIR/server.pem ]; then
+ echo "Generating server cert"
+ openssl req \
+ -x509 -nodes -days 3650 \
+ -subj '/C=US/ST=Minnesota/L=Minneapolis/CN=mlinux.example.com' \
+ -newkey rsa:2048 -keyout $CONF_DIR/server.pem -out $CONF_DIR/server.pem
+fi
case "$1" in
start)
diff --git a/etc/init.d/php-fpm-commission b/etc/init.d/php-fpm-commission
index 7ac0925..cd86ab5 100755
--- a/etc/init.d/php-fpm-commission
+++ b/etc/init.d/php-fpm-commission
@@ -22,12 +22,7 @@ php_fpm_PID="/var/run/${NAME}.pid"
php_opts="-R --fpm-config $php_fpm_CONF --pid $php_fpm_PID"
ENABLED=yes
-[ -f "/etc/default/commissioning" ] && . "/etc/config/commisioning"
-
-# To disable commissioning across a factory reset (and image install):
-# echo 'ENABLED="no"' >/var/config/.no-commissioning
-# ln -sf /var/config/.no-commissioning /etc/default/no-commissioning
-[ -f "/etc/default/no-commissioning" ] && . "/etc/default/no-commissioning"
+[ -f "/etc/default/commissioning" ] && . "/etc/default/commissioning"
wait_for_pid () {
try=0