diff --git a/debian-add-user.sh b/debian-add-user.sh index 0668aa9..9632ad9 100755 --- a/debian-add-user.sh +++ b/debian-add-user.sh @@ -35,37 +35,37 @@ else fi echo -testpath0=/faronear/sysconfig -testpath1=/faronear/fon/sysconfig -testpath2=~/faronear/fon/sysconfig -testpath3=~/faronear/fon.git/sysconfig -testpath4=~/faronear.git/fon.git/sysconfig +SCRIPTHOME0=/faronear/sysconfig +SCRIPTHOME1=/faronear/fon/sysconfig +SCRIPTHOME2=~/faronear/fon/sysconfig +SCRIPTHOME3=~/faronear/fon.git/sysconfig +SCRIPTHOME4=~/faronear.git/fon.git/sysconfig -if [ -d $testpath0 ] +if [ -d $SCRIPTHOME0 ] then - SourcePath=$0 -elif [ -d $testpath1 ] + SCRIPTHOME=$0 +elif [ -d $SCRIPTHOME1 ] then - SourcePath=$testpath1 -elif [ -d $testpath2 ] + SCRIPTHOME=$SCRIPTHOME1 +elif [ -d $SCRIPTHOME2 ] then - SourcePath=$testpath2 -elif [ -d $testpath3 ] + SCRIPTHOME=$SCRIPTHOME2 +elif [ -d $SCRIPTHOME3 ] then - SourcePath=$testpath3 -elif [ -d $testpath4 ] + SCRIPTHOME=$SCRIPTHOME3 +elif [ -d $SCRIPTHOME4 ] then - SourcePath=$testpath4 -elif [ -d $testpath5 ] + SCRIPTHOME=$SCRIPTHOME4 +elif [ -d $SCRIPTHOME5 ] then - SourcePath=$testpath5 + SCRIPTHOME=$SCRIPTHOME5 else - echo "=== Enter [nixhome path] or leave [blank] to exit" - read -p ">>> " SourcePath + echo "=== Enter [script path] or leave [blank] to exit" + read -p ">>> " SCRIPTHOME echo "" - if [ ! -d "$SourcePath" ] + if [ ! -d "$SCRIPTHOME" ] then - echo "*** nixhome path [$SourcePath] not available! Exit now. ***" + echo "*** nixhome path [$SCRIPTHOME] not available! Exit now. ***" exit fi fi @@ -74,7 +74,7 @@ echo "=== Configure $NewUser's home with standard scripts? for yes, >> " ConfigHome if [ "$ConfigHome" == 'y' ] then - source $SourcePath/home-config.sh $SourcePath/nixhome $NewUser + source $SCRIPTHOME/home-config.sh $SCRIPTHOME/nixhome $NewUser else echo "--- Nothing configured." fi diff --git a/git-ignore-all.bat b/git-ignore-all.bat new file mode 100644 index 0000000..fd8679f --- /dev/null +++ b/git-ignore-all.bat @@ -0,0 +1,82 @@ +@echo off + +@REM 首先清除可能残留的变量 +set FONPATH= + +set CHOICE1=D:\faronear +set CHOICE2=C:\faronear +set CHOICE3=%HOMEDRIVE%%HOMEPATH%\faronear + +@ if not "" == "%1" ( + set FONPATH=%1 +) else ( + echo *** Testing Path [%CHOICE1%] [%CHOICE2] [%CHOICE3] + if exist "%CHOICE1" ( + set FONPATH=%CHOICE1% + ) else (if exist "%CHOICE2%" ( + set FONPATH=%CHOICE2% + ) else (if exist %CHOICE3% ( + set FONPATH=%CHOICE3% + ) else ( + echo === Enter [target path] or leave [blank] for default to '.' + set /p FONPATH=">>> " + echo; + if "" == "%FONPATH%" ( + set FONPATH=. + ) + ))) +) + +if not exist "%FONPATH%" ( + echo *** [%FONPATH%] not exist! Exit now. *** + @ GOTO END +) + +NIXHOME1=%FONPATH%\fon\sysconfig\nixhome +NIXHOME2=%FONPATH%\fon.git\sysconfig\nixhome +NIXHOME3=%FONPATH%\fon\sysconfig.git\nixhome +NIXHOME4=%FONPATH%\fon.git\sysconfig.git\nixhome +NIXHOME5=`pwd`/nixhome + +if exist "%NIXHOME1" ( + set NIXHOME=%NIXHOME1% +) else (if exist "%NIXHOME2" ( + set NIXHOME=%NIXHOME2% +) else (if exist "%NIXHOME3" ( + set NIXHOME=%NIXHOME3% +) else (if exist "%NIXHOME4" ( + set NIXHOME=%NIXHOME4% +) else (if exist "%NIXHOME5" ( + set NIXHOME=%NIXHOME5% +) else ( + echo === Enter [nixhome path] or leave [blank] for default to '.' + set /p NIXHOME=">>> " + echo; + if "" == "%FONPATH%" ( + set NIXHOME=. + ) +))))) + +pushd %FONPATH% +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" ( + pushd "%%r" + echo ---- updating .gitignore in [%%r] ---- + copy %NIXHOME%\.gitignore %%r\ + echo; + popd + ) + ) +) + + +popd + +:END + +pause diff --git a/git-pull-all.sh b/git-pull-all.sh index 6df6df0..1598425 100755 --- a/git-pull-all.sh +++ b/git-pull-all.sh @@ -1,25 +1,25 @@ #!/bin/bash -testpath1=/faronear -testpath2=~/faronear.git -testpath3=~/faronear -testpath4=/mnt/d/faronear +FONPATH1=/faronear +FONPATH2=~/faronear.git +FONPATH3=~/faronear +FONPATH4=/mnt/d/faronear if [ "$1" ] then FONPATH=$1 -elif [ -d $testpath1 ] +elif [ -d $FONPATH1 ] then - FONPATH=$testpath1 -elif [ -d $testpath2 ] + FONPATH=$FONPATH1 +elif [ -d $FONPATH2 ] then - FONPATH=$testpath2 -elif [ -d $testpath3 ] + FONPATH=$FONPATH2 +elif [ -d $FONPATH3 ] then - FONPATH=$testpath3 -elif [ -d $testpath4 ] + FONPATH=$FONPATH3 +elif [ -d $FONPATH4 ] then - FONPATH=$testpath4 + FONPATH=$FONPATH4 else echo "=== Enter [target path] or leave [blank] for default to '.'" read -p ">>> " FONPATH diff --git a/git-pull-recursive.sh b/git-pull-recursive.sh index b60630d..378886d 100755 --- a/git-pull-recursive.sh +++ b/git-pull-recursive.sh @@ -1,25 +1,25 @@ #!/bin/bash -testpath1=/faronear -testpath2=~/faronear.git -testpath3=~/faronear -testpath4=/mnt/d/faronear +FONPATH1=/faronear +FONPATH2=~/faronear.git +FONPATH3=~/faronear +FONPATH4=/mnt/d/faronear if [ "$1" ] then FONPATH=$1 -elif [ -d $testpath1 ] +elif [ -d $FONPATH1 ] then - FONPATH=$testpath1 -elif [ -d $testpath2 ] + FONPATH=$FONPATH1 +elif [ -d $FONPATH2 ] then - FONPATH=$testpath2 -elif [ -d $testpath3 ] + FONPATH=$FONPATH2 +elif [ -d $FONPATH3 ] then - FONPATH=$testpath3 -elif [ -d $testpath4 ] + FONPATH=$FONPATH3 +elif [ -d $FONPATH4 ] then - FONPATH=$testpath4 + FONPATH=$FONPATH4 else echo "=== Enter [target path] or leave [blank] for default to '.'" read -p ">>> " FONPATH diff --git a/git-push-all.sh b/git-push-all.sh index aec05ad..8029434 100755 --- a/git-push-all.sh +++ b/git-push-all.sh @@ -1,25 +1,25 @@ #!/bin/bash -testpath1=/faronear -testpath2=~/faronear.git -testpath3=~/faronear -testpath4=/mnt/d/faronear +FONPATH1=/faronear +FONPATH2=~/faronear.git +FONPATH3=~/faronear +FONPATH4=/mnt/d/faronear if [ "$1" ] then FONPATH=$1 -elif [ -d $testpath1 ] +elif [ -d $FONPATH1 ] then - FONPATH=$testpath1 -elif [ -d $testpath2 ] + FONPATH=$FONPATH1 +elif [ -d $FONPATH2 ] then - FONPATH=$testpath2 -elif [ -d $testpath3 ] + FONPATH=$FONPATH2 +elif [ -d $FONPATH3 ] then - FONPATH=$testpath3 -elif [ -d $testpath4 ] + FONPATH=$FONPATH3 +elif [ -d $FONPATH4 ] then - FONPATH=$testpath4 + FONPATH=$FONPATH4 else echo "=== Enter [target path] or leave [blank] for default to '.'" read -p ">>> " FONPATH diff --git a/git-push-recursive.sh b/git-push-recursive.sh index 6cd2de4..da6c494 100755 --- a/git-push-recursive.sh +++ b/git-push-recursive.sh @@ -1,25 +1,25 @@ #!/bin/bash -testpath1=/faronear -testpath2=~/faronear.git -testpath3=~/faronear -testpath4=/mnt/d/faronear +FONPATH1=/faronear +FONPATH2=~/faronear.git +FONPATH3=~/faronear +FONPATH4=/mnt/d/faronear if [ "$1" ] then FONPATH=$1 -elif [ -d $testpath1 ] +elif [ -d $FONPATH1 ] then - FONPATH=$testpath1 -elif [ -d $testpath2 ] + FONPATH=$FONPATH1 +elif [ -d $FONPATH2 ] then - FONPATH=$testpath2 -elif [ -d $testpath3 ] + FONPATH=$FONPATH2 +elif [ -d $FONPATH3 ] then - FONPATH=$testpath3 -elif [ -d $testpath4 ] + FONPATH=$FONPATH3 +elif [ -d $FONPATH4 ] then - FONPATH=$testpath4 + FONPATH=$FONPATH4 else echo "=== Enter [target path] or leave [blank] for default to '.'" diff --git a/git-rename-branch.sh b/git-rename-branch.sh index 9454592..7a2d86e 100755 --- a/git-rename-branch.sh +++ b/git-rename-branch.sh @@ -1,25 +1,25 @@ #!/bin/bash -testpath1=/faronear -testpath2=~/faronear.git -testpath3=~/faronear -testpath4=/mnt/d/faronear +FONPATH1=/faronear +FONPATH2=~/faronear.git +FONPATH3=~/faronear +FONPATH4=/mnt/d/faronear if [ "$1" ] then FONPATH=$1 -elif [ -d $testpath1 ] +elif [ -d $FONPATH1 ] then - FONPATH=$testpath1 -elif [ -d $testpath2 ] + FONPATH=$FONPATH1 +elif [ -d $FONPATH2 ] then - FONPATH=$testpath2 -elif [ -d $testpath3 ] + FONPATH=$FONPATH2 +elif [ -d $FONPATH3 ] then - FONPATH=$testpath3 -elif [ -d $testpath4 ] + FONPATH=$FONPATH3 +elif [ -d $FONPATH4 ] then - FONPATH=$testpath4 + FONPATH=$FONPATH4 else echo "=== Enter [target path] or leave [blank] for default to '.'" diff --git a/home-config.sh b/home-config.sh index 6343481..e3d105b 100755 --- a/home-config.sh +++ b/home-config.sh @@ -1,40 +1,40 @@ #!/bin/bash -testpath0=/faronear/sysconfig/nixhome -testpath1=/faronear/fon/sysconfig/nixhome -testpath2=~/faronear/fon/sysconfig/nixhome -testpath3=~/faronear/fon.git/sysconfig/nixhome -testpath4=~/faronear.git/fon.git/sysconfig/nixhome -testpath5=`pwd`/nixhome +NIXHOME0=/faronear/sysconfig/nixhome +NIXHOME1=/faronear/fon/sysconfig/nixhome +NIXHOME2=~/faronear/fon/sysconfig/nixhome +NIXHOME3=~/faronear/fon.git/sysconfig/nixhome +NIXHOME4=~/faronear.git/fon.git/sysconfig/nixhome +NIXHOME5=`pwd`/nixhome if [ "$1" ] then - SourcePath=$1 -elif [ -d $testpath0 ] + NIXHOME=$1 +elif [ -d $NIXHOME0 ] then - SourcePath=$testpath0 -elif [ -d $testpath1 ] + NIXHOME=$NIXHOME0 +elif [ -d $NIXHOME1 ] then - SourcePath=$testpath1 -elif [ -d $testpath2 ] + NIXHOME=$NIXHOME1 +elif [ -d $NIXHOME2 ] then - SourcePath=$testpath2 -elif [ -d $testpath3 ] + NIXHOME=$NIXHOME2 +elif [ -d $NIXHOME3 ] then - SourcePath=$testpath3 -elif [ -d $testpath4 ] + NIXHOME=$NIXHOME3 +elif [ -d $NIXHOME4 ] then - SourcePath=$testpath4 -elif [ -d $testpath5 ] + NIXHOME=$NIXHOME4 +elif [ -d $NIXHOME5 ] then - SourcePath=$testpath5 + NIXHOME=$NIXHOME5 else echo "=== Enter [nixhome path] or leave [blank] to exit" - read -p ">>> " SourcePath + read -p ">>> " NIXHOME echo "" - if [ ! -d "$SourcePath" ] + if [ ! -d "$NIXHOME" ] then - echo "*** nixhome path [$SourcePath] not available! Exit now. ***" + echo "*** nixhome path [$NIXHOME] not available! Exit now. ***" exit fi fi @@ -71,8 +71,8 @@ then then mv $homescript $homescript.backup-$(date +%Y%m%dT%H%M%S) fi - echo "--- Linking $SourcePath/$homescript to $HomePath/$homescript ..." - ln -s $SourcePath/$homescript ./ + echo "--- Linking $NIXHOME/$homescript to $HomePath/$homescript ..." + ln -s $NIXHOME/$homescript ./ done elif [ "$CopyOrLinkScripts" == 'c' ] then @@ -82,8 +82,8 @@ then then mv $homescript $homescript.backup-$(date +%Y%m%dT%H%M%S) fi - echo "--- Copying $SourcePath/$homescript to $HomePath/$homescript ..." - cp -r $SourcePath/$homescript ./ + echo "--- Copying $NIXHOME/$homescript to $HomePath/$homescript ..." + cp -r $NIXHOME/$homescript ./ done else echo '--- Home scripts not changed.' @@ -111,13 +111,13 @@ then if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ] then - echo "--- Linking $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..." - ln -s $SourcePath/.ssh/authorized_keys $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 $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..." - cat $SourcePath/.ssh/authorized_keys >> $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 echo diff --git a/home-import.sh b/home-import.sh new file mode 100644 index 0000000..a8358f4 --- /dev/null +++ b/home-import.sh @@ -0,0 +1,2 @@ +curl -sSL https://git.faronear.org/fon/sysconfig/raw/branch/main/nixhome/.bashrc > ~/.bashrc +curl -sSL https://git.faronear.org/fon/sysconfig/raw/branch/main/nixhome/.emacs > ~/.emacs \ No newline at end of file diff --git a/import-bashrc.sh b/import-bashrc.sh deleted file mode 100755 index 0886dc8..0000000 --- a/import-bashrc.sh +++ /dev/null @@ -1 +0,0 @@ -curl -sSL https://git.faronear.org/fon/sysconfig/raw/branch/main/nixhome/.bashrc > ~/.bashrc \ No newline at end of file diff --git a/npm-boot-all.sh b/npm-boot-all.sh index bbebabe..a8c604f 100755 --- a/npm-boot-all.sh +++ b/npm-boot-all.sh @@ -1,25 +1,25 @@ #!/bin/bash -testpath1=/faronear -testpath2=~/faronear.git -testpath3=~/faronear -testpath4=/mnt/d/faronear +FONPATH1=/faronear +FONPATH2=~/faronear.git +FONPATH3=~/faronear +FONPATH4=/mnt/d/faronear if [ "$1" ] then FONPATH=$1 -elif [ -d $testpath1 ] +elif [ -d $FONPATH1 ] then - FONPATH=$testpath1 -elif [ -d $testpath2 ] + FONPATH=$FONPATH1 +elif [ -d $FONPATH2 ] then - FONPATH=$testpath2 -elif [ -d $testpath3 ] + FONPATH=$FONPATH2 +elif [ -d $FONPATH3 ] then - FONPATH=$testpath3 -elif [ -d $testpath4 ] + FONPATH=$FONPATH3 +elif [ -d $FONPATH4 ] then - FONPATH=$testpath4 + FONPATH=$FONPATH4 else echo "=== Enter [target path] or leave [blank] for default to '.'" read -p ">>> " FONPATH diff --git a/npm-boot-recursive.sh b/npm-boot-recursive.sh index 869ca6c..8d545fb 100755 --- a/npm-boot-recursive.sh +++ b/npm-boot-recursive.sh @@ -1,25 +1,25 @@ #!/bin/bash -testpath1=/faronear -testpath2=~/faronear.git -testpath3=~/faronear -testpath4=/mnt/d/faronear +FONPATH1=/faronear +FONPATH2=~/faronear.git +FONPATH3=~/faronear +FONPATH4=/mnt/d/faronear if [ "$1" ] then FONPATH=$1 -elif [ -d $testpath1 ] +elif [ -d $FONPATH1 ] then - FONPATH=$testpath1 -elif [ -d $testpath2 ] + FONPATH=$FONPATH1 +elif [ -d $FONPATH2 ] then - FONPATH=$testpath2 -elif [ -d $testpath3 ] + FONPATH=$FONPATH2 +elif [ -d $FONPATH3 ] then - FONPATH=$testpath3 -elif [ -d $testpath4 ] + FONPATH=$FONPATH3 +elif [ -d $FONPATH4 ] then - FONPATH=$testpath4 + FONPATH=$FONPATH4 else echo "=== Enter [target path] or leave [blank] for default to '.'" read -p ">>> " FONPATH diff --git a/seafile-ignore-all.bat b/seafile-ignore-all.bat new file mode 100644 index 0000000..e1fdd93 --- /dev/null +++ b/seafile-ignore-all.bat @@ -0,0 +1,64 @@ +@echo off + +@REM 首先清除可能残留的变量 +set FONPATH= + +set CHOICE1=D:\faronear +set CHOICE2=C:\faronear +set CHOICE3=%HOMEDRIVE%%HOMEPATH%\faronear + +@ if not "" == "%1" ( + set FONPATH=%1 +) else ( + echo *** Testing Path [%CHOICE1%] [%CHOICE2] [%CHOICE3] + if exist "%CHOICE1" ( + set FONPATH=%CHOICE1% + ) else (if exist "%CHOICE2%" ( + set FONPATH=%CHOICE2% + ) else (if exist %CHOICE3% ( + set FONPATH=%CHOICE3% + ) else ( + echo === Enter [target path] or leave [blank] for default to '.' + set /p FONPATH=">>> " + echo; + if "" == "%FONPATH%" ( + set FONPATH=. + ) + ))) +) + +if not exist "%FONPATH%" ( + echo *** [%FONPATH%] not exist! Exit now. *** + @ GOTO END +) + +pushd %FONPATH% +echo *** Starting from [%CD%] *** +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; + pushd %%o + for /d %%g in (*) do ( + if exist "%%g\.git" ( + pushd %%g + echo ---- updating seafile-ignore.text in [%FONPATH%\%%o\%%g\] ---- + copy seafile-ignore.txt %FONPATH%\%%o\%%g\ + echo; + popd + ) + ) + popd + ) +) + +popd + +:END + +pause +