This commit is contained in:
陆柯 2022-10-22 15:06:11 +08:00
parent 5c0238ac99
commit 20bafeaac5
10 changed files with 249 additions and 211 deletions

View File

@ -7,12 +7,12 @@
echo "=== Choose docker source (a: 阿里云, z: 中科大, leave blank for default):" echo "=== Choose docker source (a: 阿里云, z: 中科大, leave blank for default):"
read -p ">>> " DOCKER_SOURCE read -p ">>> " DOCKER_SOURCE
if [ $DOCKER_SOURCE = 'a' ] if [ "$DOCKER_SOURCE" = 'a' ]
then then
GPG_URL=http://mirrors.aliyun.com/docker-ce/linux/debian/gpg GPG_URL=http://mirrors.aliyun.com/docker-ce/linux/debian/gpg
DOCKER_URL=http://mirrors.aliyun.com/docker-ce/linux/debian DOCKER_URL=http://mirrors.aliyun.com/docker-ce/linux/debian
COMPOSE_URL=https://get.daocloud.io/docker/compose/releases/download/1.29.2/ COMPOSE_URL=https://get.daocloud.io/docker/compose/releases/download/1.29.2/
elif [ $DOCKER_SOURCE = 'z' ] elif [ "$DOCKER_SOURCE" = 'z' ]
then then
GPG_URL=https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg GPG_URL=https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg
DOCKER_URL=https://mirrors.ustc.edu.cn/docker-ce/linux/debian DOCKER_URL=https://mirrors.ustc.edu.cn/docker-ce/linux/debian
@ -43,21 +43,21 @@ sudo chmod +x /usr/local/bin/docker-compose
echo "=== 配置中国加速镜像源 /etc/docker/daemon.json (d: Docker中国, t: 腾讯云, z: 中科大, leave blank for no mirror):" echo "=== 配置中国加速镜像源 /etc/docker/daemon.json (d: Docker中国, t: 腾讯云, z: 中科大, leave blank for no mirror):"
read -p ">>> " DOCKER_MIRROR read -p ">>> " DOCKER_MIRROR
if [ ! $DOCKER_MIRROR ] if [ ! "$DOCKER_MIRROR" ]
then then
echo "--- Docker mirror is not specified." echo "--- Docker mirror is not specified."
elif [ $DOCKER_MIRROR = 'd' ] elif [ "$DOCKER_MIRROR" = 'd' ]
then then
DOCKER_MIRROR=https://registry.docker-cn.com DOCKER_MIRROR=https://registry.docker-cn.com
elif [ $DOCKER_MIRROR = 't' ] elif [ "$DOCKER_MIRROR" = 't' ]
then then
DOCKER_MIRROR=https://mirror.ccs.tencentyun.com DOCKER_MIRROR=https://mirror.ccs.tencentyun.com
elif [ $DOCKER_MIRROR = 'z' ] elif [ "$DOCKER_MIRROR" = 'z' ]
then then
DOCKER_MIRROR=https://docker.mirrors.ustc.edu.cn DOCKER_MIRROR=https://docker.mirrors.ustc.edu.cn
fi fi
if [ $DOCKER_MIRROR ] if [ "$DOCKER_MIRROR" ]
then then
echo "{" | sudo tee /etc/docker/daemon.json > /dev/null echo "{" | sudo tee /etc/docker/daemon.json > /dev/null
echo " \"registry-mirrors\": [" | sudo tee -a /etc/docker/daemon.json > /dev/null echo " \"registry-mirrors\": [" | sudo tee -a /etc/docker/daemon.json > /dev/null
@ -68,7 +68,7 @@ fi
echo "=== 启动docker服务y for yes, anything else for no" echo "=== 启动docker服务y for yes, anything else for no"
read -p ">>> " StartDockerDaemon read -p ">>> " StartDockerDaemon
if [ $StartDockerDaemon ] && [ $StartDockerDaemon = 'y' ] if [ "$StartDockerDaemon" = 'y' ]
then then
# 开机启动 # 开机启动
sudo systemctl enable docker sudo systemctl enable docker

View File

