This commit is contained in:
Luk 2024-01-28 11:35:14 +08:00
parent 304d2564fa
commit 85b40a6d90
19 changed files with 246 additions and 56 deletions

View File

@ -1,12 +1,18 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# how to include another gitignore?
# https://stackoverflow.com/questions/7005142/can-i-include-other-gitignore-file-in-a-gitignore-file-like-include-in-c-li
# https://github.com/github/gitignore
# https://github.com/SlideWave/gitignore-include?tab=readme-ov-file#examples
# https://gitignore.io
### 目录 #################################################################
### .gitignore_global ###
# 自定义的后缀名,凡有 gitignore 后缀的都不进行同步
# Self defined extension to ignore all files/folders containing .gitignore
*.gitignore.*
*.gitignore.*/
*.gitignore
*.gitignore/
!.gitignore
# 通用
.svn/
@ -92,3 +98,6 @@ pages4loader.json5
# 保留
!.gitkeep
### .gitignore_local ###

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 "***************************************"
echo "To find in which path? Enter [start path] or [leave blank] for the current path:"
echo "To find in which path? Enter [root path] or [leave blank] for the current path:"
read -p ">>> " FIND_FOLDER
if [ ! "$FIND_FOLDER" ]
then

View File

@ -47,7 +47,7 @@ then
fi
echo "---------------------------------------------"
echo "Path to global gitignore file? (For example ~/.gitignore, leave blank for no change)"
echo "Path to global gitignore file? (For example ~/.gitignore_global, leave blank for no change)"
read -p ">>> " ExcludesFile
if [ $ExcludesFile ]
then

View File

