standardize: read user input with [key] instead of <key>, [long input] instead of <INPUT>; echo path with [[path]]

This commit is contained in:
陆柯 2023-10-10 10:23:51 +08:00
parent c56fb5202f
commit 5253cac12b
26 changed files with 153 additions and 153 deletions

View File

@ -9,12 +9,12 @@ echo
while [ ! "$ISSUEMODE" ] while [ ! "$ISSUEMODE" ]
do do
echo "=== Issue mode:" echo "=== Issue mode:"
echo " <s> for standalone" echo " [s] for standalone"
echo " <w> for webroot" echo " [w] for webroot"
echo " <n> for nginx" echo " [n] for nginx"
echo " <a> for apache" echo " [a] for apache"
echo " <c> for challenge-alias" echo " [c] for challenge-alias"
echo " <d> for dnsapi" echo " [d] for dnsapi"
read -p ">>> " ISSUEMODE read -p ">>> " ISSUEMODE
if [ "$ISSUEMODE" == 's' ] if [ "$ISSUEMODE" == 's' ]
then then
@ -45,7 +45,7 @@ if [ "$ISSUEMODE" == 'd' ]
then then
while [ ! "$DNSAPI" ] while [ ! "$DNSAPI" ]
do do
echo "=== DNS API provider, <cf> for CloudFlare, <dp> for DNSPod/腾讯云, <ali> for Aliyun/阿里云:" echo "=== DNS API provider, [cf] for CloudFlare, [dp] for DNSPod/腾讯云, [ali] for Aliyun/阿里云:"
read -p ">>> " DNSAPI_PROVIDER read -p ">>> " DNSAPI_PROVIDER
if [ "$DNSAPI_PROVIDER" == 'cf' ] if [ "$DNSAPI_PROVIDER" == 'cf' ]
then then
@ -76,7 +76,7 @@ echo "***"
~/.acme.sh/acme.sh --issue -d $TARGET_HOSTNAME $ISSUEPARM $DNSAPI ~/.acme.sh/acme.sh --issue -d $TARGET_HOSTNAME $ISSUEPARM $DNSAPI
echo echo
echo "=== Install certificates? <n> for no, <anything else> to install: " echo "=== Install certificates? [n] for no, [anything else] to install: "
read -p ">>> " INSTALL_CERT read -p ">>> " INSTALL_CERT
if [ "$INSTALL_CERT" != 'n' ] if [ "$INSTALL_CERT" != 'n' ]
then then
@ -93,7 +93,7 @@ then
read -p ">>> " FULLCHAIN_FILE_PATH read -p ">>> " FULLCHAIN_FILE_PATH
done done
echo echo
echo "=== Set reload command, <leave blank> for default to 'service nginx force-reload'" echo "=== Set reload command, [leave blank] for default to 'service nginx force-reload'"
read -p ">>> " RELOADCMD read -p ">>> " RELOADCMD
if [ ! "$RELOADCMD" ] if [ ! "$RELOADCMD" ]
then then

View File

@ -22,7 +22,7 @@ sed -i "s|/home/$NewUser:/bin/sh$|/home/$NewUser:/bin/bash|g" /etc/passwd
# Debian 9 default to empty # Debian 9 default to empty
sed -i "s|/home/$NewUser:$|/home/$NewUser:/bin/bash|g" /etc/passwd sed -i "s|/home/$NewUser:$|/home/$NewUser:/bin/bash|g" /etc/passwd
echo "=== Allow the new user [$NewUser] to sudo without password? <y> for yes, <anything else> for no" echo "=== Allow the new user [[$NewUser]] to sudo without password? [y] for yes, [anything else] for no"
read -p ">>> " AllowSudo read -p ">>> " AllowSudo
if [ "$AllowSudo" == "y" ] if [ "$AllowSudo" == "y" ]
then then

View File

