This commit is contained in:
陆柯 2023-01-12 14:50:52 +08:00
parent f0558fc5c3
commit 4a16113b2b
13 changed files with 284 additions and 137 deletions

View File

@ -35,37 +35,37 @@ else
fi fi
echo echo
testpath0=/faronear/sysconfig SCRIPTHOME0=/faronear/sysconfig
testpath1=/faronear/fon/sysconfig SCRIPTHOME1=/faronear/fon/sysconfig
testpath2=~/faronear/fon/sysconfig SCRIPTHOME2=~/faronear/fon/sysconfig
testpath3=~/faronear/fon.git/sysconfig SCRIPTHOME3=~/faronear/fon.git/sysconfig
testpath4=~/faronear.git/fon.git/sysconfig SCRIPTHOME4=~/faronear.git/fon.git/sysconfig
if [ -d $testpath0 ] if [ -d $SCRIPTHOME0 ]
then then
SourcePath=$0 SCRIPTHOME=$0
elif [ -d $testpath1 ] elif [ -d $SCRIPTHOME1 ]
then then
SourcePath=$testpath1 SCRIPTHOME=$SCRIPTHOME1
elif [ -d $testpath2 ] elif [ -d $SCRIPTHOME2 ]
then then
SourcePath=$testpath2 SCRIPTHOME=$SCRIPTHOME2
elif [ -d $testpath3 ] elif [ -d $SCRIPTHOME3 ]
then then
SourcePath=$testpath3 SCRIPTHOME=$SCRIPTHOME3
elif [ -d $testpath4 ] elif [ -d $SCRIPTHOME4 ]
then then
SourcePath=$testpath4 SCRIPTHOME=$SCRIPTHOME4
elif [ -d $testpath5 ] elif [ -d $SCRIPTHOME5 ]
then then
SourcePath=$testpath5 SCRIPTHOME=$SCRIPTHOME5
else else
echo "=== Enter [nixhome path] or leave [blank] to exit" echo "=== Enter [script path] or leave [blank] to exit"
read -p ">>> " SourcePath read -p ">>> " SCRIPTHOME
echo "" echo ""
if [ ! -d "$SourcePath" ] if [ ! -d "$SCRIPTHOME" ]
then then
echo "*** nixhome path [$SourcePath] not available! Exit now. ***" echo "*** nixhome path [$SCRIPTHOME] not available! Exit now. ***"
exit exit
fi fi
fi fi
@ -74,7 +74,7 @@ echo "=== Configure $NewUser's home with standard scripts? <y> for yes, <anythin
read -p ">>> " ConfigHome read -p ">>> " ConfigHome
if [ "$ConfigHome" == 'y' ] if [ "$ConfigHome" == 'y' ]
then then
source $SourcePath/home-config.sh $SourcePath/nixhome $NewUser source $SCRIPTHOME/home-config.sh $SCRIPTHOME/nixhome $NewUser
else else
echo "--- Nothing configured." echo "--- Nothing configured."
fi fi

82
git-ignore-all.bat Normal file
View File

@ -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

View File

@ -1,25 +1,25 @@
#!/bin/bash #!/bin/bash
testpath1=/faronear FONPATH1=/faronear
testpath2=~/faronear.git FONPATH2=~/faronear.git
testpath3=~/faronear FONPATH3=~/faronear
testpath4=/mnt/d/faronear FONPATH4=/mnt/d/faronear
if [ "$1" ] if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d $testpath1 ] elif [ -d $FONPATH1 ]
then then
FONPATH=$testpath1 FONPATH=$FONPATH1
elif [ -d $testpath2 ] elif [ -d $FONPATH2 ]
then then
FONPATH=$testpath2 FONPATH=$FONPATH2
elif [ -d $testpath3 ] elif [ -d $FONPATH3 ]
then then
FONPATH=$testpath3 FONPATH=$FONPATH3
elif [ -d $testpath4 ] elif [ -d $FONPATH4 ]
then then
FONPATH=$testpath4 FONPATH=$FONPATH4
else else
echo "=== Enter [target path] or leave [blank] for default to '.'" echo "=== Enter [target path] or leave [blank] for default to '.'"
read -p ">>> " FONPATH read -p ">>> " FONPATH