@ -2,122 +2,106 @@
mkdir cup mkdir cup
pushd cup pushd cup
git clone https://git.faronear.org/cup/gasj-allinone git clone https://git.faronear.org/cup/cmc-user-uniapp cmc-user-uniapp.git
git clone https://git.faronear.org/cup/gdthomas-web-jp git clone https://git.faronear.org/cup/cmc-server-torm cmc-server-torm.git
git clone https://git.faronear.org/cup/cmc-user-uniapp
git clone https://git.faronear.org/cup/cmc-server-torm
popd popd
mkdir fon mkdir fon
pushd fon pushd fon
git clone https://git.faronear.org/npm/sysconfig git clone https://git.faronear.org/npm/sysconfig sysconfig.git
git clone https://git.faronear.org/fon/dot.vscode git clone https://git.faronear.org/fon/dot.vscode dot.vscode.git
git clone https://git.faronear.org/fon/www.faronear.com git clone https://git.faronear.org/fon/www.faronear.com www.faronear.com.git
git clone https://git.faronear.org/fon/yapi.faronear.org git clone https://git.faronear.org/fon/yapi.faronear.org yapi.faronear.org.git
git clone https://git.faronear.org/fon/git.faronear.org git clone https://git.faronear.org/fon/git.faronear.org git.faronear.org.git
git clone https://git.faronear.org/fon/www.faronear.org git clone https://git.faronear.org/fon/www.faronear.org www.faronear.org.git
git clone https://git.faronear.org/fon/mail.faronear.org git clone https://git.faronear.org/fon/mail.faronear.org mail.faronear.org.git
popd popd
mkdir npm mkdir npm
pushd npm pushd npm
git clone https://git.faronear.org/npm/wo-base-fileloader git clone https://git.faronear.org/npm/wo-base-fileloader wo-base-fileloader.git
git clone https://git.faronear.org/npm/wo-base-deployer git clone https://git.faronear.org/npm/wo-base-deployer wo-base-deployer.git
git clone https://git.faronear.org/npm/wo-base-envar git clone https://git.faronear.org/npm/wo-base-envar wo-base-envar.git
git clone https://git.faronear.org/npm/wo-base-cocon git clone https://git.faronear.org/npm/wo-base-cocon wo-base-cocon.git
git clone https://git.faronear.org/npm/wo-base-messenger git clone https://git.faronear.org/npm/wo-base-messenger wo-base-messenger.git
git clone https://git.faronear.org/npm/wo-base-netinfo git clone https://git.faronear.org/npm/wo-base-netinfo wo-base-netinfo.git
git clone https://git.faronear.org/npm/wo-base-webserver git clone https://git.faronear.org/npm/wo-base-webserver wo-base-webserver.git
git clone https://git.faronear.org/npm/wo-base-websocket-server git clone https://git.faronear.org/npm/wo-base-websocket-server wo-base-websocket-server.git
git clone https://git.faronear.org/npm/wo-base-webtoken git clone https://git.faronear.org/npm/wo-base-webtoken wo-base-webtoken.git
git clone https://git.faronear.org/npm/wo-core-i18n git clone https://git.faronear.org/npm/wo-core-i18n wo-core-i18n.git
git clone https://git.faronear.org/npm/wo-core-toolkit git clone https://git.faronear.org/npm/wo-core-toolkit wo-core-toolkit.git
git clone https://git.faronear.org/npm/wo-core-rpcsocket git clone https://git.faronear.org/npm/wo-core-rpcsocket wo-core-rpcsocket.git
git clone https://git.faronear.org/npm/wo-user-part-uniapp git clone https://git.faronear.org/npm/wo-user-part-uniapp wo-user-part-uniapp.git
git clone https://git.faronear.org/npm/wo-user-style-scss git clone https://git.faronear.org/npm/wo-user-style-scss wo-user-style-scss.git
git clone https://git.faronear.org/npm/wo-user-toolkit-uniapp git clone https://git.faronear.org/npm/wo-user-toolkit-uniapp wo-user-toolkit-uniapp.git
git clone https://git.faronear.org/npm/wo-user-websocket-uniapp git clone https://git.faronear.org/npm/wo-user-websocket-uniapp wo-user-websocket-uniapp.git
git clone https://git.faronear.org/npm/tic-crypto git clone https://git.faronear.org/npm/tic-crypto tic-crypto.git
git clone https://git.faronear.org/npm/tic-chaintool git clone https://git.faronear.org/npm/tic-chaintool tic-chaintool.git
git clone https://git.faronear.org/npm/tic-traction git clone https://git.faronear.org/npm/tic-traction tic-traction.git
git clone https://git.faronear.org/npm/vue-cli-uniapp git clone https://git.faronear.org/npm/vue-cli-uniapp vue-cli-uniapp.git
popd popd
mkdir sol mkdir sol
pushd sol pushd sol
git clone https://git.faronear.org/sol/sol-ling git clone https://git.faronear.org/sol/sol-ling sol-ling.git
git clone https://git.faronear.org/sol/sol-data git clone https://git.faronear.org/sol/sol-data sol-data.git
git clone https://git.faronear.org/sol/sol-base git clone https://git.faronear.org/sol/sol-base sol-base.git
git clone https://git.faronear.org/sol/solet git clone https://git.faronear.org/sol/solet solet.git
git clone https://git.faronear.org/sol/soweb git clone https://git.faronear.org/sol/soweb soweb.git
popd
mkdir tex
pushd tex
git clone https://git.faronear.org/tex/tex-basebank-java
git clone https://git.faronear.org/tex/tex-baserver-java
git clone https://git.faronear.org/tex/tex-doc
git clone https://git.faronear.org/tex/tex-team-vue
git clone https://git.faronear.org/tex/tex-user-android
git clone https://git.faronear.org/tex/tex-user-ios
git clone https://git.faronear.org/tex/tex-user-vue
popd popd
mkdir tic mkdir tic
pushd tic pushd tic
git clone https://git.faronear.org/tic/cloud-server git clone https://git.faronear.org/tic/cloud-server cloud-server.git
git clone https://git.faronear.org/tic/cloud-user-vue git clone https://git.faronear.org/tic/cloud-user-vue cloud-user-vue.git
git clone https://git.faronear.org/tic/star-core-torm git clone https://git.faronear.org/tic/star-core-torm star-core-torm.git
git clone https://git.faronear.org/tic/star-lens-uniapp git clone https://git.faronear.org/tic/star-lens-uniapp star-lens-uniapp.git
git clone https://git.faronear.org/tic/star-lens-vue git clone https://git.faronear.org/tic/star-lens-vue star-lens-vue.git
git clone https://git.faronear.org/tic/tic-blog-hexo git clone https://git.faronear.org/tic/tic-blog-hexo tic-blog-hexo.git
git clone https://git.faronear.org/tic/tic-www-vue git clone https://git.faronear.org/tic/tic-www-vue tic-www-vue.git
git clone https://git.faronear.org/tex/tex-basebank-java tex-basebank-java.git
git clone https://git.faronear.org/tex/tex-baserver-java tex-baserver-java.git
git clone https://git.faronear.org/tex/tex-team-vue tex-team-vue.git
git clone https://git.faronear.org/tex/tex-user-android tex-user-android.git
git clone https://git.faronear.org/tex/tex-user-ios tex-user-ios.git
git clone https://git.faronear.org/tex/tex-user-vue tex-user-vue.git
popd popd
mkdir tuc mkdir tuc
pushd tuc pushd tuc
git clone https://git.faronear.org/tuc/tisch
git clone https://git.faronear.org/tuc/nesh
git clone https://git.faronear.org/tuc/nbtc
popd
mkdir tuc-pex git clone https://git.faronear.org/tuc/tisch fork/tisch.git
pushd tuc-pex git clone https://git.faronear.org/tuc/nesh fork/nesh.git
git clone https://git.faronear.org/tuc-pex/pex-blog-hexo git clone https://git.faronear.org/tuc/nbtc fork/nbtc.git
git clone https://git.faronear.org/tuc-pex/pex-server-torm
git clone https://git.faronear.org/tuc-pex/pex-user-uniapp
popd
mkdir tuc-log git clone https://git.faronear.org/tuc-pex/pex-blog-hexo pex/pex-blog-hexo.git
pushd tuc-log git clone https://git.faronear.org/tuc-pex/pex-chain-geth pex/pex-chain-geth.git
git clone https://git.faronear.org/tuc-log/log-team-uniapp git clone https://git.faronear.org/tuc-pex/pex-contract-hardhat pex/pex-contract-hardhat.git
git clone https://git.faronear.org/tuc-log/log-server-mongo git clone https://git.faronear.org/tuc-pex/pex-server-torm pex/pex-server-torm.git
git clone https://git.faronear.org/tuc-log/log-server-torm git clone https://git.faronear.org/tuc-pex/pex-user-uniapp pex/pex-user-uniapp.git
git clone https://git.faronear.org/tuc-log/log-user-react
git clone https://git.faronear.org/tuc-log/log-user-uniapp
git clone https://git.faronear.org/tuc-log/log-user-vue
git clone https://git.faronear.org/tuc-log/log-blog-hexo
popd
git clone https://git.faronear.org/tuc-log/log-team-uniapp log/log-team-uniapp.git
git clone https://git.faronear.org/tuc-log/log-server-mongo log/log-server-mongo.git
git clone https://git.faronear.org/tuc-log/log-server-torm log/log-server-torm.git
git clone https://git.faronear.org/tuc-log/log-user-react log/log-user-react.git
git clone https://git.faronear.org/tuc-log/log-user-uniapp log/log-user-uniapp.git
git clone https://git.faronear.org/tuc-log/log-user-vue log/log-user-vue.git
git clone https://git.faronear.org/tuc-log/log-blog-hexo log/log-blog-hexo.git
mkdir tuc-vic git clone https://git.faronear.org/tuc-vic/vic.server.mongo vic/vic.server.mongo.git
pushd tuc-vic git clone https://git.faronear.org/tuc-vic/vic.user.react vic/vic.user.react.git
git clone https://git.faronear.org/tuc-vic/vic git clone https://git.faronear.org/tuc-vic/vic.webhome.hexo vic/vic.webhome.hexo.git
git clone https://git.faronear.org/tuc-vic/vic.server.mongo git clone https://git.faronear.org/tuc-vic/vic.market vic/vic.market.git
git clone https://git.faronear.org/tuc-vic/vic.user.react git clone https://git.faronear.org/tuc-vic/vic.admin.vue vic/vic.admin.vue.git
git clone https://git.faronear.org/tuc-vic/vic.webhome.hexo
git clone https://git.faronear.org/tuc-vic/vic.market git clone https://git.faronear.org/tuc-fiv/fiv.webhome.hexo fiv.webhome.hexo.git
git clone https://git.faronear.org/tuc-vic/vic.admin.vue git clone https://git.faronear.org/tuc-fiv/fiv.server.mongo fiv.server.mongo.git
popd git clone https://git.faronear.org/tuc-fiv/fiv.user.react fiv.user.react.git
mkdir tuc-fiv
pushd tuc-fiv
git clone https://git.faronear.org/tuc-fiv/fiv
git clone https://git.faronear.org/tuc-fiv/fiv.webhome.hexo
git clone https://git.faronear.org/tuc-fiv/fiv.server.mongo
git clone https://git.faronear.org/tuc-fiv/fiv.user.react
popd popd

