u
This commit is contained in:
parent
8a0c0d9e1f
commit
11b284d17f
@ -5,7 +5,7 @@ then
|
|||||||
SourcePath=$1
|
SourcePath=$1
|
||||||
else
|
else
|
||||||
echo "Usage: setup.sh [Config-Source-Path] [User-Home-Path]"
|
echo "Usage: setup.sh [Config-Source-Path] [User-Home-Path]"
|
||||||
read -p "Enter config source path (leave blank for [Users/luk.lu]/faronear/fon/sysconfig/nixhome) >> " SourcePath
|
read -p "Enter config source path (leave blank for [/Users/luk.lu]/faronear/fon/sysconfig/nixhome) >> " SourcePath
|
||||||
if [ ! $SourcePath ]
|
if [ ! $SourcePath ]
|
||||||
then
|
then
|
||||||
echo "Use default source path: [Users/luk.lu]/faronear/fon/sysconfig/nixhome"
|
echo "Use default source path: [Users/luk.lu]/faronear/fon/sysconfig/nixhome"
|
||||||
@ -39,11 +39,8 @@ else
|
|||||||
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore"
|
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore"
|
||||||
for homescript in $homescriptlist
|
for homescript in $homescriptlist
|
||||||
do
|
do
|
||||||
if [ -e $homescript ] # .emacs.lisp is a folder! Therefore use -e instead of -f
|
rm -fr $homescript.backup
|
||||||
then
|
mv $homescript $homescript.backup
|
||||||
rm -fr $homescript.backup
|
|
||||||
mv $homescript $homescript.backup
|
|
||||||
fi
|
|
||||||
ln -s $SourcePath/$homescript $HomePath
|
ln -s $SourcePath/$homescript $HomePath
|
||||||
done
|
done
|
||||||
popd
|
popd
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
#!/usr/bin/expect
|
#!/usr/bin/expect
|
||||||
|
|
||||||
## Usage: expect this.sh [user@hostname] [filepath] [password]
|
# Usage: expect this.sh [0:hostname] [1:username] [2:filepath] [3:pwdadot]
|
||||||
## Example: expect this.sh adot@m1.bittic.net /faronear/tic/star.core.torm 密码
|
|
||||||
|
|
||||||
set timeout 30
|
set timeout 10
|
||||||
spawn ssh [lindex $argv 0]
|
spawn ssh [lindex $argv 1]@[lindex $argv 0] -p 22
|
||||||
expect {
|
expect {
|
||||||
"(yes/no)?"
|
"yes/no"
|
||||||
{send "yes\n";exp_continue}
|
{send "yes\n";exp_continue}
|
||||||
"password:"
|
"password:"
|
||||||
{send "[lindex $argv 2]\n"}
|
{send "[lindex $argv 3]\n";exp_continue}
|
||||||
":~"
|
":~"
|
||||||
{send "su\n";exp_continue}
|
{send "cd [lindex $argv 2] && sudo git pull && sudo npx pm2 restart all && sudo npx pm2 log\n"}
|
||||||
"Password:"
|
|
||||||
{send "[lindex $argv 2]\ncd [lindex $argv 1] && git pull && npx pm2 restart all && npx pm2 log\n"}
|
|
||||||
}
|
}
|
||||||
interact
|
interact
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/expect
|
#!/usr/bin/expect
|
||||||
|
|
||||||
# Usage: expect this.sh [hostname] [username] [pwdadot] [pwdroot]
|
# Usage: expect this.sh [0:hostname] [1:username] [2:pwdadot] [3:pwdroot]
|
||||||
|
|
||||||
set timeout 30
|
set timeout 10
|
||||||
spawn ssh [lindex $argv 1]@[lindex $argv 0] -p 22
|
spawn ssh [lindex $argv 1]@[lindex $argv 0] -p 22
|
||||||
expect {
|
expect {
|
||||||
"yes/no"
|
"yes/no"
|
||||||
|
Loading…
Reference in New Issue
Block a user