View File

@ -1,25 +1,25 @@
#!/bin/bash #!/bin/bash
testpath1=/faronear FONPATH1=/faronear
testpath2=~/faronear.git FONPATH2=~/faronear.git
testpath3=~/faronear FONPATH3=~/faronear
testpath4=/mnt/d/faronear FONPATH4=/mnt/d/faronear
if [ "$1" ] if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d $testpath1 ] elif [ -d $FONPATH1 ]
then then
FONPATH=$testpath1 FONPATH=$FONPATH1
elif [ -d $testpath2 ] elif [ -d $FONPATH2 ]
then then
FONPATH=$testpath2 FONPATH=$FONPATH2
elif [ -d $testpath3 ] elif [ -d $FONPATH3 ]
then then
FONPATH=$testpath3 FONPATH=$FONPATH3
elif [ -d $testpath4 ] elif [ -d $FONPATH4 ]
then then
FONPATH=$testpath4 FONPATH=$FONPATH4
else else
echo "=== Enter [target path] or leave [blank] for default to '.'" echo "=== Enter [target path] or leave [blank] for default to '.'"
read -p ">>> " FONPATH read -p ">>> " FONPATH

View File

@ -1,25 +1,25 @@
#!/bin/bash #!/bin/bash
testpath1=/faronear FONPATH1=/faronear
testpath2=~/faronear.git FONPATH2=~/faronear.git
testpath3=~/faronear FONPATH3=~/faronear
testpath4=/mnt/d/faronear FONPATH4=/mnt/d/faronear
if [ "$1" ] if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d $testpath1 ] elif [ -d $FONPATH1 ]
then then
FONPATH=$testpath1 FONPATH=$FONPATH1
elif [ -d $testpath2 ] elif [ -d $FONPATH2 ]
then then
FONPATH=$testpath2 FONPATH=$FONPATH2
elif [ -d $testpath3 ] elif [ -d $FONPATH3 ]
then then
FONPATH=$testpath3 FONPATH=$FONPATH3
elif [ -d $testpath4 ] elif [ -d $FONPATH4 ]
then then
FONPATH=$testpath4 FONPATH=$FONPATH4
else else
echo "=== Enter [target path] or leave [blank] for default to '.'" echo "=== Enter [target path] or leave [blank] for default to '.'"
read -p ">>> " FONPATH read -p ">>> " FONPATH

View File

@ -1,25 +1,25 @@
#!/bin/bash #!/bin/bash
testpath1=/faronear FONPATH1=/faronear
testpath2=~/faronear.git FONPATH2=~/faronear.git
testpath3=~/faronear FONPATH3=~/faronear
testpath4=/mnt/d/faronear FONPATH4=/mnt/d/faronear
if [ "$1" ] if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d $testpath1 ] elif [ -d $FONPATH1 ]
then then
FONPATH=$testpath1 FONPATH=$FONPATH1
elif [ -d $testpath2 ] elif [ -d $FONPATH2 ]
then then
FONPATH=$testpath2 FONPATH=$FONPATH2
elif [ -d $testpath3 ] elif [ -d $FONPATH3 ]
then then
FONPATH=$testpath3 FONPATH=$FONPATH3
elif [ -d $testpath4 ] elif [ -d $FONPATH4 ]
then then
FONPATH=$testpath4 FONPATH=$FONPATH4
else else
echo "=== Enter [target path] or leave [blank] for default to '.'" echo "=== Enter [target path] or leave [blank] for default to '.'"

View File

