瀏覽代碼

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
+)