Преглед на файлове

local wifi pwd, persistent vpn key

Danja Vasiliev преди 9 години
родител
ревизия
53446120aa
променени са 2 файла, в които са добавени 7 реда и са изтрити 7 реда
  1. 1 1
      openwrt/common/etc/uci-defaults/21-gen-psk
  2. 6 6
      openwrt/common/etc/uci-defaults/22-gen-htpasswd

+ 1 - 1
openwrt/common/etc/uci-defaults/21-gen-psk

@@ -1 +1 @@
-/usr/sbin/openvpn --genkey --secret /etc/host.psk
+[ -f /etc/host.psk ] || /usr/sbin/openvpn --genkey --secret /etc/host.psk

+ 6 - 6
openwrt/common/etc/uci-defaults/22-gen-htpasswd

@@ -1,6 +1,6 @@
-_PWD='changeme'
-
-_HASH=$(printf '%s' "admin:superglue:$_PWD" | md5sum | cut -d' ' -f1)
-echo "admin:superglue:$_HASH" > /etc/lighttpd/htpasswd
-
-echo -e "$_PWD\n$_PWD" | passwd root
+[ -f /etc/lighttpd/htpasswd ] || (
+  _PWD='changeme'
+  _HASH=$(printf '%s' "admin:superglue:$_PWD" | md5sum | cut -d' ' -f1)
+  echo "admin:superglue:$_HASH" > /etc/lighttpd/htpasswd
+  echo -e "$_PWD\n$_PWD" | passwd root &>/dev/null
+)