@ -34,7 +34,7 @@ echo "=== Configure root home"
source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome root source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome root
echo echo
echo "=== Change root password? <y> for yes, <anything else> for omit:" echo "=== Change root password? [y] for yes, [anything else] for omit:"
read -p ">>> " ChangeRootPassword read -p ">>> " ChangeRootPassword
if [ "$ChangeRootPassword" == 'y' ] if [ "$ChangeRootPassword" == 'y' ]
then then
@ -66,7 +66,7 @@ then
echo echo
fi fi
echo "=== Set <hostname> or <leave blank> for no change" echo "=== Set [new hostname] or [leave blank] for no change"
read -p ">>> " NewHostname read -p ">>> " NewHostname
if [ $NewHostname ] if [ $NewHostname ]
then 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 'Autostart is set to /faronear/autostart.sh. Run "systemctl start/stop/status rc-local" to manage it.'
echo echo
echo "=== Configure locales: <y> for yes, <anything else> for no change:" echo "=== Configure locales: [y] for yes, [anything else] for no change:"
read -p ">>> " ConfigLocales read -p ">>> " ConfigLocales
if [ "$ConfigLocales" == 'y' ] if [ "$ConfigLocales" == 'y' ]
then then
@ -101,7 +101,7 @@ then
fi fi
echo echo
echo "=== Add a new user [$NewUser]? <y> for yes, <anything else> for no change:" echo "=== Add a new user [[$NewUser]]? [y] for yes, [anything else] for no change:"
read -p ">>> " AddNewUser read -p ">>> " AddNewUser
if [ "$AddNewUser" == 'y' ] if [ "$AddNewUser" == 'y' ]
then then
@ -109,13 +109,13 @@ then
source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome $NewUser source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome $NewUser
echo echo
echo "=== Enable xfce autologin [/etc/lightdm/lightdm.conf]: <y> for autologin as [$NewUser] or <anything else> 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 read -p ">>> " XfceAutologin
if [ "$XfceAutologin" == "y" ] if [ "$XfceAutologin" == "y" ]
then then
sed -i "s/^.*autologin-user=.*$/autologin-user=$NewUser/g" /etc/lightdm/lightdm.conf 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 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 else
echo '--- Nothing changed.' echo '--- Nothing changed.'
fi fi

View File

@ -3,7 +3,7 @@ if [ "$1" ]
then then
DOCKERUSER=$1 DOCKERUSER=$1
else else
echo "Enter the <user name> or <leave blank> for default to '`whoami`'" echo "Enter the [user name] or [leave blank] for default to '`whoami`'"
read -p ">>> " DOCKERUSER read -p ">>> " DOCKERUSER
if [ ! "$DOCKERUSER" ] if [ ! "$DOCKERUSER" ]
then then

View File

@ -6,7 +6,7 @@
# 安装自带版本 apt install docker.io && apt install docker-compose # 安装自带版本 apt install docker.io && apt install docker-compose
# sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin # sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
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
@ -48,7 +48,7 @@ docker compose version
# sudo curl -L $COMPOSE_URL/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose # sudo curl -L $COMPOSE_URL/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
# sudo chmod +x /usr/local/bin/docker-compose # sudo chmod +x /usr/local/bin/docker-compose
echo "=== Enter <y> to 配置中国加速镜像源 /etc/docker/daemon.json, <anything else> for no mirror:" echo "=== Enter [y] to 配置中国加速镜像源 /etc/docker/daemon.json, [anything else] for no mirror:"
read -p ">>> " DOCKER_MIRROR read -p ">>> " DOCKER_MIRROR
if [ "$DOCKER_MIRROR" = 'y' ] if [ "$DOCKER_MIRROR" = 'y' ]
then then
@ -61,7 +61,7 @@ then
echo '] }' >> /etc/docker/daemon.json echo '] }' >> /etc/docker/daemon.json
fi 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" = 'y' ] if [ "$StartDockerDaemon" = 'y' ]
then then

View File

