Browse Source

upload authorized keys if present

Julian Kornberger 10 years ago
parent
commit
076935c0f4
2 changed files with 14 additions and 2 deletions
  1. 1 0
      .gitignore
  2. 13 2
      autoflash.sh

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 images/**
 !images/.gitkeep
+authorized_keys

+ 13 - 2
autoflash.sh

@@ -74,11 +74,22 @@ curl_admin -e $uploadurl http://192.168.0.1/userRpm/FirmwareUpdateTemp.htm > /de
 echo "done :)"
 
 echo -en "waiting for router to come up again "
-
 while ! ping -n -c 1 -W 2 192.168.1.1 > /dev/null; do
 	echo -en "."
 	sleep 1
 done
-
 echo " \o/"
+
+# upload authorized keys if present
+if [ -e authorized_keys ]; then
+	echo -en "uploading authorized_keys ... "
+	keys=`cat authorized_keys`
+	curl -fsS -F cbi.submit=1 -F "cbid.system._keys._data=$keys" http://192.168.1.1/cgi-bin/luci/admin/index > /dev/null
+	if [ $? -eq 0 ]; then
+		echo "OK"
+	else
+		quit 4
+	fi
+fi
+
 echo