-
-
Save satouriko/02525de6715e5e3622143ec651ef83a4 to your computer and use it in GitHub Desktop.
Revisions
-
kookxiang revised this gist
Jul 5, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ if ! [ -f ${TARGET_DIR}/authorized_keys ]; then chmod 0600 ${TARGET_DIR}/authorized_keys fi curl -sS https://api.github.com/users/${GITHUB_USERNAME}/keys | grep -Po '"key": ".+?"' | sed -e 's/\"key\": \"//' -e 's/"$//' >> ${TARGET_DIR}/authorized_keys.new if [ $? != 0 ]; then exit 1; fi cat ${TARGET_DIR}/authorized_keys.new > ${TARGET_DIR}/authorized_keys -
kookxiang created this gist
Apr 3, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #!/usr/bin/env sh TARGET_DIR='/home/kookxiang/.ssh' GITHUB_USERNAME='kookxiang' if ! [ -d ${TARGET_DIR} ]; then mkdir ${TARGET_DIR} chmod 0700 ${TARGET_DIR} fi if ! [ -f ${TARGET_DIR}/authorized_keys ]; then touch ${TARGET_DIR}/authorized_keys chmod 0600 ${TARGET_DIR}/authorized_keys fi curl -sS https://api.github.com/users/kookxiang/keys | grep -Po '"key": ".+?"' | sed -e 's/\"key\": \"//' -e 's/"$//' >> ${TARGET_DIR}/authorized_keys.new if [ $? != 0 ]; then exit 1; fi cat ${TARGET_DIR}/authorized_keys.new > ${TARGET_DIR}/authorized_keys rm -rf ${TARGET_DIR}/authorized_keys.new echo >> ${TARGET_DIR}/authorized_keys if [ -f ${TARGET_DIR}/alternate_keys ]; then cat ${TARGET_DIR}/alternate_keys >> ${TARGET_DIR}/authorized_keys echo >> ${TARGET_DIR}/authorized_keys fi