@ -6,7 +6,7 @@ if [ $1 ]
then then
VERSION=$1 VERSION=$1
else else
echo "=== Enter geth <VERSION> or <leave blank> for default $defaultVERSION" echo "=== Enter geth [version number] or [leave blank] for default $defaultVERSION"
read -p ">>> " VERSION read -p ">>> " VERSION
if [ ! "$VERSION" ] if [ ! "$VERSION" ]
then then

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" ( @ if not "" == "%1" (
set FONPATH=%1 set FONPATH=%1
) else ( ) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" ( if exist "%FONPATH1%" (
set FONPATH=%FONPATH1% set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" ( ) else if exist "%FONPATH2%" (
@ -20,44 +20,44 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
) else ( ) else (
echo ××× none of the testing path is valid. echo ××× none of the testing path is valid.
echo; echo;
echo === Enter <fonpath> or leave <blank> for default to '.' echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> " set /p FONPATH=">>> "
echo; echo;
if "" == "%FONPATH%" ( if "" == "%FONPATH%" (
set FONPATH=. set FONPATH=%CD%
) )
) )
) )
if not exist "%FONPATH%" ( if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. *** echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END @ GOTO END
) else ( ) else (
echo √√√ FONPATH = %FONPATH% 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%
) )
pushd %FONPATH% pushd %FONPATH%
echo *** Starting from [%CD%] *** echo *** Starting from [[%CD%]] ***
echo; 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 ( for /d /r %%r in (*) do (
@REM @ if not "%%r" == ".vscode" ( @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 || ( echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.gitignore" ( if exist "%%r\.gitignore" (
pushd "%%r" pushd "%%r"
echo ---- updating .gitignore in [%%r] ---- echo ---- updating .gitignore in [[%%r]] ----
copy %GITIGNOREPATH%\.gitignore %%r\ copy %GITIGNOREPATH%\.gitignore %%r\
echo; echo;
popd popd

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" ( @ if not "" == "%1" (
set FONPATH=%1 set FONPATH=%1
) else ( ) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" ( if exist "%FONPATH1%" (
set FONPATH=%FONPATH1% set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" ( ) else if exist "%FONPATH2%" (
@ -20,37 +20,37 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
) else ( ) else (
echo ××× none of the testing path is valid. echo ××× none of the testing path is valid.
echo; echo;
echo === Enter <fonpath> or leave <blank> for default to '.' echo === Enter [start path]> or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> " set /p FONPATH=">>> "
echo; echo;
if "" == "%FONPATH%" ( if "" == "%FONPATH%" (
set FONPATH=. set FONPATH=%CD%
) )
) )
) )
if not exist "%FONPATH%" ( if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. *** echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END @ GOTO END
) else ( ) else (
echo √√√ FONPATH = %FONPATH% echo √√√ FONPATH = [[%FONPATH%]]
) )
pushd %FONPATH% pushd %FONPATH%
echo *** Starting from [%CD%] *** echo *** Starting from [[%CD%]] ***
echo; echo;
@ if "%2" == "hier" ( @ 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 ) @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 ( for /d %%o in (*) do (
@ if not "%%o" == ".vscode" ( @ if not "%%o" == ".vscode" (
echo ======== entering [%FONPATH%\%%o] ======== echo ======== entering [[%FONPATH%\%%o]] ========
echo; echo;
pushd %%o pushd %%o
for /d %%g in (*) do ( for /d %%g in (*) do (
if exist "%%g\.git" ( if exist "%%g\.git" (
pushd %%g pushd %%g
echo ---- git pulling [%FONPATH%\%%o\%%g] ---- echo ---- git pulling [[%FONPATH%\%%o\%%g]] ----
git pull --all git pull --all
echo; echo;
popd 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 || ( echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.git" ( if exist "%%r\.git" (
pushd "%%r" pushd "%%r"
echo ---- git pulling [%%r] ---- echo ---- git pulling [[%%r]] ----
git pull --all git pull --all
echo; echo;
popd popd

View File

@ -5,25 +5,25 @@ then
FONPATH=$1 FONPATH=$1
else else
echo "" echo ""
echo "=== Enter <fonpath> or leave <blank> for default to '.'" echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH read -p ">>> " FONPATH
echo "" echo ""
if [ ! "$FONPATH" ] if [ ! "$FONPATH" ]
then then
FONPATH=. FONPATH=`pwd`
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
else else
echo "√√√ FONPATH = $FONPATH" echo "√√√ FONPATH = [[$FONPATH]]"
fi fi
pushd $FONPATH pushd $FONPATH
echo "*** Starting from [`pwd`] ***" echo "*** Starting from [[`pwd`]] ***"
echo "" echo ""
if [ "$2" == 'hier' ] if [ "$2" == 'hier' ]
@ -31,14 +31,14 @@ then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。 # for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名 ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do do
echo "======== entering [$FONPATH/$org] ========" echo "======== entering [[$FONPATH/$org]] ========"
echo "" echo ""
cd "$org"; cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格 for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
do do
if [ -d "$repo/.git" ] if [ -d "$repo/.git" ]
then then
echo "---- git pulling [`pwd`/$repo] ----" echo "---- git pulling [[`pwd`/$repo]] ----"
cd "$repo" cd "$repo"
git pull --all git pull --all
echo "" echo ""
@ -52,7 +52,7 @@ else
do do
if [ -d "$repo/.git" ] if [ -d "$repo/.git" ]
then then
echo "---- git pulling [$repo] ----" echo "---- git pulling [[$repo]] ----"
pushd "$repo" pushd "$repo"
git pull --all git pull --all
echo "" echo ""

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" ( @ if not "" == "%1" (
set FONPATH=%1 set FONPATH=%1
) else ( ) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" ( if exist "%FONPATH1%" (
set FONPATH=%FONPATH1% set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" ( ) else if exist "%FONPATH2%" (
@ -20,24 +20,24 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
) else ( ) else (
echo ××× none of the testing path is valid. echo ××× none of the testing path is valid.
echo; echo;
echo === Enter <fonpath> or leave <blank> for default to '.' echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> " set /p FONPATH=">>> "
echo; echo;
if "" == "%FONPATH%" ( if "" == "%FONPATH%" (
set FONPATH=. set FONPATH=%CD%
) )
) )
) )
if not exist "%FONPATH%" ( if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. *** echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END @ GOTO END
) else ( ) else (
echo √√√ FONPATH = %FONPATH% echo √√√ FONPATH = [[%FONPATH%]]
) )
pushd %FONPATH% pushd %FONPATH%
echo *** Starting from [%CD%] *** echo *** Starting from [[%CD%]] ***
echo; echo;
echo === Enter [commit message] or [leave blank] for default to 'updated' 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 ) @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 ( for /d %%o in (*) do (
@ if not "%%o" == ".vscode" ( @ if not "%%o" == ".vscode" (
echo ======== entering [%FONPATH%\%%o] ======== echo ======== entering [[%FONPATH%\%%o]] ========
echo; echo;
pushd "%%o" pushd "%%o"
for /d %%g in (*) do ( for /d %%g in (*) do (
if exist %%g\.git ( if exist %%g\.git (
pushd "%%g" 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 git add . && git commit -m "%COMMIT_MESSAGE%" && git push
echo; echo;
popd 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 || ( echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.git" ( if exist "%%r\.git" (
pushd "%%r" pushd "%%r"
echo ---- git commit and push [%%r] ---- echo ---- git commit and push [[%%r]] ----
git add . && git commit -m "%COMMIT_MESSAGE%" && git push git add . && git commit -m "%COMMIT_MESSAGE%" && git push
echo; echo;
popd popd

View File

@ -5,28 +5,28 @@ then
FONPATH=$1 FONPATH=$1
else else
echo "" echo ""
echo "=== Enter <fonpath> or leave <blank> for default to '.'" echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH read -p ">>> " FONPATH
echo "" echo ""
if [ ! "$FONPATH" ] if [ ! "$FONPATH" ]
then then
FONPATH=. FONPATH=`pwd`
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
else else
echo "√√√ FONPATH = $FONPATH" echo "√√√ FONPATH = [[$FONPATH]]"
fi fi
pushd $FONPATH pushd $FONPATH
echo "*** Starting from [`pwd`] ***" echo "*** Starting from [[`pwd`]] ***"
echo "" echo ""
echo "=== Enter <commit message> or <leave blank> for default to 'updated'" echo "=== Enter [commit message] or [leave blank] for default to 'updated'"
read -p ">>> " COMMIT_MESSAGE read -p ">>> " COMMIT_MESSAGE
if [ ! "$COMMIT_MESSAGE" ] if [ ! "$COMMIT_MESSAGE" ]
then then
@ -34,7 +34,7 @@ then
fi fi
echo "" echo ""
echo "=== Enter <h> for hierarchical, <r> for recursive, <anything else> for listing" echo "=== Enter [h] for hierarchical, [r] for recursive, [anything else] for listing"
read -p ">>> " ACTION_TYPE read -p ">>> " ACTION_TYPE
if [ "$ACTION_TYPE" == 'h' ] if [ "$ACTION_TYPE" == 'h' ]
@ -42,14 +42,14 @@ then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。 # for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名 ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do do
echo "======== entering [$FONPATH/$org] ========" echo "======== entering [[$FONPATH/$org]] ========"
echo "" echo ""
cd "$org"; cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格 for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
do do
if [ -d "$repo/.git" ] if [ -d "$repo/.git" ]
then then
echo "---- git commit & push [`pwd`/$repo] ----" echo "---- git commit & push [[`pwd`/$repo]] ----"
pushd "$repo" pushd "$repo"
git add . && git commit -m "$COMMIT_MESSAGE" && git push git add . && git commit -m "$COMMIT_MESSAGE" && git push
echo "" echo ""
@ -64,7 +64,7 @@ then
do do
if [ -d "$repo/.git" ] if [ -d "$repo/.git" ]
then then
echo "---- git commit & push [$repo] ----" echo "---- git commit & push [[$repo]] ----"
pushd "$repo" pushd "$repo"
git add . && git commit -m "$COMMIT_MESSAGE" && git push git add . && git commit -m "$COMMIT_MESSAGE" && git push
echo "" echo ""

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" ( @ if not "" == "%1" (
set FONPATH=%1 set FONPATH=%1
) else ( ) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" ( if exist "%FONPATH1%" (
set FONPATH=%FONPATH1% set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" ( ) else if exist "%FONPATH2%" (
@ -23,21 +23,21 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
) )
if not exist %FONPATH% ( if not exist %FONPATH% (
echo ××× [%FONPATH%] not exist! Exit now. *** echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END @ GOTO END
) else ( ) else (
echo √√√ FONPATH = %FONPATH% echo √√√ FONPATH = [[%FONPATH%]]
) )
pushd %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 ) @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 ( for /d %%o in (*) do (
@REM windows的链接文件会造成路径错误从而终止该循环从而导致下一轮乃至所有循环的工作目录错误。因此要过滤掉 .vscode 这个符号链接目录。 @REM windows的链接文件会造成路径错误从而终止该循环从而导致下一轮乃至所有循环的工作目录错误。因此要过滤掉 .vscode 这个符号链接目录。
if not %%o == .vscode ( if not %%o == .vscode (
echo entering [%FONPATH%\%%o] echo entering [[%FONPATH%\%%o]]
pushd %%o pushd %%o
for /d %%g in (*) do ( for /d %%g in (*) do (
if exist %%g\.git ( if exist %%g\.git (

View File

@ -5,31 +5,31 @@ then
FONPATH=$1 FONPATH=$1
else else
echo "" echo ""
echo "=== Enter <fonpath> or leave <blank> for default to '.'" echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH read -p ">>> " FONPATH
echo "" echo ""
if [ ! "$FONPATH" ] if [ ! "$FONPATH" ]
then then
FONPATH=. FONPATH=`pwd`
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
else else
echo "√√√ FONPATH = $FONPATH" echo "√√√ FONPATH = [[$FONPATH]]"
fi fi
pushd $FONPATH pushd $FONPATH
echo "*** Current path = [`pwd`] ***" echo "*** Starting from [[`pwd`]] ***"
echo "" echo ""
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。 # for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名 ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do do
echo "======== entering [$FONPATH/$org] ========" echo "======== entering [[$FONPATH/$org]] ========"
echo "" echo ""
cd "$org"; cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格 for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
@ -37,13 +37,13 @@ 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 branch master to main for [[`pwd`/$repo]] ----"
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

View File

@ -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 "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 "[20230305] noticed that gitea 1.18.5 default is `/usr/local/bin/gitea hook --config=/data/gitea/conf/app.ini`"
echo "Enter <old hook path> or <leave blank> for default '/faronear/git/gitea/gitea':" echo "Enter [old hook path] or [leave blank] for default '/faronear/git/gitea/gitea':"
read -p ">>> " OLDPATH read -p ">>> " OLDPATH
if [ ! "$OLDPATH"] if [ ! "$OLDPATH"]
then then
OLDPATH=/faronear/git/gitea/gitea OLDPATH=/faronear/git/gitea/gitea
fi fi
echo "Enter <new hook path> or <leave blank> for default '/usr/local/bin/gitea': " echo "Enter [new hook path] or [leave blank] for default '/usr/local/bin/gitea': "
read -p ">> " NEWPATH read -p ">> " NEWPATH
if [ ! "$NEWPATH" ] if [ ! "$NEWPATH" ]
then then

View File

@ -6,7 +6,7 @@ if [ $1 ]
then then
VERSION=$1 VERSION=$1
else else
echo "=== Enter kubo <VERSION> or <leave blank> for default $defaultVERSION" echo "=== Enter kubo [version number] or [leave blank] for default $defaultVERSION"
read -p ">>> " VERSION read -p ">>> " VERSION
if [ ! $VERSION ] if [ ! $VERSION ]
then then

View File

@ -23,7 +23,7 @@ else
echo "" echo ""
if [ ! -d "$NIXHOME" ] if [ ! -d "$NIXHOME" ]
then then
echo "××× nixhome path [$NIXHOME] not available! Exit now. ×××" echo "××× nixhome path [[$NIXHOME]] not available! Exit now. ×××"
exit exit
fi fi
fi fi
@ -50,7 +50,7 @@ then
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore" homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore"
echo echo
echo "=== Copy or link scripts? <l> to link, <c> to copy, <g> to git import, <anything else> to omit:" echo "=== Copy or link scripts? [l] to link, [c] to copy, [g] to git import, [anything else] to omit:"
read -p ">>> " CopyOrLinkScripts read -p ">>> " CopyOrLinkScripts
if [ "$CopyOrLinkScripts" == 'l' ] if [ "$CopyOrLinkScripts" == 'l' ]
then then
@ -60,7 +60,7 @@ then
then then
mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc) mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)
fi fi
echo "--- Linking $NIXHOME/$homescript to $HomePath/$homescript ..." echo "--- Linking [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..."
ln -s $NIXHOME/$homescript ./ ln -s $NIXHOME/$homescript ./
done done
elif [ "$CopyOrLinkScripts" == 'c' ] elif [ "$CopyOrLinkScripts" == 'c' ]
@ -71,7 +71,7 @@ then
then then
mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc) mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)
fi fi
echo "--- Copying $NIXHOME/$homescript to $HomePath/$homescript ..." echo "--- Copying [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..."
cp -r $NIXHOME/$homescript ./ cp -r $NIXHOME/$homescript ./
done done
elif [ "$CopyOrLinkScripts" == 'g' ] 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) mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-$(date -u +%Y%m%dT%H%M%Sutc)
fi fi
echo "=== Append or link or omit [$HomePath/.ssh/authorized_keys] to config ssh server? <a> for append, <l> for link, <anything else> 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 read -p ">>> " CopyOrLinkOrOmitAuthorizedKeys
if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ] if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ]
then 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 ln -s $NIXHOME/.ssh/authorized_keys $HomePath/.ssh/authorized_keys
sudo chmod 644 $HomePath/.ssh/authorized_keys # 确保其他用户能读取 nixhome/.ssh/authorized_keys sudo chmod 644 $HomePath/.ssh/authorized_keys # 确保其他用户能读取 nixhome/.ssh/authorized_keys
elif [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'a' ] elif [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'a' ]
then 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 cat $NIXHOME/.ssh/authorized_keys >> $HomePath/.ssh/authorized_keys
chmod 600 $HomePath/.ssh/authorized_keys chmod 600 $HomePath/.ssh/authorized_keys
fi fi
@ -129,5 +129,5 @@ then
popd popd
else else
echo "!!! Not existing $HomePath, please try again." echo "!!! Not found [[$HomePath]], please try again."
fi fi

View File

@ -8,7 +8,7 @@ if [ $1 ]
then then
VERSION=$1 VERSION=$1
else else
echo "=== Enter <nodejs version> or 'tools' or <leave blank> for default $defaultVERSION" echo "=== Enter [nodejs version] or [leave blank] for default $defaultVERSION, enter [tools] to install C++ build tools"
read -p ">>> " VERSION read -p ">>> " VERSION
if [ ! $VERSION ] if [ ! $VERSION ]
then then

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" ( @ if not "" == "%1" (
set FONPATH=%1 set FONPATH=%1
) else ( ) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" ( if exist "%FONPATH1%" (
set FONPATH=%FONPATH1% set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" ( ) else if exist "%FONPATH2%" (
@ -20,38 +20,38 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
) else ( ) else (
echo ××× none of the testing path is valid. echo ××× none of the testing path is valid.
echo; echo;
echo === Enter <fonpath> or leave <blank> for default to '.' echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> " set /p FONPATH=">>> "
echo; echo;
if "" == "%FONPATH%" ( if "" == "%FONPATH%" (
set FONPATH=. set FONPATH=%CD%
) )
) )
) )
if not exist "%FONPATH%" ( if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. *** echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END @ GOTO END
) else ( ) else (
echo √√√ FONPATH = %FONPATH% echo √√√ FONPATH = [[%FONPATH%]]
) )
pushd %FONPATH% pushd %FONPATH%
echo *** Starting from [%CD%] *** echo *** Starting from [[%CD%]] ***
echo; echo;
@ if "%2" == "hier" ( @ 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 ) @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 ( for /d %%o in (*) do (
@ if not "%%o" == ".vscode" ( @ if not "%%o" == ".vscode" (
echo ======== entering [%FONPATH%\%%o] ======== echo ======== entering [[%FONPATH%\%%o]] ========
echo; echo;
pushd %%o pushd %%o
for /d %%g in (*) do ( for /d %%g in (*) do (
@ if exist "%%g\package.json" ( @ if exist "%%g\package.json" (
findstr "\"boot\"" %%g\package.json >NUL && ( findstr "\"boot\"" %%g\package.json >NUL && (
pushd %%g pushd %%g
echo ---- npm booting [%FONPATH%\%%o\%%g] ---- echo ---- npm booting [[%FONPATH%\%%o\%%g]] ----
npm run boot npm run boot
echo; echo;
popd popd
@ -68,7 +68,7 @@ echo;
if exist "%%r\package.json" ( if exist "%%r\package.json" (
findstr "\"boot\"" "%%r\package.json" >NUL && ( findstr "\"boot\"" "%%r\package.json" >NUL && (
pushd %%r pushd %%r
echo ---- npm booting [%FONPATH%\%%r] ---- echo ---- npm booting [[%FONPATH%\%%r]] ----
npm run boot npm run boot
echo; echo;
popd popd

View File

@ -5,25 +5,25 @@ then
FONPATH=$1 FONPATH=$1
else else
echo "" echo ""
echo "=== Enter <fonpath> or leave <blank> for default to '.'" echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH read -p ">>> " FONPATH
echo "" echo ""
if [ ! "$FONPATH" ] if [ ! "$FONPATH" ]
then then
FONPATH=. FONPATH=`pwd`
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
else else
echo "√√√ FONPATH = $FONPATH" echo "√√√ FONPATH = [[$FONPATH]]"
fi fi
pushd $FONPATH pushd $FONPATH
echo "*** Starting from [`pwd`] ***" echo "*** Starting from [[`pwd`]] ***"
echo "" echo ""
if [ "$2" == 'hier' ] if [ "$2" == 'hier' ]
@ -31,17 +31,17 @@ then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。 # for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名 ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do do
echo "======== entering [$FONPATH/$org] ========" echo "======== entering [[$FONPATH/$org]] ========"
echo "" echo ""
cd "$org"; cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格 for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
do do
if ( [ -f "$repo/package.json" ] && grep -q '"boot"' "$repo/package.json" ) if ( [ -f "$repo/package.json" ] && grep -q '"boot"' "$repo/package.json" )
then then
echo "<<<< npm booting: [$org/$repo] <<<<" echo "<<<< npm booting: [[$org/$repo]] <<<<"
cd "$repo" cd "$repo"
npm run boot npm run boot
echo ">>>> npm booted: [$org/$repo] >>>>" echo ">>>> npm booted: [[$org/$repo]] >>>>"
echo "" echo ""
cd .. cd ..
fi fi
@ -54,12 +54,12 @@ else
if ( [ -f "$repo/package.json" ] && grep -q '"boot"' "$repo/package.json" ) if ( [ -f "$repo/package.json" ] && grep -q '"boot"' "$repo/package.json" )
then then
echo "" echo ""
echo "---- npm booting: [$repo] ----" echo "---- npm booting: [[$repo]] ----"
echo "" echo ""
pushd "$repo" pushd "$repo"
npm run boot npm run boot
echo "" echo ""
echo "---- npm booted: [$repo] ----" echo "---- npm booted: [[$repo]] ----"
echo "" echo ""
popd popd
fi fi

View File

@ -15,24 +15,24 @@ set FONPATH=
) else ( ) else (
echo ××× none of the testing path is valid. echo ××× none of the testing path is valid.
echo; echo;
echo === Enter <fonpath> or leave <blank> for default to '.' echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> " set /p FONPATH=">>> "
echo; echo;
if "" == "%FONPATH%" ( if "" == "%FONPATH%" (
set FONPATH=. set FONPATH=%CD%
) )
))) )))
) )
if not exist "%FONPATH%" ( if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. *** echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END @ GOTO END
) else ( ) else (
echo √√√ FONPATH = %FONPATH% echo √√√ FONPATH = [[%FONPATH%]]
) )
pushd %FONPATH% pushd %FONPATH%
echo *** Starting from [%CD%] *** echo *** Starting from [[%CD%]] ***
echo; echo;
for /d /r %%r in (*) do ( 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 || ( 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" ( if exist "%%r\node_modules" (
pushd "%%r" pushd "%%r"
echo ---- Deleting [%FONPATH%\%%r] ---- echo ---- Deleting [[%FONPATH%\%%r]] ----
rd /s /q node_modules rd /s /q node_modules
echo; echo;
popd popd

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
echo "=== rclone <i> to install, <s> to sync, <c> to copy, <w> to web gui" echo "=== rclone [i] to install, [s] to sync, [c] to copy, [w] to web gui"
read -p ">>> " ACTION_TYPE read -p ">>> " ACTION_TYPE
if [ "$ACTION_TYPE" = 'i' ] if [ "$ACTION_TYPE" = 'i' ]
then then
@ -23,7 +23,7 @@ then
echo "*****************************" 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 "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 "*****************************"
echo "Starting? <y> for yes, <anything else> for quit" echo "Starting? [y] for yes, [anything else] for quit"
read -p ">>> " YES_OR_NOT read -p ">>> " YES_OR_NOT
if [ "$YES_OR_NOT" = 'y' ] if [ "$YES_OR_NOT" = 'y' ]
then then

View File

@ -2,7 +2,7 @@ if [ $1 ]
then then
NewHostname=$1 NewHostname=$1
else else
echo "=== Set <hostname> or <leave blank> for no change" echo "=== Set [new hostname] or [leave blank] for no change"
read -p ">>> " NewHostname read -p ">>> " NewHostname
fi fi

View File

@ -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 "find \$FOLDER -mindepth \$MINDEPTH -maxdepth \$MAXDEPTH -type d_f_l -name \"\$PATTERN\" | while read item; do echo \"\$item\"; done"
echo "***************************************" echo "***************************************"
echo "To find in which path? Enter <path> or <leave blank> for the current path:" echo "To find in which path? Enter [start path] or [leave blank] for the current path:"
read -p ">>> " FIND_FOLDER read -p ">>> " FIND_FOLDER
if [ ! "$FIND_FOLDER" ] if [ ! "$FIND_FOLDER" ]
then then
@ -20,21 +20,21 @@ then
MAXDEPTH_CLAUSE="-mindepth $MAXDEPTH" MAXDEPTH_CLAUSE="-mindepth $MAXDEPTH"
fi fi
echo "To find file or directory? <f> for file, <d> for directory, <l> for link, <leave blank> 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 read -p ">>> " FIND_TYPE
if [ "$FIND_TYPE" ] if [ "$FIND_TYPE" ]
then then
FIND_TYPE_CLAUSE="-type $FIND_TYPE" FIND_TYPE_CLAUSE="-type $FIND_TYPE"
fi fi
echo "To match pattern: <pattern> (e.g. '._*', '.*.js') or or <leave blank> for all:" echo "To match pattern: [regex pattern] (e.g. '._*', '.*.js') or or [leave blank] for all:"
read -p ">>> " FIND_PATTERN read -p ">>> " FIND_PATTERN
if [ ! "$FIND_PATTERN" ] if [ ! "$FIND_PATTERN" ]
then then
FIND_PATTERN="*" FIND_PATTERN="*"
fi fi
echo "To do something on each: <command> or <leave blank> for 'echo':" echo "To do something on each: [command line] or [leave blank] for 'echo':"
read -p ">>> " FIND_ACTION read -p ">>> " FIND_ACTION
if [ ! "$FIND_ACTION" ] if [ ! "$FIND_ACTION" ]
then then

View File

@ -3,7 +3,7 @@ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/seafile-keyring.asc] https:/
sudo apt update sudo apt update
sudo apt install -y seafile-cli sudo apt install -y seafile-cli
echo "To initialze the client, create a settings folder <path> or <leave blank> 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 read -p ">>> " SETTINGS_FOLDER
if [ ! $SETTINGS_FOLDER ] if [ ! $SETTINGS_FOLDER ]
then then

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" ( @ if not "" == "%1" (
set FONPATH=%1 set FONPATH=%1
) else ( ) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%] echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" ( if exist "%FONPATH1%" (
set FONPATH=%FONPATH1% set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" ( ) else if exist "%FONPATH2%" (
@ -20,43 +20,43 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
) else ( ) else (
echo ××× none of the testing path is valid. echo ××× none of the testing path is valid.
echo; echo;
echo === Enter <fonpath> or leave <blank> for default to '.' echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> " set /p FONPATH=">>> "
echo; echo;
if "" == "%FONPATH%" ( if "" == "%FONPATH%" (
set FONPATH=. set FONPATH=%CD%
) )
) )
) )
if not exist "%FONPATH%" ( if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. *** echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END @ GOTO END
) else ( ) 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=">>> " set /p SFIGNOREPATH=">>> "
echo; echo;
if "" == "%SFIGNOREPATH%" ( if "" == "%SFIGNOREPATH%" (
set SFIGNOREPATH=. set SFIGNOREPATH=%CD%
) )
if not exist "%SFIGNOREPATH%" ( if not exist "%SFIGNOREPATH%" (
echo ××× [%SFIGNOREPATH%] not exist! Exit now. *** echo ××× [[%SFIGNOREPATH%]] not exist! Exit now. ***
@ GOTO END @ GOTO END
) else ( ) else (
echo √√√ SFIGNOREPATH = %SFIGNOREPATH% echo √√√ SFIGNOREPATH = [[%SFIGNOREPATH%]]
) )
pushd %FONPATH% pushd %FONPATH%
echo *** Starting from [%CD%] *** echo *** Starting from [[%CD%]] ***
echo; echo;
for /d /r %%r in (*) do ( for /d /r %%r in (*) do (
@REM @ if not "%%r" == ".vscode" ( @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 || ( echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.git" ( if exist "%%r\.git" (
echo ---- updating seafile-ignore.txt in [%%r] ---- echo ---- updating seafile-ignore.txt in [[%%r]] ----
copy %SFIGNOREPATH%\seafile-ignore.txt %%r\ copy %SFIGNOREPATH%\seafile-ignore.txt %%r\
echo; echo;
) )

View File

@ -5,25 +5,25 @@ then
FONPATH=$1 FONPATH=$1
else else
echo "" echo ""
echo "=== Enter <fonpath> or leave <blank> for default to '.'" echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH read -p ">>> " FONPATH
echo "" echo ""
if [ ! "$FONPATH" ] if [ ! "$FONPATH" ]
then then
FONPATH=. FONPATH=`pwd`
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
else else
echo "√√√ FONPATH = $FONPATH" echo "√√√ FONPATH = [[$FONPATH]]"
fi fi
cd $FONPATH cd $FONPATH
echo "*** Starting from [`pwd`] ***" echo "*** Starting from [[`pwd`]] ***"
echo "" echo ""
echo "=== Enter [path-to-seafile-ignore.txt]" echo "=== Enter [path-to-seafile-ignore.txt]"
@ -31,7 +31,7 @@ read -p ">>> " SFIGNOREPATH
echo "" echo ""
if [ ! -f "$SFIGNOREPATH/seafile-ignore.txt" ] if [ ! -f "$SFIGNOREPATH/seafile-ignore.txt" ]
then then
echo "××× Not existed [$SFIGNOREPATH/seafile-ignore.txt]. Exit now..." echo "××× Not found [[$SFIGNOREPATH/seafile-ignore.txt]]. Exit now..."
exit exit
fi fi
@ -39,7 +39,7 @@ find . -mindepth 1 -maxdepth 3 -type d -name '[^.]*' | grep -E -v 'node_modules
do do
if [ -d "$repo/.git" ] if [ -d "$repo/.git" ]
then then
echo "---- updating seafile-ignore.txt in [$repo] ----" echo "---- updating seafile-ignore.txt in [[$repo]] ----"
cp $SFIGNOREPATH/seafile-ignore.txt $repo/ cp $SFIGNOREPATH/seafile-ignore.txt $repo/
echo "" echo ""
fi fi