@ -20,7 +20,7 @@ echo *** Testing Path [[%ROOTPATH1%]] [[%ROOTPATH2%]] [[%ROOTPATH3%]]
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
echo === Enter [root path] or [leave blank] for default [[%CD%]] to start tree search for .gitignore files
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
@ -39,7 +39,7 @@ pushd %ROOTPATH%
echo *** Starting from [[%CD%]] ***
echo;
echo === Enter [path to .gitignore] or [leave blank] for default to [[%CD%]]
echo === Enter [path to global .gitignore] or [leave blank] for default [[%CD%]]
set /p IGNOREPATH=">>> "
echo;
if "" == "%IGNOREPATH%" (
@ -55,10 +55,10 @@ if not exist "%IGNOREPATH%" (
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" (
if exist "%%r\.git" (
pushd "%%r"
echo ---- updating .gitignore in [[%%r]] ----
copy %IGNOREPATH%\.gitignore %%r\
cat %IGNOREPATH%\.gitignore %%r\.gitignore_local > %%r\.gitignore
echo;
popd
)

View File

@ -1,19 +1,22 @@
#!/bin/bash
echo ""
echo "Search in [ROOTPATH], merge [IGNOREPATH/.gitignore_global] and [ROOTPATH/*/.gitignore_local] files to [seafile-ignore.txt]"
echo ""
if [ -d "$1" ]
then
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
echo "=== Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for git repositories"
read -p ">>> " ROOTPATH
echo ""
if [ ! "$ROOTPATH" ]
if [ "$ROOTPATH" ]
then
ROOTPATH=$(realpath $ROOTPATH)
else
ROOTPATH=`pwd`
fi
fi
if [ ! -d "$ROOTPATH" ]
then
echo "××× [[$ROOTPATH]] not exist! Exit now. ***"
@ -21,13 +24,29 @@ then
else
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
echo "=== Enter [path to .gitignore]"
read -p ">>> " IGNOREPATH
echo ""
if [ ! -f "$IGNOREPATH/.gitignore" ]
echo "=== Enter [path to .gitignore_global] or [leave blank] for default [[`pwd`]]"
read -p ">>> " IGNOREPATH
if [ "$IGNOREPATH" ]
then
IGNOREPATH=$(realpath $IGNOREPATH)/.gitignore_global
else
IGNOREPATH=`pwd`/.gitignore_global
fi
if [ ! -f "$IGNOREPATH/.gitignore_global" ]
then
echo "××× Not found [[$IGNOREPATH]]. Exit now..."
exit
else
echo "√√√ IGNOREPATH = [[$IGNOREPATH]]"
fi
echo ""
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
if [ "$YESNO" != 'y' ]
then
echo "××× Not found [[$IGNOREPATH/.gitignore]]. Exit now..."
exit
fi
@ -40,7 +59,7 @@ do
if [ -d "$repo/.git" ]
then
echo "---- updating .gitignore in [[$repo]] ----"
cp $IGNOREPATH/.gitignore $repo/
cat $IGNOREPATH $repo/.gitignore_local 2>/dev/null > $repo/.gitignore
echo ""
fi
done

View File

@ -20,7 +20,7 @@ echo *** Testing Path [[%ROOTPATH1%]] [[%ROOTPATH2%]] [[%ROOTPATH3%]]
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path]> or [leave blank] for default to [[%CD%]]
echo === Enter [root path]> or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (

View File

@ -5,15 +5,15 @@ then
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
echo "=== Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " ROOTPATH
echo ""
if [ ! "$ROOTPATH" ]
if [ "$ROOTPATH"]
then
ROOTPATH=`realpath $ROOTPATH`
else
ROOTPATH=`pwd`
fi
fi
if [ ! -d "$ROOTPATH" ]
then
echo "××× [[$ROOTPATH]] not exist! Exit now. ***"
@ -21,6 +21,14 @@ then
else
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
echo ""
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
if [ "$YESNO" != 'y' ]
then
exit
fi
pushd $ROOTPATH
echo "*** Starting from [[`pwd`]] ***"

View File

@ -20,7 +20,7 @@ echo *** Testing Path [[%ROOTPATH1%]] [[%ROOTPATH2%]] [[%ROOTPATH3%]]
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
echo === Enter [root path] or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (

View File

@ -5,15 +5,15 @@ then
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
echo "=== Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " ROOTPATH
echo ""
if [ ! "$ROOTPATH" ]
if [ "$ROOTPATH"]
then
ROOTPATH=`realpath $ROOTPATH`
else
ROOTPATH=`pwd`
fi
fi
if [ ! -d "$ROOTPATH" ]
then
echo "××× [[$ROOTPATH]] not exist! Exit now. ***"
@ -22,6 +22,13 @@ else
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
if [ "$YESNO" != 'y' ]
then
exit
fi
pushd $ROOTPATH
echo "*** Starting from [[`pwd`]] ***"
echo ""

View File

@ -5,15 +5,15 @@ then
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
echo "=== Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " ROOTPATH
echo ""
if [ ! "$ROOTPATH" ]
if [ "$ROOTPATH"]
then
ROOTPATH=`realpath $ROOTPATH`
else
ROOTPATH=`pwd`
fi
fi
if [ ! -d "$ROOTPATH" ]
then
echo "××× [[$ROOTPATH]] not exist! Exit now. ***"
@ -22,6 +22,13 @@ else
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
if [ "$YESNO" != 'y' ]
then
exit
fi
pushd $ROOTPATH
echo "*** Starting from [[`pwd`]] ***"
echo ""

View File

@ -3,21 +3,35 @@
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 [old hook path] or [leave blank] for default '/faronear/git/gitea/gitea':"
echo "=== Enter [old hook path string] or [leave blank] for default '/faronear/git/gitea/gitea':"
read -p ">>> " OLDPATH
if [ ! "$OLDPATH"]
then
OLDPATH=/faronear/git/gitea/gitea
fi
echo "Enter [new hook path] or [leave blank] for default '/usr/local/bin/gitea': "
read -p ">> " NEWPATH
echo "=== Enter [new hook path string] or [leave blank] for default '/usr/local/bin/gitea': "
read -p ">>> " NEWPATH
if [ ! "$NEWPATH" ]
then
NEWPATH=/usr/local/bin/gitea
fi
read -p "Enter repository root path: >> " REPOROOT
echo "=== Enter [root path] of repositories, or [leave blank] for default [[]]`pwd`]] "
read -p ">>> " REPOROOT
if [ "$ROOTPATH"]
then
ROOTPATH=`realpath $ROOTPATH`
else
ROOTPATH=`pwd`
fi
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
if [ "$YESNO" != 'y' ]
then
exit
fi
# 用 : 来取代 /,以避免大量出现 \/
# sed -i "s/\/home\/fon\//\/root\//g" `grep '/home/fon' -rl git.repo/*/*/hooks/*.d/gitea`

View File

@ -48,7 +48,7 @@ then
pushd $HomePath
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore"
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore_global"
echo
echo "=== Copy or link scripts? [l] to link, [c] to copy, [g] to git import, [anything else] to omit:"
read -p ">>> " CopyOrLinkScripts

103
nixhome/.gitignore_global Normal file
View File

@ -0,0 +1,103 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# how to include another gitignore?
# https://stackoverflow.com/questions/7005142/can-i-include-other-gitignore-file-in-a-gitignore-file-like-include-in-c-li
# https://github.com/github/gitignore
# https://github.com/SlideWave/gitignore-include?tab=readme-ov-file#examples
# https://gitignore.io
### .gitignore_global ###
# Self defined extension to ignore all files/folders containing .gitignore
*.gitignore.*
*.gitignore.*/
*.gitignore
*.gitignore/
!.gitignore
# 通用
.svn/
.deploy_git/
.idea/
.sass-cache/
.wrangler
/test/unit/coverage/
/test/e2e/reports/
node_modules/
*.apk
*.min.js
*.min.css
*.min.html
*.iml
*.njsproj
*.ntvs*
*.sw*
*.sln
*.suo
.gitattributes
.umi
.umi-production
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
selenium-debug.log
Thumbs.db
thumbs.db
_desktop.ini
# vue-cli 项目
/dist/
# 来自 vue-cli 创建项目的 .gitignore
.project
# hexo
/public/
# Hardhat
/artifacts/
/cache/
# seafile 临时文件
._*
.$*
# office 暂存文件
~$*
# 用户shell配置脚本
.bashrc_custom
# 苹果系统临时文件
.DS_Store
# 安卓缓存文件夹
.thumbnails
# local env files
.env.local
.env.*.local
# hexo
/db.json
# wo
# 服务端
/_archive/*
/_datastore/*
/_filestore/*
/_logstore/*
/_webroot/*
/_ssl/*
# uniapp 客户端
/unpackage/*
!/unpackage/res/
package-lock.json
pages4loader.json5
# 保留
!.gitkeep
### .gitignore_local ###

View File

@ -6,6 +6,8 @@
# 文件在服务器端的后续更改会被同步到客户端,如果客户端也同时修改了这些文件,系统会生成冲突文件。
# seafile-ignore.txt 只能忽略还没有被同步的文件。对于已经被同步的文件,如果后来把它添加到 seafile-ignore.txt 中,系统只会忽略后续更改,已经上传的版本不会受影响。
### seafile-ignore_global ###
# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步
*.sfignore
*.sfignore.*
@ -50,3 +52,6 @@ unpackage/
Icon
OneDrive/Icon
### seafile-ignore_local ###

View File

@ -20,7 +20,7 @@ echo *** Testing Path [[%ROOTPATH1%]] [[%ROOTPATH2%]] [[%ROOTPATH3%]]
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
echo === Enter [root path] or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (

View File

@ -5,7 +5,7 @@ then
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
echo "=== Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " ROOTPATH
echo ""
if [ ! "$ROOTPATH" ]

View File

@ -15,7 +15,7 @@ set ROOTPATH=
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
echo === Enter [root path] or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (

View File

@ -20,7 +20,7 @@ echo *** Testing Path [[%ROOTPATH1%]] [[%ROOTPATH2%]] [[%ROOTPATH3%]]
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
echo === Enter [root path] or [leave blank] for default [[%CD%]] to start tree search for seafile-ignore.txt files
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
@ -35,7 +35,7 @@ if not exist "%ROOTPATH%" (
echo √√√ ROOTPATH = [[%ROOTPATH%]]
)
echo === Enter [path to seafile-ignore.txt] or leave [blank] for default to [[%CD%]]
echo === Enter [path to global seafile-ignore.txt] or [leave blank] for default [[%CD%]]
set /p IGNOREPATH=">>> "
echo;
if "" == "%IGNOREPATH%" (
@ -55,9 +55,9 @@ 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" (
if exist "%%r\seafile-ignore.txt" (
echo ---- updating seafile-ignore.txt in [[%%r]] ----
copy %IGNOREPATH%\seafile-ignore.txt %%r\
cat %IGNOREPATH%\seafile-ignore.txt %%r\seafile-ignore_local.txt > %%r\seafile-ignore.txt
echo;
)
)

View File

@ -1,19 +1,22 @@
#!/bin/bash
echo ""
echo "Search in [ROOTPATH], Merge [IGNOREPATH/seafile-ignore_global] and [ROOTPATH/*/seafile-ignore_local] files to [seafile-ignore.txt]"
echo ""
if [ -d "$1" ]
then
ROOTPATH=$1
else
echo ""
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
echo "=== Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for seafile-ignore.txt files"
read -p ">>> " ROOTPATH
echo ""
if [ ! "$ROOTPATH" ]
if [ "$ROOTPATH" ]
then
ROOTPATH=$(realpath $ROOTPATH)
else
ROOTPATH=`pwd`
fi
fi
if [ ! -d "$ROOTPATH" ]
then
echo "××× [[$ROOTPATH]] not exist! Exit now. ***"
@ -21,13 +24,28 @@ then
else
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
echo "=== Enter [path to seafile-ignore.txt]"
read -p ">>> " IGNOREPATH
echo ""
if [ ! -f "$IGNOREPATH/seafile-ignore.txt" ]
echo "=== Enter [path to seafile-ignore_global] or [leave blank] for default [[`pwd`]]"
read -p ">>> " IGNOREPATH
if [ "$IGNOREPATH" ]
then
IGNOREPATH=$(realpath $IGNOREPATH)/seafile-ignore_global
else
IGNOREPATH=`pwd`/seafile-ignore_global
fi
if [ ! -f "$IGNOREPATH" ]
then
echo "××× Not found [[$IGNOREPATH]]. Exit now..."
exit
else
echo "√√√ IGNOREPATH = [[$IGNOREPATH]]"
fi
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
if [ "$YESNO" != 'y' ]
then
echo "××× Not found [[$IGNOREPATH/seafile-ignore.txt]]. Exit now..."
exit
fi
@ -40,7 +58,7 @@ do
if [ -f "$repo/seafile-ignore.txt" ]
then
echo "---- updating seafile-ignore.txt in [[$repo]] ----"
cp $IGNOREPATH/seafile-ignore.txt $repo/
cat $IGNOREPATH $repo/seafile-ignore_local 2>/dev/null > $repo/seafile-ignore.txt
echo ""
fi
done