View File

@ -1,25 +1,32 @@
#!/bin/bash #!/bin/bash
if [ $1 ] testpath1=/faronear
testpath2=~/faronear
testpath3=/mnt/d/faronear
if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d /faronear ] elif [ -d $testpath1 ]
then then
FONPATH=/faronear FONPATH=$testpath1
elif [ -d ~/faronear ] elif [ -d $testpath2 ]
then then
FONPATH=~/faronear FONPATH=$testpath2
elif [ -d $testpath3 ]
then
FONPATH=$testpath3
else else
echo "=== Enter [target path] or leave [blank] for default to `.`" echo "=== Enter [target path] or leave [blank] for default to `.`"
read -p ">>> " FONPATH read -p ">>> " FONPATH
echo "" echo ""
if [ ! $FONPATH ] if [ ! "$FONPATH" ]
then then
FONPATH=. FONPATH=.
fi fi
fi fi
if [ ! -d $FONPATH ] if [ ! -d "$FONPATH" ]
then then
echo "*** [$FONPATH] not exist! Exit now. ***" echo "*** [$FONPATH] not exist! Exit now. ***"
exit exit

View File

@ -1,28 +1,32 @@
#!/bin/bash #!/bin/bash
if [ $1 ] testpath1=/faronear
testpath2=~/faronear
testpath3=/mnt/d/faronear
if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d /faronear ] elif [ -d $testpath1 ]
then then
FONPATH=/faronear FONPATH=$testpath1
elif [ -d ~/faronear ] elif [ -d $testpath2 ]
then then
FONPATH=~/faronear FONPATH=$testpath2
elif [ -d /mnt/d/faronear ] elif [ -d $testpath3 ]
then then
FONPATH=/mnt/d/faronear FONPATH=$testpath3
else else
echo "=== Enter [target path] or leave [blank] for default to `.`" echo "=== Enter [target path] or leave [blank] for default to `.`"
read -p ">>> " FONPATH read -p ">>> " FONPATH
echo "" echo ""
if [ ! $FONPATH ] if [ ! "$FONPATH" ]
then then
FONPATH=. FONPATH=.
fi fi
fi fi
if [ ! -d $FONPATH ] if [ ! -d "$FONPATH" ]
then then
echo "*** [$FONPATH] not exist! Exit now. ***" echo "*** [$FONPATH] not exist! Exit now. ***"
exit exit

