소스 검색

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