diff --git a/acme-setup-all.sh b/acme-setup-all.sh index 030a7c0..6ed0a87 100644 --- a/acme-setup-all.sh +++ b/acme-setup-all.sh @@ -9,12 +9,12 @@ echo while [ ! "$ISSUEMODE" ] do echo "=== Issue mode:" - echo " for standalone" - echo " for webroot" - echo " for nginx" - echo " for apache" - echo " for challenge-alias" - echo " for dnsapi" + echo " [s] for standalone" + echo " [w] for webroot" + echo " [n] for nginx" + echo " [a] for apache" + echo " [c] for challenge-alias" + echo " [d] for dnsapi" read -p ">>> " ISSUEMODE if [ "$ISSUEMODE" == 's' ] then @@ -45,7 +45,7 @@ if [ "$ISSUEMODE" == 'd' ] then while [ ! "$DNSAPI" ] do - echo "=== DNS API provider, for CloudFlare, for DNSPod/腾讯云, for Aliyun/阿里云:" + echo "=== DNS API provider, [cf] for CloudFlare, [dp] for DNSPod/腾讯云, [ali] for Aliyun/阿里云:" read -p ">>> " DNSAPI_PROVIDER if [ "$DNSAPI_PROVIDER" == 'cf' ] then @@ -76,7 +76,7 @@ echo "***" ~/.acme.sh/acme.sh --issue -d $TARGET_HOSTNAME $ISSUEPARM $DNSAPI echo -echo "=== Install certificates? for no, to install: " +echo "=== Install certificates? [n] for no, [anything else] to install: " read -p ">>> " INSTALL_CERT if [ "$INSTALL_CERT" != 'n' ] then @@ -93,7 +93,7 @@ then read -p ">>> " FULLCHAIN_FILE_PATH done echo - echo "=== Set reload command, for default to 'service nginx force-reload'" + echo "=== Set reload command, [leave blank] for default to 'service nginx force-reload'" read -p ">>> " RELOADCMD if [ ! "$RELOADCMD" ] then diff --git a/debian-add-user.sh b/debian-add-user.sh index 3bddd87..20e32c3 100755 --- a/debian-add-user.sh +++ b/debian-add-user.sh @@ -22,7 +22,7 @@ sed -i "s|/home/$NewUser:/bin/sh$|/home/$NewUser:/bin/bash|g" /etc/passwd # Debian 9 default to empty sed -i "s|/home/$NewUser:$|/home/$NewUser:/bin/bash|g" /etc/passwd -echo "=== Allow the new user [$NewUser] to sudo without password? for yes, for no" +echo "=== Allow the new user [[$NewUser]] to sudo without password? [y] for yes, [anything else] for no" read -p ">>> " AllowSudo if [ "$AllowSudo" == "y" ] then diff --git a/debian-setup.sh b/debian-setup.sh index bee7ec0..a45ca4e 100755 --- a/debian-setup.sh +++ b/debian-setup.sh @@ -34,7 +34,7 @@ echo "=== Configure root home" source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome root echo -echo "=== Change root password? for yes, for omit:" +echo "=== Change root password? [y] for yes, [anything else] for omit:" read -p ">>> " ChangeRootPassword if [ "$ChangeRootPassword" == 'y' ] then @@ -66,7 +66,7 @@ then echo fi -echo "=== Set or for no change" +echo "=== Set [new hostname] or [leave blank] for no change" read -p ">>> " NewHostname if [ $NewHostname ] then @@ -93,7 +93,7 @@ chmod +x /faronear/autostart.sh echo 'Autostart is set to /faronear/autostart.sh. Run "systemctl start/stop/status rc-local" to manage it.' echo -echo "=== Configure locales: for yes, for no change:" +echo "=== Configure locales: [y] for yes, [anything else] for no change:" read -p ">>> " ConfigLocales if [ "$ConfigLocales" == 'y' ] then @@ -101,7 +101,7 @@ then fi echo -echo "=== Add a new user [$NewUser]? for yes, for no change:" +echo "=== Add a new user [[$NewUser]]? [y] for yes, [anything else] for no change:" read -p ">>> " AddNewUser if [ "$AddNewUser" == 'y' ] then @@ -109,13 +109,13 @@ then source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome $NewUser echo - echo "=== Enable xfce autologin [/etc/lightdm/lightdm.conf]: for autologin as [$NewUser] or for no change:" + echo "=== Enable xfce autologin [/etc/lightdm/lightdm.conf]: [y] for autologin as [[$NewUser]] or [anything else] for no change:" read -p ">>> " XfceAutologin if [ "$XfceAutologin" == "y" ] then sed -i "s/^.*autologin-user=.*$/autologin-user=$NewUser/g" /etc/lightdm/lightdm.conf sed -i "s/^.*autologin-user-timeout=.*$/autologin-user-timeout=0/g" /etc/lightdm/lightdm.conf - echo "--- Successfully configured autologin as $NewUser" + echo "--- Successfully configured autologin as [[$NewUser]]" else echo '--- Nothing changed.' fi diff --git a/docker-allow-user.sh b/docker-allow-user.sh index 8f0f7f0..b6e1d0c 100755 --- a/docker-allow-user.sh +++ b/docker-allow-user.sh @@ -3,7 +3,7 @@ if [ "$1" ] then DOCKERUSER=$1 else - echo "Enter the or for default to '`whoami`'" + echo "Enter the [user name] or [leave blank] for default to '`whoami`'" read -p ">>> " DOCKERUSER if [ ! "$DOCKERUSER" ] then diff --git a/docker-install.sh b/docker-install.sh index 3095641..8d88f74 100755 --- a/docker-install.sh +++ b/docker-install.sh @@ -6,7 +6,7 @@ # 安装自带版本 apt install docker.io && apt install docker-compose # sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin -echo "=== Choose docker source: 阿里云, 中科大, for default" +echo "=== Choose docker source: [a] 阿里云, [z] 中科大, [leave blank] for default" read -p ">>> " DOCKER_SOURCE if [ "$DOCKER_SOURCE" = 'a' ] then @@ -48,7 +48,7 @@ docker compose version # sudo curl -L $COMPOSE_URL/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose # sudo chmod +x /usr/local/bin/docker-compose -echo "=== Enter to 配置中国加速镜像源 /etc/docker/daemon.json, for no mirror:" +echo "=== Enter [y] to 配置中国加速镜像源 /etc/docker/daemon.json, [anything else] for no mirror:" read -p ">>> " DOCKER_MIRROR if [ "$DOCKER_MIRROR" = 'y' ] then @@ -61,7 +61,7 @@ then echo '] }' >> /etc/docker/daemon.json fi -echo "=== 启动docker服务? for yes, for no" +echo "=== 启动docker服务?[y] for yes, [anything else] for no" read -p ">>> " StartDockerDaemon if [ "$StartDockerDaemon" = 'y' ] then diff --git a/geth-install.sh b/geth-install.sh index d09c72c..1058ec2 100755 --- a/geth-install.sh +++ b/geth-install.sh @@ -6,7 +6,7 @@ if [ $1 ] then VERSION=$1 else - echo "=== Enter geth or for default $defaultVERSION" + echo "=== Enter geth [version number] or [leave blank] for default $defaultVERSION" read -p ">>> " VERSION if [ ! "$VERSION" ] then diff --git a/git-ignore-tree.bat b/git-ignore-tree.bat index 46f09de..441d311 100644 --- a/git-ignore-tree.bat +++ b/git-ignore-tree.bat @@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear @ if not "" == "%1" ( set FONPATH=%1 ) else ( - echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] +echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]] if exist "%FONPATH1%" ( set FONPATH=%FONPATH1% ) else if exist "%FONPATH2%" ( @@ -20,44 +20,44 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear ) else ( echo ××× none of the testing path is valid. echo; - echo === Enter or leave for default to '.' + echo === Enter [start path] or [leave blank] for default to [[%CD%]] set /p FONPATH=">>> " echo; if "" == "%FONPATH%" ( - set FONPATH=. + set FONPATH=%CD% ) ) ) if not exist "%FONPATH%" ( - echo ××× [%FONPATH%] not exist! Exit now. *** + echo ××× [[%FONPATH%]] not exist! Exit now. *** @ GOTO END ) else ( - echo √√√ FONPATH = %FONPATH% -) - -echo === Enter [path to .gitignore] or leave [blank] for default to '.' -set /p GITIGNOREPATH=">>> " -echo; -if "" == "%GITIGNOREPATH%" ( - set GITIGNOREPATH=. -) -if not exist "%GITIGNOREPATH%" ( - echo ××× [%GITIGNOREPATH%] not exist! Exit now. *** - @ GOTO END -) else ( - echo √√√ GITIGNOREPATH = %GITIGNOREPATH% + echo √√√ FONPATH = [[%FONPATH%]] ) pushd %FONPATH% -echo *** Starting from [%CD%] *** +echo *** Starting from [[%CD%]] *** echo; +echo === Enter [path to .gitignore] or [leave blank] for default to [[%CD%]] +set /p GITIGNOREPATH=">>> " +echo; +if "" == "%GITIGNOREPATH%" ( + set GITIGNOREPATH=%CD% +) +if not exist "%GITIGNOREPATH%" ( + echo ××× [[%GITIGNOREPATH%]] not exist! Exit now. *** + @ GOTO END +) else ( + echo √√√ GITIGNOREPATH = [[%GITIGNOREPATH%]] +) + for /d /r %%r in (*) do ( @REM @ if not "%%r" == ".vscode" ( echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || ( if exist "%%r\.gitignore" ( pushd "%%r" - echo ---- updating .gitignore in [%%r] ---- + echo ---- updating .gitignore in [[%%r]] ---- copy %GITIGNOREPATH%\.gitignore %%r\ echo; popd diff --git a/git-pull-tree.bat b/git-pull-tree.bat index 3210da5..225c87f 100644 --- a/git-pull-tree.bat +++ b/git-pull-tree.bat @@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear @ if not "" == "%1" ( set FONPATH=%1 ) else ( - echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] +echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]] if exist "%FONPATH1%" ( set FONPATH=%FONPATH1% ) else if exist "%FONPATH2%" ( @@ -20,37 +20,37 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear ) else ( echo ××× none of the testing path is valid. echo; - echo === Enter or leave for default to '.' + echo === Enter [start path]> or [leave blank] for default to [[%CD%]] set /p FONPATH=">>> " echo; if "" == "%FONPATH%" ( - set FONPATH=. + set FONPATH=%CD% ) ) ) if not exist "%FONPATH%" ( - echo ××× [%FONPATH%] not exist! Exit now. *** + echo ××× [[%FONPATH%]] not exist! Exit now. *** @ GOTO END ) else ( - echo √√√ FONPATH = %FONPATH% + echo √√√ FONPATH = [[%FONPATH%]] ) pushd %FONPATH% -echo *** Starting from [%CD%] *** +echo *** Starting from [[%CD%]] *** echo; @ if "%2" == "hier" ( @REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd ) for /d %%o in (*) do ( @ if not "%%o" == ".vscode" ( - echo ======== entering [%FONPATH%\%%o] ======== + echo ======== entering [[%FONPATH%\%%o]] ======== echo; pushd %%o for /d %%g in (*) do ( if exist "%%g\.git" ( pushd %%g - echo ---- git pulling [%FONPATH%\%%o\%%g] ---- + echo ---- git pulling [[%FONPATH%\%%o\%%g]] ---- git pull --all echo; popd @@ -65,7 +65,7 @@ echo; echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || ( if exist "%%r\.git" ( pushd "%%r" - echo ---- git pulling [%%r] ---- + echo ---- git pulling [[%%r]] ---- git pull --all echo; popd diff --git a/git-pull-tree.sh b/git-pull-tree.sh index 0c94c15..889a095 100755 --- a/git-pull-tree.sh +++ b/git-pull-tree.sh @@ -5,25 +5,25 @@ then FONPATH=$1 else echo "" - echo "=== Enter or leave for default to '.'" + echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]" read -p ">>> " FONPATH echo "" if [ ! "$FONPATH" ] then - FONPATH=. + FONPATH=`pwd` fi fi if [ ! -d "$FONPATH" ] then - echo "××× <$FONPATH> not exist! Exit now. ***" + echo "××× [[$FONPATH]] not exist! Exit now. ***" exit else - echo "√√√ FONPATH = $FONPATH" + echo "√√√ FONPATH = [[$FONPATH]]" fi pushd $FONPATH -echo "*** Starting from [`pwd`] ***" +echo "*** Starting from [[`pwd`]] ***" echo "" if [ "$2" == 'hier' ] @@ -31,14 +31,14 @@ then # for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。 ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名 do - echo "======== entering [$FONPATH/$org] ========" + echo "======== entering [[$FONPATH/$org]] ========" echo "" cd "$org"; for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格 do if [ -d "$repo/.git" ] then - echo "---- git pulling [`pwd`/$repo] ----" + echo "---- git pulling [[`pwd`/$repo]] ----" cd "$repo" git pull --all echo "" @@ -52,7 +52,7 @@ else do if [ -d "$repo/.git" ] then - echo "---- git pulling [$repo] ----" + echo "---- git pulling [[$repo]] ----" pushd "$repo" git pull --all echo "" diff --git a/git-push-tree.bat b/git-push-tree.bat index ce5604b..80361fc 100644 --- a/git-push-tree.bat +++ b/git-push-tree.bat @@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear @ if not "" == "%1" ( set FONPATH=%1 ) else ( - echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] +echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]] if exist "%FONPATH1%" ( set FONPATH=%FONPATH1% ) else if exist "%FONPATH2%" ( @@ -20,24 +20,24 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear ) else ( echo ××× none of the testing path is valid. echo; - echo === Enter or leave for default to '.' + echo === Enter [start path] or [leave blank] for default to [[%CD%]] set /p FONPATH=">>> " echo; if "" == "%FONPATH%" ( - set FONPATH=. + set FONPATH=%CD% ) ) ) if not exist "%FONPATH%" ( - echo ××× [%FONPATH%] not exist! Exit now. *** + echo ××× [[%FONPATH%]] not exist! Exit now. *** @ GOTO END ) else ( - echo √√√ FONPATH = %FONPATH% + echo √√√ FONPATH = [[%FONPATH%]] ) pushd %FONPATH% -echo *** Starting from [%CD%] *** +echo *** Starting from [[%CD%]] *** echo; echo === Enter [commit message] or [leave blank] for default to 'updated' @@ -51,13 +51,13 @@ echo; @REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd ) for /d %%o in (*) do ( @ if not "%%o" == ".vscode" ( - echo ======== entering [%FONPATH%\%%o] ======== + echo ======== entering [[%FONPATH%\%%o]] ======== echo; pushd "%%o" for /d %%g in (*) do ( if exist %%g\.git ( pushd "%%g" - echo ---- git commit and push [%FONPATH%\%%o\%%g] ---- + echo ---- git commit and push [[%FONPATH%\%%o\%%g]] ---- git add . && git commit -m "%COMMIT_MESSAGE%" && git push echo; popd @@ -72,7 +72,7 @@ echo; echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || ( if exist "%%r\.git" ( pushd "%%r" - echo ---- git commit and push [%%r] ---- + echo ---- git commit and push [[%%r]] ---- git add . && git commit -m "%COMMIT_MESSAGE%" && git push echo; popd diff --git a/git-push-tree.sh b/git-push-tree.sh index d89f263..d7d017d 100755 --- a/git-push-tree.sh +++ b/git-push-tree.sh @@ -5,28 +5,28 @@ then FONPATH=$1 else echo "" - echo "=== Enter or leave for default to '.'" + echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]" read -p ">>> " FONPATH echo "" if [ ! "$FONPATH" ] then - FONPATH=. + FONPATH=`pwd` fi fi if [ ! -d "$FONPATH" ] then - echo "××× <$FONPATH> not exist! Exit now. ***" + echo "××× [[$FONPATH]] not exist! Exit now. ***" exit else - echo "√√√ FONPATH = $FONPATH" + echo "√√√ FONPATH = [[$FONPATH]]" fi pushd $FONPATH -echo "*** Starting from [`pwd`] ***" +echo "*** Starting from [[`pwd`]] ***" echo "" -echo "=== Enter or for default to 'updated'" +echo "=== Enter [commit message] or [leave blank] for default to 'updated'" read -p ">>> " COMMIT_MESSAGE if [ ! "$COMMIT_MESSAGE" ] then @@ -34,7 +34,7 @@ then fi echo "" -echo "=== Enter for hierarchical, for recursive, for listing" +echo "=== Enter [h] for hierarchical, [r] for recursive, [anything else] for listing" read -p ">>> " ACTION_TYPE if [ "$ACTION_TYPE" == 'h' ] @@ -42,14 +42,14 @@ then # for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。 ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名 do - echo "======== entering [$FONPATH/$org] ========" + echo "======== entering [[$FONPATH/$org]] ========" echo "" cd "$org"; for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格 do if [ -d "$repo/.git" ] then - echo "---- git commit & push [`pwd`/$repo] ----" + echo "---- git commit & push [[`pwd`/$repo]] ----" pushd "$repo" git add . && git commit -m "$COMMIT_MESSAGE" && git push echo "" @@ -64,7 +64,7 @@ then do if [ -d "$repo/.git" ] then - echo "---- git commit & push [$repo] ----" + echo "---- git commit & push [[$repo]] ----" pushd "$repo" git add . && git commit -m "$COMMIT_MESSAGE" && git push echo "" diff --git a/git-rename-branch.bat b/git-rename-branch.bat index d14a236..b85b74f 100755 --- a/git-rename-branch.bat +++ b/git-rename-branch.bat @@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear @ if not "" == "%1" ( set FONPATH=%1 ) else ( - echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] +echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]] if exist "%FONPATH1%" ( set FONPATH=%FONPATH1% ) else if exist "%FONPATH2%" ( @@ -23,21 +23,21 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear ) if not exist %FONPATH% ( - echo ××× [%FONPATH%] not exist! Exit now. *** + echo ××× [[%FONPATH%]] not exist! Exit now. *** @ GOTO END ) else ( - echo √√√ FONPATH = %FONPATH% + echo √√√ FONPATH = [[%FONPATH%]] ) pushd %FONPATH% -echo *** Current path = [%CD%] *** +echo *** Current path = [[%CD%]] *** @REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd ) for /d %%o in (*) do ( @REM windows的链接文件会造成路径错误,从而终止该循环,从而导致下一轮乃至所有循环的工作目录错误。因此要过滤掉 .vscode 这个符号链接目录。 if not %%o == .vscode ( - echo entering [%FONPATH%\%%o] + echo entering [[%FONPATH%\%%o]] pushd %%o for /d %%g in (*) do ( if exist %%g\.git ( diff --git a/git-rename-branch.sh b/git-rename-branch.sh index 19ff613..7b81a83 100755 --- a/git-rename-branch.sh +++ b/git-rename-branch.sh @@ -5,31 +5,31 @@ then FONPATH=$1 else echo "" - echo "=== Enter or leave for default to '.'" + echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]" read -p ">>> " FONPATH echo "" if [ ! "$FONPATH" ] then - FONPATH=. + FONPATH=`pwd` fi fi if [ ! -d "$FONPATH" ] then - echo "××× <$FONPATH> not exist! Exit now. ***" + echo "××× [[$FONPATH]] not exist! Exit now. ***" exit else - echo "√√√ FONPATH = $FONPATH" + echo "√√√ FONPATH = [[$FONPATH]]" fi pushd $FONPATH -echo "*** Current path = [`pwd`] ***" +echo "*** Starting from [[`pwd`]] ***" echo "" # for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。 ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名 do - echo "======== entering [$FONPATH/$org] ========" + echo "======== entering [[$FONPATH/$org]] ========" echo "" cd "$org"; for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格 @@ -37,13 +37,13 @@ do if [ -d "$repo/.git" ] then cd "$repo" - # echo " changing repo url to [$FONPATH/$org/$repo]" + # echo " changing repo url to [[$FONPATH/$org/$repo]]" # git remote remove origin # git remote add origin https://git.faronear.org/$org/$repo # git pull # git branch --set-upstream-to=origin/main main # git pull - echo "---- renaming branch master to main for [`pwd`/$repo] ----" + echo "---- renaming branch master to main for [[`pwd`/$repo]] ----" git branch -m master main git push -u origin main git push origin :master diff --git a/git-repo-change-hook-path.sh b/git-repo-change-hook-path.sh index 43b119d..e58b145 100755 --- a/git-repo-change-hook-path.sh +++ b/git-repo-change-hook-path.sh @@ -3,14 +3,14 @@ echo "in [REPOROOT]/*/*/hooks/[pre-receive.d|post-receive.d|update.d]/gitea, path is hard-coded in full such as `/faronear/git/gitea/gitea hook --config=/faronear/git/gitea/custom/conf/app.ini`, you need to replace it if the path is changed." echo "[20230305] noticed that gitea 1.18.5 default is `/usr/local/bin/gitea hook --config=/data/gitea/conf/app.ini`" -echo "Enter or for default '/faronear/git/gitea/gitea':" +echo "Enter [old hook path] or [leave blank] for default '/faronear/git/gitea/gitea':" read -p ">>> " OLDPATH if [ ! "$OLDPATH"] then OLDPATH=/faronear/git/gitea/gitea fi -echo "Enter or for default '/usr/local/bin/gitea': " +echo "Enter [new hook path] or [leave blank] for default '/usr/local/bin/gitea': " read -p ">> " NEWPATH if [ ! "$NEWPATH" ] then diff --git a/ipfs-install.sh b/ipfs-install.sh index dc508e5..b566efc 100755 --- a/ipfs-install.sh +++ b/ipfs-install.sh @@ -6,7 +6,7 @@ if [ $1 ] then VERSION=$1 else - echo "=== Enter kubo or for default $defaultVERSION" + echo "=== Enter kubo [version number] or [leave blank] for default $defaultVERSION" read -p ">>> " VERSION if [ ! $VERSION ] then diff --git a/nixhome-config.sh b/nixhome-config.sh index 3525743..44eeed3 100755 --- a/nixhome-config.sh +++ b/nixhome-config.sh @@ -23,7 +23,7 @@ else echo "" if [ ! -d "$NIXHOME" ] then - echo "××× nixhome path [$NIXHOME] not available! Exit now. ×××" + echo "××× nixhome path [[$NIXHOME]] not available! Exit now. ×××" exit fi fi @@ -50,7 +50,7 @@ then homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore" echo - echo "=== Copy or link scripts? to link, to copy, to git import, to omit:" + echo "=== Copy or link scripts? [l] to link, [c] to copy, [g] to git import, [anything else] to omit:" read -p ">>> " CopyOrLinkScripts if [ "$CopyOrLinkScripts" == 'l' ] then @@ -60,7 +60,7 @@ then then mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc) fi - echo "--- Linking $NIXHOME/$homescript to $HomePath/$homescript ..." + echo "--- Linking [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..." ln -s $NIXHOME/$homescript ./ done elif [ "$CopyOrLinkScripts" == 'c' ] @@ -71,7 +71,7 @@ then then mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc) fi - echo "--- Copying $NIXHOME/$homescript to $HomePath/$homescript ..." + echo "--- Copying [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..." cp -r $NIXHOME/$homescript ./ done elif [ "$CopyOrLinkScripts" == 'g' ] @@ -108,17 +108,17 @@ then mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-$(date -u +%Y%m%dT%H%M%Sutc) fi - echo "=== Append or link or omit [$HomePath/.ssh/authorized_keys] to config ssh server? for append, for link, for omit:" + echo "=== Append or link or omit [[$HomePath/.ssh/authorized_keys]] to config ssh server? [a] for append, [l] for link, [anything else] for omit:" read -p ">>> " CopyOrLinkOrOmitAuthorizedKeys if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ] then - echo "--- Linking $NIXHOME/authorized_keys to $HomePath/.ssh/authorized_keys ..." + echo "--- Linking [[$NIXHOME/authorized_keys]] to [[$HomePath/.ssh/authorized_keys]] ..." ln -s $NIXHOME/.ssh/authorized_keys $HomePath/.ssh/authorized_keys sudo chmod 644 $HomePath/.ssh/authorized_keys # 确保其他用户能读取 nixhome/.ssh/authorized_keys elif [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'a' ] then - echo "--- Copying $NIXHOME/authorized_keys to $HomePath/.ssh/authorized_keys ..." + echo "--- Copying [[$NIXHOME/authorized_keys]] to [[$HomePath/.ssh/authorized_keys]] ..." cat $NIXHOME/.ssh/authorized_keys >> $HomePath/.ssh/authorized_keys chmod 600 $HomePath/.ssh/authorized_keys fi @@ -129,5 +129,5 @@ then popd else - echo "!!! Not existing $HomePath, please try again." + echo "!!! Not found [[$HomePath]], please try again." fi diff --git a/nodejs-install.sh b/nodejs-install.sh index 7843588..ce9cfdc 100755 --- a/nodejs-install.sh +++ b/nodejs-install.sh @@ -8,7 +8,7 @@ if [ $1 ] then VERSION=$1 else - echo "=== Enter or 'tools' or for default $defaultVERSION" + echo "=== Enter [nodejs version] or [leave blank] for default $defaultVERSION, enter [tools] to install C++ build tools" read -p ">>> " VERSION if [ ! $VERSION ] then diff --git a/npm-boot-tree.bat b/npm-boot-tree.bat index ffad819..5afc6ec 100644 --- a/npm-boot-tree.bat +++ b/npm-boot-tree.bat @@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear @ if not "" == "%1" ( set FONPATH=%1 ) else ( - echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] +echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]] if exist "%FONPATH1%" ( set FONPATH=%FONPATH1% ) else if exist "%FONPATH2%" ( @@ -20,38 +20,38 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear ) else ( echo ××× none of the testing path is valid. echo; - echo === Enter or leave for default to '.' + echo === Enter [start path] or [leave blank] for default to [[%CD%]] set /p FONPATH=">>> " echo; if "" == "%FONPATH%" ( - set FONPATH=. + set FONPATH=%CD% ) ) ) if not exist "%FONPATH%" ( - echo ××× [%FONPATH%] not exist! Exit now. *** + echo ××× [[%FONPATH%]] not exist! Exit now. *** @ GOTO END ) else ( - echo √√√ FONPATH = %FONPATH% + echo √√√ FONPATH = [[%FONPATH%]] ) pushd %FONPATH% -echo *** Starting from [%CD%] *** +echo *** Starting from [[%CD%]] *** echo; @ if "%2" == "hier" ( @REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do if exist %%d/package.json ( pushd %%d & echo --- npm booting: %%d ... & npm run boot & popd ) ) & popd ) for /d %%o in (*) do ( @ if not "%%o" == ".vscode" ( - echo ======== entering [%FONPATH%\%%o] ======== + echo ======== entering [[%FONPATH%\%%o]] ======== echo; pushd %%o for /d %%g in (*) do ( @ if exist "%%g\package.json" ( findstr "\"boot\"" %%g\package.json >NUL && ( pushd %%g - echo ---- npm booting [%FONPATH%\%%o\%%g] ---- + echo ---- npm booting [[%FONPATH%\%%o\%%g]] ---- npm run boot echo; popd @@ -68,7 +68,7 @@ echo; if exist "%%r\package.json" ( findstr "\"boot\"" "%%r\package.json" >NUL && ( pushd %%r - echo ---- npm booting [%FONPATH%\%%r] ---- + echo ---- npm booting [[%FONPATH%\%%r]] ---- npm run boot echo; popd diff --git a/npm-boot-tree.sh b/npm-boot-tree.sh index 7775d4d..62e99f8 100755 --- a/npm-boot-tree.sh +++ b/npm-boot-tree.sh @@ -5,25 +5,25 @@ then FONPATH=$1 else echo "" - echo "=== Enter or leave for default to '.'" + echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]" read -p ">>> " FONPATH echo "" if [ ! "$FONPATH" ] then - FONPATH=. + FONPATH=`pwd` fi fi if [ ! -d "$FONPATH" ] then - echo "××× <$FONPATH> not exist! Exit now. ***" + echo "××× [[$FONPATH]] not exist! Exit now. ***" exit else - echo "√√√ FONPATH = $FONPATH" + echo "√√√ FONPATH = [[$FONPATH]]" fi pushd $FONPATH -echo "*** Starting from [`pwd`] ***" +echo "*** Starting from [[`pwd`]] ***" echo "" if [ "$2" == 'hier' ] @@ -31,17 +31,17 @@ then # for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。 ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名 do - echo "======== entering [$FONPATH/$org] ========" + echo "======== entering [[$FONPATH/$org]] ========" echo "" cd "$org"; for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格 do if ( [ -f "$repo/package.json" ] && grep -q '"boot"' "$repo/package.json" ) then - echo "<<<< npm booting: [$org/$repo] <<<<" + echo "<<<< npm booting: [[$org/$repo]] <<<<" cd "$repo" npm run boot - echo ">>>> npm booted: [$org/$repo] >>>>" + echo ">>>> npm booted: [[$org/$repo]] >>>>" echo "" cd .. fi @@ -54,12 +54,12 @@ else if ( [ -f "$repo/package.json" ] && grep -q '"boot"' "$repo/package.json" ) then echo "" - echo "---- npm booting: [$repo] ----" + echo "---- npm booting: [[$repo]] ----" echo "" pushd "$repo" npm run boot echo "" - echo "---- npm booted: [$repo] ----" + echo "---- npm booted: [[$repo]] ----" echo "" popd fi diff --git a/npm-clear-tree.bat b/npm-clear-tree.bat index 532a7c4..995a9d1 100644 --- a/npm-clear-tree.bat +++ b/npm-clear-tree.bat @@ -15,24 +15,24 @@ set FONPATH= ) else ( echo ××× none of the testing path is valid. echo; - echo === Enter or leave for default to '.' + echo === Enter [start path] or [leave blank] for default to [[%CD%]] set /p FONPATH=">>> " echo; if "" == "%FONPATH%" ( - set FONPATH=. + set FONPATH=%CD% ) ))) ) if not exist "%FONPATH%" ( - echo ××× [%FONPATH%] not exist! Exit now. *** + echo ××× [[%FONPATH%]] not exist! Exit now. *** @ GOTO END ) else ( - echo √√√ FONPATH = %FONPATH% + echo √√√ FONPATH = [[%FONPATH%]] ) pushd %FONPATH% -echo *** Starting from [%CD%] *** +echo *** Starting from [[%CD%]] *** echo; for /d /r %%r in (*) do ( @@ -40,7 +40,7 @@ for /d /r %%r in (*) do ( echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || ( if exist "%%r\node_modules" ( pushd "%%r" - echo ---- Deleting [%FONPATH%\%%r] ---- + echo ---- Deleting [[%FONPATH%\%%r]] ---- rd /s /q node_modules echo; popd diff --git a/rclone-starter.sh b/rclone-starter.sh index 12f4220..4c0e2e0 100644 --- a/rclone-starter.sh +++ b/rclone-starter.sh @@ -1,6 +1,6 @@ #!/bin/bash -echo "=== rclone to install, to sync, to copy, to web gui" +echo "=== rclone [i] to install, [s] to sync, [c] to copy, [w] to web gui" read -p ">>> " ACTION_TYPE if [ "$ACTION_TYPE" = 'i' ] then @@ -23,7 +23,7 @@ then echo "*****************************" echo "rclone $RC_CMD $SOURCE_PATH $TARGET_PATH -P -L --create-empty-src-dirs --exclude=._* --exclude=.DS_Store --exclude={node_modules/,.deploy_git/,unpackage/,$EXCLUDING}" echo "*****************************" - echo "Starting? for yes, for quit" + echo "Starting? [y] for yes, [anything else] for quit" read -p ">>> " YES_OR_NOT if [ "$YES_OR_NOT" = 'y' ] then diff --git a/rename-host.sh b/rename-host.sh index f768720..d6a41fd 100755 --- a/rename-host.sh +++ b/rename-host.sh @@ -2,7 +2,7 @@ if [ $1 ] then NewHostname=$1 else - echo "=== Set or for no change" + echo "=== Set [new hostname] or [leave blank] for no change" read -p ">>> " NewHostname fi diff --git a/run-files-recursively.sh b/run-files-recursively.sh index b8356d8..62c4c9e 100644 --- a/run-files-recursively.sh +++ b/run-files-recursively.sh @@ -2,7 +2,7 @@ echo "***************************************" echo "find \$FOLDER -mindepth \$MINDEPTH -maxdepth \$MAXDEPTH -type d_f_l -name \"\$PATTERN\" | while read item; do echo \"\$item\"; done" echo "***************************************" -echo "To find in which path? Enter or for the current path:" +echo "To find in which path? Enter [start path] or [leave blank] for the current path:" read -p ">>> " FIND_FOLDER if [ ! "$FIND_FOLDER" ] then @@ -20,21 +20,21 @@ then MAXDEPTH_CLAUSE="-mindepth $MAXDEPTH" fi -echo "To find file or directory? for file, for directory, for link, for all:" +echo "To find file or directory? [f] for file, [d] for directory, [l] for link, [leave blank] for all:" read -p ">>> " FIND_TYPE if [ "$FIND_TYPE" ] then FIND_TYPE_CLAUSE="-type $FIND_TYPE" fi -echo "To match pattern: (e.g. '._*', '.*.js') or or for all:" +echo "To match pattern: [regex pattern] (e.g. '._*', '.*.js') or or [leave blank] for all:" read -p ">>> " FIND_PATTERN if [ ! "$FIND_PATTERN" ] then FIND_PATTERN="*" fi -echo "To do something on each: or for 'echo':" +echo "To do something on each: [command line] or [leave blank] for 'echo':" read -p ">>> " FIND_ACTION if [ ! "$FIND_ACTION" ] then diff --git a/seafile-cli-install.sh b/seafile-cli-install.sh index 8b7bab6..46466b8 100755 --- a/seafile-cli-install.sh +++ b/seafile-cli-install.sh @@ -3,7 +3,7 @@ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/seafile-keyring.asc] https:/ sudo apt update sudo apt install -y seafile-cli -echo "To initialze the client, create a settings folder or for default '~/seafile-client'" +echo "To initialze the client, create a settings folder at [settings path] or [leave blank] for default '~/seafile-client'" read -p ">>> " SETTINGS_FOLDER if [ ! $SETTINGS_FOLDER ] then diff --git a/seafile-ignore-tree.bat b/seafile-ignore-tree.bat index bc83811..78b163a 100644 --- a/seafile-ignore-tree.bat +++ b/seafile-ignore-tree.bat @@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear @ if not "" == "%1" ( set FONPATH=%1 ) else ( - echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] +echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]] if exist "%FONPATH1%" ( set FONPATH=%FONPATH1% ) else if exist "%FONPATH2%" ( @@ -20,43 +20,43 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear ) else ( echo ××× none of the testing path is valid. echo; - echo === Enter or leave for default to '.' + echo === Enter [start path] or [leave blank] for default to [[%CD%]] set /p FONPATH=">>> " echo; if "" == "%FONPATH%" ( - set FONPATH=. + set FONPATH=%CD% ) ) ) if not exist "%FONPATH%" ( - echo ××× [%FONPATH%] not exist! Exit now. *** + echo ××× [[%FONPATH%]] not exist! Exit now. *** @ GOTO END ) else ( - echo √√√ FONPATH = %FONPATH% + echo √√√ FONPATH = [[%FONPATH%]] ) -echo === Enter [path to seafile-ignore.txt] or leave [blank] for default to '.' +echo === Enter [path to seafile-ignore.txt] or leave [blank] for default to [[%CD%]] set /p SFIGNOREPATH=">>> " echo; if "" == "%SFIGNOREPATH%" ( - set SFIGNOREPATH=. + set SFIGNOREPATH=%CD% ) if not exist "%SFIGNOREPATH%" ( - echo ××× [%SFIGNOREPATH%] not exist! Exit now. *** + echo ××× [[%SFIGNOREPATH%]] not exist! Exit now. *** @ GOTO END ) else ( - echo √√√ SFIGNOREPATH = %SFIGNOREPATH% + echo √√√ SFIGNOREPATH = [[%SFIGNOREPATH%]] ) pushd %FONPATH% -echo *** Starting from [%CD%] *** +echo *** Starting from [[%CD%]] *** echo; for /d /r %%r in (*) do ( @REM @ if not "%%r" == ".vscode" ( echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || ( if exist "%%r\.git" ( - echo ---- updating seafile-ignore.txt in [%%r] ---- + echo ---- updating seafile-ignore.txt in [[%%r]] ---- copy %SFIGNOREPATH%\seafile-ignore.txt %%r\ echo; ) diff --git a/seafile-ignore-tree.sh b/seafile-ignore-tree.sh index 13a0d36..7993cd6 100755 --- a/seafile-ignore-tree.sh +++ b/seafile-ignore-tree.sh @@ -5,25 +5,25 @@ then FONPATH=$1 else echo "" - echo "=== Enter or leave for default to '.'" + echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]" read -p ">>> " FONPATH echo "" if [ ! "$FONPATH" ] then - FONPATH=. + FONPATH=`pwd` fi fi if [ ! -d "$FONPATH" ] then - echo "××× <$FONPATH> not exist! Exit now. ***" + echo "××× [[$FONPATH]] not exist! Exit now. ***" exit else - echo "√√√ FONPATH = $FONPATH" + echo "√√√ FONPATH = [[$FONPATH]]" fi cd $FONPATH -echo "*** Starting from [`pwd`] ***" +echo "*** Starting from [[`pwd`]] ***" echo "" echo "=== Enter [path-to-seafile-ignore.txt]" @@ -31,7 +31,7 @@ read -p ">>> " SFIGNOREPATH echo "" if [ ! -f "$SFIGNOREPATH/seafile-ignore.txt" ] then - echo "××× Not existed [$SFIGNOREPATH/seafile-ignore.txt]. Exit now..." + echo "××× Not found [[$SFIGNOREPATH/seafile-ignore.txt]]. Exit now..." exit fi @@ -39,7 +39,7 @@ find . -mindepth 1 -maxdepth 3 -type d -name '[^.]*' | grep -E -v 'node_modules do if [ -d "$repo/.git" ] then - echo "---- updating seafile-ignore.txt in [$repo] ----" + echo "---- updating seafile-ignore.txt in [[$repo]] ----" cp $SFIGNOREPATH/seafile-ignore.txt $repo/ echo "" fi