View File

@ -1,25 +1,32 @@
#!/bin/bash #!/bin/bash
if [ $1 ] testpath1=/faronear
testpath2=~/faronear
testpath3=/mnt/d/faronear
if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d /faronear ] elif [ -d $testpath1 ]
then then
FONPATH=/faronear FONPATH=$testpath1
elif [ -d ~/faronear ] elif [ -d $testpath2 ]
then then
FONPATH=~/faronear FONPATH=$testpath2
elif [ -d $testpath3 ]
then
FONPATH=$testpath3
else else
echo "=== Enter [target path] or leave [blank] for default to `.`" echo "=== Enter [target path] or leave [blank] for default to `.`"
read -p ">>> " FONPATH read -p ">>> " FONPATH
echo "" echo ""
if [ ! $FONPATH ] if [ ! "$FONPATH" ]
then then
FONPATH=. FONPATH=.
fi fi
fi fi
if [ ! -d $FONPATH ] if [ ! -d "$FONPATH" ]
then then
echo "*** [$FONPATH] not exist! Exit now. ***" echo "*** [$FONPATH] not exist! Exit now. ***"
exit exit

View File

@ -1,26 +1,32 @@
#!/bin/bash #!/bin/bash
if [ $1 ] testpath1=/faronear
testpath2=~/faronear
testpath3=/mnt/d/faronear
if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d $testpath1 ]
then
FONPATH=$testpath1
elif [ -d $testpath2 ]
then
FONPATH=$testpath2
elif [ -d $testpath3 ]
then
FONPATH=$testpath3
else else
echo Leave blank for default [/faronear], [~/faronear], [.], echo "=== Enter [target path] or leave [blank] for default to `.`"
read -p "or enter faronear path to git pull >> " FONPATH read -p ">>> " FONPATH
if [ ! $FONPATH ] echo ""
if [ ! "$FONPATH" ]
then then
if [ -d /faronear ] FONPATH=.
then
FONPATH=/faronear
elif [ -d ~/faronear ]
then
FONPATH=~/faronear
else
FONPATH=.
fi
fi fi
fi fi
if [ ! -d $FONPATH ] if [ ! -d "$FONPATH" ]
then then
echo "*** [$FONPATH] not exist! Exit now. ***" echo "*** [$FONPATH] not exist! Exit now. ***"
exit exit
@ -28,31 +34,33 @@ fi
pushd $FONPATH pushd $FONPATH
echo "*** Current path = [`pwd`] ***" echo "*** Current path = [`pwd`] ***"
for org in '*' echo ""
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do do
if [ -d $org ] echo "======== entering [$FONPATH/$org] ========"
then echo ""
echo " entering [$FONPATH/$org]" cd "$org";
cd $org; for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
for repo in * do
do if [ -d "$repo/.git" ]
if [ -d $repo/.git ] then
then cd "$repo"
cd $repo # echo " changing repo url to [$FONPATH/$org/$repo]"
# echo " changing repo url to [$FONPATH/$org/$repo]" # git remote remove origin
# git remote remove origin # git remote add origin https://git.faronear.org/$org/$repo
# git remote add origin https://git.faronear.org/$org/$repo # git pull
# git pull # git branch --set-upstream-to=origin/main main
# git branch --set-upstream-to=origin/main main # git pull
# git pull echo "---- renaming branch master to main for [`pwd`/$repo] ----"
echo " renaming master branch to main" git branch -m master main
git branch -m master main git push -u origin main
git push -u origin main git push origin :master
git push origin :master echo ""
cd .. cd ..
fi fi
done done
cd ..; cd ..
fi
done done
popd popd

