Detect PHP flexibly, assert wland configuration
[infodrom/musiikki-web.git] / install-system
index c025005..8e0e342 100755 (executable)
@@ -297,8 +297,20 @@ assert_packages()
 
     echo_verbose "Looking for installed packages: "
 
-    for pkg in sudo super rsync hostapd isc-dhcp-server minidlna lighttpd samba \
-                   php7.0-cgi php7.0-json php7.0-sqlite3
+    for pkg in sudo super rsync hostapd isc-dhcp-server minidlna lighttpd samba
+    do
+       echo_verbose "${pkg}... "
+       if ! package_exists ${pkg}
+       then
+           missing="$missing $pkg"
+       fi
+    done
+
+    echo_verbose "php... "
+    php_cgi=$(apt-cache search php7*-cgi|cut -d' ' -f 1|grep php7.*-cgi|sort|tail -n 1)
+    php=${php_cgi%-cgi}
+
+    for pkg in ${php}-cgi ${php}-json ${php}-sqlite3
     do
        echo_verbose "${pkg}... "
        if ! package_exists ${pkg}
@@ -398,6 +410,20 @@ assert_dhcpd()
 {
     assert_system_subnet
 
+    if [ ! -f /etc/network/interfaces.d/wlan0.conf ]
+    then
+       cat <<EOT > /etc/network/interfaces.d/wlan0.conf
+auto wlan0
+iface wlan0 inet static
+        address ${opt_subnet}.1
+        netmask 255.255.255.0
+        broadcast ${opt_subnet}.255
+        network ${opt_subnet}.0
+        #gateway ${opt_subnet}.1
+EOT
+       echo "source /etc/network/interfaces.d/wlan0.conf" >> /etc/network/interfaces
+    fi
+
     if ! grep -q "^subnet ${opt_subnet}.0 " /etc/dhcp/dhcpd.conf
     then
        echo_ok "Add DHCP configuration"