@ -1,25 +1,25 @@
#!/bin/bash #!/bin/bash
testpath1=/faronear FONPATH1=/faronear
testpath2=~/faronear.git FONPATH2=~/faronear.git
testpath3=~/faronear FONPATH3=~/faronear
testpath4=/mnt/d/faronear FONPATH4=/mnt/d/faronear
if [ "$1" ] if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d $testpath1 ] elif [ -d $FONPATH1 ]
then then
FONPATH=$testpath1 FONPATH=$FONPATH1
elif [ -d $testpath2 ] elif [ -d $FONPATH2 ]
then then
FONPATH=$testpath2 FONPATH=$FONPATH2
elif [ -d $testpath3 ] elif [ -d $FONPATH3 ]
then then
FONPATH=$testpath3 FONPATH=$FONPATH3
elif [ -d $testpath4 ] elif [ -d $FONPATH4 ]
then then
FONPATH=$testpath4 FONPATH=$FONPATH4
else else
echo "=== Enter [target path] or leave [blank] for default to '.'" echo "=== Enter [target path] or leave [blank] for default to '.'"

View File

@ -1,40 +1,40 @@
#!/bin/bash #!/bin/bash
testpath0=/faronear/sysconfig/nixhome NIXHOME0=/faronear/sysconfig/nixhome
testpath1=/faronear/fon/sysconfig/nixhome NIXHOME1=/faronear/fon/sysconfig/nixhome
testpath2=~/faronear/fon/sysconfig/nixhome NIXHOME2=~/faronear/fon/sysconfig/nixhome
testpath3=~/faronear/fon.git/sysconfig/nixhome NIXHOME3=~/faronear/fon.git/sysconfig/nixhome
testpath4=~/faronear.git/fon.git/sysconfig/nixhome NIXHOME4=~/faronear.git/fon.git/sysconfig/nixhome
testpath5=`pwd`/nixhome NIXHOME5=`pwd`/nixhome
if [ "$1" ] if [ "$1" ]
then then
SourcePath=$1 NIXHOME=$1
elif [ -d $testpath0 ] elif [ -d $NIXHOME0 ]
then then
SourcePath=$testpath0 NIXHOME=$NIXHOME0
elif [ -d $testpath1 ] elif [ -d $NIXHOME1 ]
then then
SourcePath=$testpath1 NIXHOME=$NIXHOME1
elif [ -d $testpath2 ] elif [ -d $NIXHOME2 ]
then then
SourcePath=$testpath2 NIXHOME=$NIXHOME2
elif [ -d $testpath3 ] elif [ -d $NIXHOME3 ]
then then
SourcePath=$testpath3 NIXHOME=$NIXHOME3
elif [ -d $testpath4 ] elif [ -d $NIXHOME4 ]
then then
SourcePath=$testpath4 NIXHOME=$NIXHOME4
elif [ -d $testpath5 ] elif [ -d $NIXHOME5 ]
then then
SourcePath=$testpath5 NIXHOME=$NIXHOME5
else else
echo "=== Enter [nixhome path] or leave [blank] to exit" echo "=== Enter [nixhome path] or leave [blank] to exit"
read -p ">>> " SourcePath read -p ">>> " NIXHOME
echo "" echo ""
if [ ! -d "$SourcePath" ] if [ ! -d "$NIXHOME" ]
then then
echo "*** nixhome path [$SourcePath] not available! Exit now. ***" echo "*** nixhome path [$NIXHOME] not available! Exit now. ***"
exit exit
fi fi
fi fi
@ -71,8 +71,8 @@ then
then then
mv $homescript $homescript.backup-$(date +%Y%m%dT%H%M%S) mv $homescript $homescript.backup-$(date +%Y%m%dT%H%M%S)
fi fi
echo "--- Linking $SourcePath/$homescript to $HomePath/$homescript ..." echo "--- Linking $NIXHOME/$homescript to $HomePath/$homescript ..."
ln -s $SourcePath/$homescript ./ ln -s $NIXHOME/$homescript ./
done done
elif [ "$CopyOrLinkScripts" == 'c' ] elif [ "$CopyOrLinkScripts" == 'c' ]
then then
@ -82,8 +82,8 @@ then
then then
mv $homescript $homescript.backup-$(date +%Y%m%dT%H%M%S) mv $homescript $homescript.backup-$(date +%Y%m%dT%H%M%S)
fi fi
echo "--- Copying $SourcePath/$homescript to $HomePath/$homescript ..." echo "--- Copying $NIXHOME/$homescript to $HomePath/$homescript ..."
cp -r $SourcePath/$homescript ./ cp -r $NIXHOME/$homescript ./
done done
else else
echo '--- Home scripts not changed.' echo '--- Home scripts not changed.'
@ -111,13 +111,13 @@ then
if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ] if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ]
then then
echo "--- Linking $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..." echo "--- Linking $NIXHOME/authorized_keys to $HomePath/.ssh/authorized_keys ..."
ln -s $SourcePath/.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 $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..." echo "--- Copying $NIXHOME/authorized_keys to $HomePath/.ssh/authorized_keys ..."
cat $SourcePath/.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
echo echo