View File

@ -1,40 +1,45 @@
#!/bin/bash #!/bin/bash
if [ $1 ] testpath1=/faronear/fon/sysconfig/nixhome
testpath2=~/faronear/fon/sysconfig/nixhome
testpath3=~/faronear/fon/sysconfig.git/nixhome
testpath4=`pwd`/nixhome
if [ "$1" ]
then then
SourcePath=$1 SourcePath=$1
elif [ -d $testpath1 ]
then
SourcePath=$testpath1
elif [ -d $testpath2 ]
then
SourcePath=$testpath2
elif [ -d $testpath3 ]
then
SourcePath=$testpath3
elif [ -d $testpath4 ]
then
SourcePath=$testpath4
else else
echo "Configure private home settings" echo "=== Enter [target path] or leave [blank] to exit"
echo "Usage: setup.sh [Config-Source-Path] [User-Home-Path] [--AdotMode]"
echo
echo "=== Enter config <<SourcePath>> or leave <<blank>> for [/Users/luk.lu]/faronear/fon/sysconfig/nixhome):"
read -p ">>> " SourcePath read -p ">>> " SourcePath
if [ ! $SourcePath ] echo ""
if [ ! -d "$SourcePath" ]
then then
echo "Use default source path: [Users/luk.lu]/faronear/fon/sysconfig/nixhome" echo "*** Source path [$SourcePath] not available! Exit now. ***"
echo exit
if [ -d /faronear/fon/sysconfig/nixhome ]
then
SourcePath=/faronear/fon/sysconfig/nixhome
else
if [ -d /Users/luk.lu/faronear/fon/sysconfig/nixhome ]
then
SourcePath=/Users/luk.lu/faronear/fon/sysconfig/nixhome
else
SourcePath=`pwd`/nixhome
fi
fi
fi fi
fi fi
if [ $2 ]
if [ "$2" ]
then then
HomePath=$2 HomePath=$2
else else
HomePath=~ HomePath=~
fi fi
if [ -d $SourcePath ] && [ -d $HomePath ] if [ -d $HomePath ]
then then
pushd $HomePath pushd $HomePath
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore" homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore"
@ -44,7 +49,7 @@ then
for homescript in $homescriptlist for homescript in $homescriptlist
do do
mv $homescript $homescript.backup-[$(date +%Y%m%d-%H%M%S)] mv $homescript $homescript.backup-[$(date +%Y%m%d-%H%M%S)]
if [ $CopyOrLinkScripts = 'l' ] if [ "$CopyOrLinkScripts" = 'l' ]
then then
echo "--- Linking $SourcePath/$homescript to $HomePath/$homescript ..." echo "--- Linking $SourcePath/$homescript to $HomePath/$homescript ..."
ln -s $SourcePath/$homescript $HomePath ln -s $SourcePath/$homescript $HomePath
@ -54,20 +59,20 @@ then
fi fi
done done
echo echo
echo "=== Append or link or omit [.ssh/authorized_keys]? <a> for append, <l> for link, <<anything else>> for omit:" echo "=== Append or link or omit [.ssh/authorized_keys] to config ssh server? <a> for append, <l> for link, <<anything else>> for omit:"
read -p ">>> " CopyOrLinkOrOmitAuthorizedKeys read -p ">>> " CopyOrLinkOrOmitAuthorizedKeys
if [ $CopyOrLinkOrOmitAuthorizedKeys = 'l' ] if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ]
then then
echo "--- Linking $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..." echo "--- Linking $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..."
mkdir -p $HomePath/.ssh mkdir -p $HomePath/.ssh
chmod 700 $HomePath/.ssh chmod 700 $HomePath/.ssh
mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-[$(date +%Y%m%d-%H%M%S)] mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-[$(date +%Y%m%d-%H%M%S)]
ln -s $SourcePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys ln -s $SourcePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys
elif [ $CopyOrLinkOrOmitAuthorizedKeys = 'a' ] elif [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'a' ]
then then
mkdir -p $HomePath/.ssh mkdir -p $HomePath/.ssh
chmod 700 $HomePath/.ssh chmod 700 $HomePath/.ssh
if [ -L $HomePath/.ssh/authorized_keys ] if [ -L '$HomePath/.ssh/authorized_keys' ]
then then
mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup
fi fi
@ -77,7 +82,7 @@ then
echo echo
popd popd
else else
echo "!!! Not existing $SourcePath or $HomePath, please try again." echo "!!! Not existing $HomePath, please try again."
fi fi
echo "=== Sourcing $HomePath/.bashrc ..." echo "=== Sourcing $HomePath/.bashrc ..."

