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
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? <y> for yes, <anythin
read -p ">>> " 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

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

View File

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

View File

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

View File

@ -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 '.'"

View File

@ -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 '.'"

View File

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

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

View File

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

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