2
home-import.sh Normal file
View File

@ -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

View File

@ -1 +0,0 @@
curl -sSL https://git.faronear.org/fon/sysconfig/raw/branch/main/nixhome/.bashrc > ~/.bashrc

View File

@ -1,25 +1,25 @@
#!/bin/bash #!/bin/bash
testpath1=/faronear FONPATH1=/faronear
testpath2=~/faronear.git FONPATH2=~/faronear.git
testpath3=~/faronear FONPATH3=~/faronear
testpath4=/mnt/d/faronear FONPATH4=/mnt/d/faronear
if [ "$1" ] if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d $testpath1 ] elif [ -d $FONPATH1 ]
then then
FONPATH=$testpath1 FONPATH=$FONPATH1
elif [ -d $testpath2 ] elif [ -d $FONPATH2 ]
then then
FONPATH=$testpath2 FONPATH=$FONPATH2
elif [ -d $testpath3 ] elif [ -d $FONPATH3 ]
then then
FONPATH=$testpath3 FONPATH=$FONPATH3
elif [ -d $testpath4 ] elif [ -d $FONPATH4 ]
then then
FONPATH=$testpath4 FONPATH=$FONPATH4
else else
echo "=== Enter [target path] or leave [blank] for default to '.'" echo "=== Enter [target path] or leave [blank] for default to '.'"
read -p ">>> " FONPATH read -p ">>> " FONPATH

View File

@ -1,25 +1,25 @@
#!/bin/bash #!/bin/bash
testpath1=/faronear FONPATH1=/faronear
testpath2=~/faronear.git FONPATH2=~/faronear.git
testpath3=~/faronear FONPATH3=~/faronear
testpath4=/mnt/d/faronear FONPATH4=/mnt/d/faronear
if [ "$1" ] if [ "$1" ]
then then
FONPATH=$1 FONPATH=$1
elif [ -d $testpath1 ] elif [ -d $FONPATH1 ]
then then
FONPATH=$testpath1 FONPATH=$FONPATH1
elif [ -d $testpath2 ] elif [ -d $FONPATH2 ]
then then
FONPATH=$testpath2 FONPATH=$FONPATH2
elif [ -d $testpath3 ] elif [ -d $FONPATH3 ]
then then
FONPATH=$testpath3 FONPATH=$FONPATH3
elif [ -d $testpath4 ] elif [ -d $FONPATH4 ]
then then
FONPATH=$testpath4 FONPATH=$FONPATH4
else else
echo "=== Enter [target path] or leave [blank] for default to '.'" echo "=== Enter [target path] or leave [blank] for default to '.'"
read -p ">>> " FONPATH read -p ">>> " FONPATH

64
seafile-ignore-all.bat Normal file
View File

@ -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