View File

@ -99,18 +99,30 @@ fi
export USERPROFILE=$HOME export USERPROFILE=$HOME
# add sysconfig to path # add sysconfig to path
if [ -d /Users/luk.lu/faronear/fon/sysconfig ] tp1=/Users/luk.lu/faronear/fon/sysconfig
tp2=/Users/luk.lu/faronear/fon/sysconfig.git
tp3=/faronear/fon/sysconfig
tp4=/faronear/fon/sysconfig.git
tp5=/mnt/c/faronear/fon/sysconfig.git
tp6=/mnt/d/faronear/fon/sysconfig.git
if [ -d $tp1 ]
then then
export PATH=/Users/luk.lu/faronear/fon/sysconfig:$PATH export PATH=$tp1:$PATH
elif [ -d /Users/luk.lu/faronear/fon/sysconfig.git ] elif [ -d $tp2 ]
then then
export PATH=/Users/luk.lu/faronear/fon/sysconfig.git:$PATH export PATH=$tp2:$PATH
elif [ -d /faronear/fon/sysconfig ] elif [ -d $tp3 ]
then then
export PATH=/faronear/fon/sysconfig:$PATH export PATH=$tp3:$PATH
elif [ -d /faronear/fon/sysconfig.git ] elif [ -d $tp4 ]
then then
export PATH=/faronear/fon/sysconfig.git:$PATH export PATH=$tp4:$PATH
elif [ -d $tp5 ]
then
export PATH=$tp5:$PATH
elif [ -d $tp6 ]
then
export PATH=$tp6:$PATH
fi fi
if [ -f ~/.bashrc_custom ] if [ -f ~/.bashrc_custom ]

View File

@ -1,25 +1,32 @@
#!/bin/bash #!/bin/bash
if [ $1 ] testpath1=/faronear
testpath2=~/faronear
testpath3=/mnt/d/faronear
if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d /faronear ] elif [ -d $testpath1 ]
then then
FONPATH=/faronear FONPATH=$testpath1
elif [ -d ~/faronear ] elif [ -d $testpath2 ]
then then
FONPATH=~/faronear FONPATH=$testpath2
elif [ -d $testpath3 ]
then
FONPATH=$testpath3
else else
echo "=== Enter [target path] or leave [blank] for default to `.`" echo "=== Enter [target path] or leave [blank] for default to `.`"
read -p ">>> " FONPATH read -p ">>> " FONPATH
echo "" echo ""
if [ ! $FONPATH ] if [ ! "$FONPATH" ]
then then
FONPATH=. FONPATH=.
fi fi
fi fi
if [ ! -d $FONPATH ] if [ ! -d "$FONPATH" ]
then then
echo "*** [$FONPATH] not exist! Exit now. ***" echo "*** [$FONPATH] not exist! Exit now. ***"
exit exit

View File

@ -1,28 +1,32 @@
#!/bin/bash #!/bin/bash
if [ $1 ] testpath1=/faronear
testpath2=~/faronear
testpath3=/mnt/d/faronear
if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d /faronear ] elif [ -d $testpath1 ]
then then
FONPATH=/faronear FONPATH=$testpath1
elif [ -d ~/faronear ] elif [ -d $testpath2 ]
then then
FONPATH=~/faronear FONPATH=$testpath2
elif [ -d /mnt/d/faronear ] elif [ -d $testpath3 ]
then then
FONPATH=/mnt/d/faronear FONPATH=$testpath3
else else
echo "=== Enter [target path] or leave [blank] for default to `.`" echo "=== Enter [target path] or leave [blank] for default to `.`"
read -p ">>> " FONPATH read -p ">>> " FONPATH
echo "" echo ""
if [ ! $FONPATH ] if [ ! "$FONPATH" ]
then then
FONPATH=. FONPATH=.
fi fi
fi fi
if [ ! -d $FONPATH ] if [ ! -d "$FONPATH" ]
then then
echo "*** [$FONPATH] not exist! Exit now. ***" echo "*** [$FONPATH] not exist! Exit now. ***"
exit exit