u
This commit is contained in:
@@ -24,17 +24,17 @@ if not exist "%ROOTPATH%" (
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo ::*** Enter [path to .gitignore_global] or [leave blank] for default [[https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global]]
|
echo ::*** Enter [path to .gitignore_global] or [leave blank] for default [[https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global]]
|
||||||
set /p IGNOREPATH=">>> "
|
set /p GLOBALPATH=">>> "
|
||||||
echo;
|
echo;
|
||||||
if "" == "%IGNOREPATH%" (
|
if "" == "%GLOBALPATH%" (
|
||||||
set IGNOREPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global
|
set GLOBALPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global
|
||||||
) else (
|
) else (
|
||||||
for %P in (%IGNOREPATH%) do set "IGNOREPATH=%~dpnxP/.gitignore_global"
|
for %P in (%GLOBALPATH%) do set "GLOBALPATH=%~dpnxP/.gitignore_global"
|
||||||
if not exist "%IGNOREPATH%" (
|
if not exist "%GLOBALPATH%" (
|
||||||
echo ××× [[%IGNOREPATH%]] not exist! Exit now. ***
|
echo ××× [[%GLOBALPATH%]] not exist! Exit now. ***
|
||||||
@ GOTO END
|
@ GOTO END
|
||||||
) else (
|
) else (
|
||||||
echo √√√ IGNOREPATH = [[%IGNOREPATH%]]
|
echo √√√ GLOBALPATH = [[%GLOBALPATH%]]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ for /d /r %%r in (*) do (
|
|||||||
if exist "%%r\.git" (
|
if exist "%%r\.git" (
|
||||||
pushd "%%r"
|
pushd "%%r"
|
||||||
echo ---- updating .gitignore in [[%%r]] ----
|
echo ---- updating .gitignore in [[%%r]] ----
|
||||||
cat %IGNOREPATH%\.gitignore %%r\.gitignore.local.txt > %%r\.gitignore
|
cat %GLOBALPATH%\.gitignore %%r\.gitignore.local.txt > %%r\.gitignore
|
||||||
echo;
|
echo;
|
||||||
popd
|
popd
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Search in [ROOTPATH], merge [IGNOREPATH/.gitignore_global] and [ROOTPATH/*/.gitignore.local.txt] files to [seafile-ignore.txt]"
|
echo "Search in [ROOTPATH], merge [GLOBALPATH/.gitignore_global] and [ROOTPATH/*/.gitignore.local.txt] files to .gitignore"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ -d "$1" ]
|
if [ -d "$1" ]
|
||||||
@@ -27,22 +27,22 @@ fi
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo "::*** Enter [path to .gitignore_global] or [leave blank] for default [[https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global]]"
|
echo "::*** Enter [path to .gitignore_global] or [leave blank] for default [[https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global]]"
|
||||||
read -p "***:: " IGNOREPATH
|
read -p "***:: " GLOBALPATH
|
||||||
if [ "$IGNOREPATH" ]
|
if [ "$GLOBALPATH" ]
|
||||||
then
|
then
|
||||||
if [ -d "$IGNOREPATH" ]
|
if [ -d "$GLOBALPATH" ]
|
||||||
then
|
then
|
||||||
IGNOREPATH=$(realpath $IGNOREPATH)/.gitignore_global
|
GLOBALPATH=$(realpath $GLOBALPATH)/.gitignore_global
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$IGNOREPATH" ]
|
if [ ! -f "$GLOBALPATH" ]
|
||||||
then
|
then
|
||||||
echo "××× Not found [[$IGNOREPATH]]. Exit now..."
|
echo "××× Not found [[$GLOBALPATH]]. Exit now..."
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
echo "√√√ IGNOREPATH = [[$IGNOREPATH]]"
|
echo "√√√ GLOBALPATH = [[$GLOBALPATH]]"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
IGNOREPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global
|
GLOBALPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@@ -62,11 +62,11 @@ do
|
|||||||
if [ -f "$repo/.gitignore" ] # some git repo need to keep privacy, therefore judge from .gitignore, not from .git
|
if [ -f "$repo/.gitignore" ] # some git repo need to keep privacy, therefore judge from .gitignore, not from .git
|
||||||
then
|
then
|
||||||
echo "---- updating [[$repo/.gitignore]] ----"
|
echo "---- updating [[$repo/.gitignore]] ----"
|
||||||
if [ -f "$IGNOREPATH" ]
|
if [ -f "$GLOBALPATH" ]
|
||||||
then
|
then
|
||||||
cat $IGNOREPATH > $repo/.gitignore
|
cat $GLOBALPATH > $repo/.gitignore
|
||||||
else
|
else
|
||||||
curl -sSL $IGNOREPATH | cat > $repo/.gitignore
|
curl -sSL $GLOBALPATH | cat > $repo/.gitignore
|
||||||
fi
|
fi
|
||||||
cat $repo/.gitignore.local.txt 2>/dev/null >> $repo/.gitignore
|
cat $repo/.gitignore.local.txt 2>/dev/null >> $repo/.gitignore
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -132,29 +132,28 @@ elif [ -f /etc/debian_version ]; then
|
|||||||
elif [ -f /etc/ubuntu_version ]; then
|
elif [ -f /etc/ubuntu_version ]; then
|
||||||
MYOSVERSION=Ubt`cat /etc/ubuntu_version 2>/dev/null`
|
MYOSVERSION=Ubt`cat /etc/ubuntu_version 2>/dev/null`
|
||||||
fi
|
fi
|
||||||
|
if [[ -n "$SSH_CONNECTION" ]]; then
|
||||||
|
IN_SSH="[ssh]"
|
||||||
|
fi
|
||||||
if [ "$color_prompt" = yes ]; then
|
if [ "$color_prompt" = yes ]; then
|
||||||
PS1='<\[\033[07;32m\]\t\[\033[00m\]#\[\033[07;35m\]\u\[\033[00m\]@\[\033[07;31m\]\h\[\033[00m\]^\[\033[07;34m\]$(uname -m),$(uname),$MYOSVERSION\[\033[00m\]::\[\033[07;36m\]\w\[\033[00m\]> '
|
PS1='<\[\033[07;32m\]\t\[\033[00m\]#\[\033[07;35m\]\u\[\033[00m\]@\[\033[07;31m\]\h\[\033[00m\]^\[\033[07;34m\]$(uname -m),$(uname),$MYOSVERSION\[\033[00m\]::\[\033[07;36m\]\w\[\033[00m\]$IN_SSH> '
|
||||||
else
|
else
|
||||||
PS1='[\t#\u@\h^$(uname -m),$(uname),$MYOSVERSION::\w] ' # \w shows absolute path, \W shows current folder.
|
PS1='<\t#\u@\h^$(uname -m),$(uname),$MYOSVERSION::\w$IN_SSH> ' # \w shows absolute path, \W shows current folder.
|
||||||
fi
|
fi
|
||||||
unset color_prompt force_color_prompt
|
unset color_prompt force_color_prompt
|
||||||
|
|
||||||
############## above settings copied from amazon's debian ####################
|
############## above settings copied from amazon's debian ####################
|
||||||
|
|
||||||
if [ "$(uname)" = "Darwin" ]
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
then
|
if [ "$(uname -m)" = "arm64" ] && [ -f /opt/homebrew/bin/brew ]; then
|
||||||
if [ "$(uname -m)" = "arm64" ] && [ -f /opt/homebrew/bin/brew ]
|
|
||||||
then
|
|
||||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
elif [ "$(uname -m)" = "x86_64" ] && [ -f /usr/local/homebrew/bin/brew ]
|
elif [ "$(uname -m)" = "x86_64" ] && [ -f /usr/local/homebrew/bin/brew ]; then
|
||||||
then
|
|
||||||
eval "$(echo $(/usr/local/homebrew/bin/brew shellenv) | sed 's#HOMEBREW_CELLAR=.*$#HOMEBREW_CELLAR=/usr/local/Cellar#')"
|
eval "$(echo $(/usr/local/homebrew/bin/brew shellenv) | sed 's#HOMEBREW_CELLAR=.*$#HOMEBREW_CELLAR=/usr/local/Cellar#')"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# nvm settings
|
# nvm settings
|
||||||
if [ -d $HOME/.nvm ]
|
if [ -d $HOME/.nvm ]; then
|
||||||
then
|
|
||||||
# 注意,这句 export 导致 `su` 会继承原用户的环境变量 NVM_DIR=/home/原用户/.nvm,可能导致不符合预期的行为。因此要 `su -` 更安全。
|
# 注意,这句 export 导致 `su` 会继承原用户的环境变量 NVM_DIR=/home/原用户/.nvm,可能导致不符合预期的行为。因此要 `su -` 更安全。
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||||
|
|||||||
@@ -22,10 +22,15 @@
|
|||||||
*.nosf/
|
*.nosf/
|
||||||
*.nosf.*/
|
*.nosf.*/
|
||||||
|
|
||||||
|
## everything 'git pull or fetch' will update `.git/FETCH_HEAD`, even if the content doesn't change. To avoid too many useless updates of this file in Seafile history:
|
||||||
|
FETCH_HEAD
|
||||||
|
*/FETCH_HEAD
|
||||||
|
|
||||||
.Trash/
|
.Trash/
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*/.DS_Store
|
*/.DS_Store
|
||||||
|
*.aae # AAE 文件主要在苹果的照片应用程序中使用,保存对原始照片所做的编辑,比如,裁剪、旋转或调整亮度等操作的信息。
|
||||||
|
|
||||||
.thumbnails
|
.thumbnails
|
||||||
*/.thumbnails
|
*/.thumbnails
|
||||||
@@ -50,14 +55,17 @@ _desktop.ini
|
|||||||
node_modules/
|
node_modules/
|
||||||
*/node_modules/
|
*/node_modules/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
*/package-lock.json
|
||||||
|
|
||||||
pages4loader.json5
|
pages4loader.json5
|
||||||
|
*/pages4loader.json5
|
||||||
|
|
||||||
.deploy_git/
|
.deploy_git/
|
||||||
*/.deploy_git/
|
*/.deploy_git/
|
||||||
|
|
||||||
# next.js 项目
|
# next.js 项目
|
||||||
.next/
|
.next/
|
||||||
|
*/.next/
|
||||||
|
|
||||||
# HBuilder 目录
|
# HBuilder 目录
|
||||||
unpackage/
|
unpackage/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Search in [ROOTPATH], Merge [IGNOREPATH/seafile-ignore.global.txt] and [ROOTPATH/*/seafile-ignore.local.txt] files to [seafile-ignore.txt]"
|
echo "Search in [ROOTPATH], Merge [GLOBALPATH/seafile-ignore.global.txt] and [ROOTPATH/*/seafile-ignore.local.txt] files to [seafile-ignore.txt]"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ -d "$1" ]
|
if [ -d "$1" ]
|
||||||
@@ -27,22 +27,22 @@ fi
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo "::*** Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]"
|
echo "::*** Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]"
|
||||||
read -p "***:: " IGNOREPATH
|
read -p "***:: " GLOBALPATH
|
||||||
if [ "$IGNOREPATH" ]
|
if [ "$GLOBALPATH" ]
|
||||||
then
|
then
|
||||||
if [ -d "$IGNOREPATH" ]
|
if [ -d "$GLOBALPATH" ]
|
||||||
then
|
then
|
||||||
IGNOREPATH=$(realpath $IGNOREPATH)/seafile-ignore.global.txt
|
GLOBALPATH=$(realpath $GLOBALPATH)/seafile-ignore.global.txt
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$IGNOREPATH" ]
|
if [ ! -f "$GLOBALPATH" ]
|
||||||
then
|
then
|
||||||
echo "××× Not found [[$IGNOREPATH]]. Exit now..."
|
echo "××× Not found [[$GLOBALPATH]]. Exit now..."
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
echo "√√√ IGNOREPATH = [[$IGNOREPATH]]"
|
echo "√√√ GLOBALPATH = [[$GLOBALPATH]]"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
IGNOREPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt
|
GLOBALPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@@ -57,16 +57,16 @@ cd $ROOTPATH
|
|||||||
echo "*** Starting from [[`pwd`]] ***"
|
echo "*** Starting from [[`pwd`]] ***"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
find . -mindepth 1 -maxdepth 3 -type d -name '[^.]*' | grep -E -v 'node_modules|uni_modules|\.deploy_git|\.git|.svn|\.vscode|\.wrangler|unpackage|_webroot|_logstore|_datasotre|_archive|_filestore|_ssl' | while read repo
|
find . -mindepth 0 -maxdepth 3 -type d -name '[^.]*' | grep -E -v 'node_modules|uni_modules|\.deploy_git|\.git|.svn|\.vscode|\.wrangler|unpackage|_webroot|_logstore|_datasotre|_archive|_filestore|_ssl' | while read repo
|
||||||
do
|
do
|
||||||
if [ -f "$repo/seafile-ignore.txt" ]
|
if [ -f "$repo/seafile-ignore.txt" ] || [ -d "$repo/.git" ]
|
||||||
then
|
then
|
||||||
echo "---- updating [[$repo/seafile-ignore.txt]] ----"
|
echo "---- updating [[$repo/seafile-ignore.txt]] ----"
|
||||||
if [ -f "$IGNOREPATH" ]
|
if [ -f "$GLOBALPATH" ]
|
||||||
then
|
then
|
||||||
cat $IGNOREPATH > $repo/seafile-ignore.txt
|
cat $GLOBALPATH > $repo/seafile-ignore.txt
|
||||||
else
|
else
|
||||||
curl -sSL $IGNOREPATH | cat > $repo/seafile-ignore.txt
|
curl -sSL $GLOBALPATH | cat > $repo/seafile-ignore.txt
|
||||||
fi
|
fi
|
||||||
cat $repo/seafile-ignore.local.txt 2>/dev/null >> $repo/seafile-ignore.txt
|
cat $repo/seafile-ignore.local.txt 2>/dev/null >> $repo/seafile-ignore.txt
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
84
seafile-ignore.txt
Normal file
84
seafile-ignore.txt
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
# https://help.seafile.com/syncing_client/excluding_files/
|
||||||
|
# 注释。通配符:* 匹配0到若干个字符,包括代表目录的/。? 匹配1个字符,包括/。
|
||||||
|
# seafile-ignore.txt 只能控制在客户端需要忽略哪些文件。你依然可以在 seahub 的 web 界面创建这些被客户端忽略的文件。
|
||||||
|
# 在这种情况下,
|
||||||
|
# 这些文件会被同步到客户端,但是用户在客户端对这些文件的后续修改会被忽略,不会被同步回服务器。
|
||||||
|
# 文件在服务器端的后续更改会被同步到客户端,如果客户端也同时修改了这些文件,系统会生成冲突文件。
|
||||||
|
# seafile-ignore.txt 只能忽略还没有被同步的文件。对于已经被同步的文件,如果后来把它添加到 seafile-ignore.txt 中,系统只会忽略后续更改,已经上传的版本不会受影响。
|
||||||
|
|
||||||
|
### seafile-ignore.global.txt ###
|
||||||
|
|
||||||
|
# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步
|
||||||
|
*.sfignore
|
||||||
|
*.sfignore/
|
||||||
|
*.sfignore.*
|
||||||
|
*.sfignore.*/
|
||||||
|
*.sfomit
|
||||||
|
*.sfomit.*
|
||||||
|
*.sfomit/
|
||||||
|
*.sfomit.*/
|
||||||
|
*.nosf
|
||||||
|
*.nosf.*
|
||||||
|
*.nosf/
|
||||||
|
*.nosf.*/
|
||||||
|
|
||||||
|
## everything 'git pull or fetch' will update `.git/FETCH_HEAD`, even if the content doesn't change. To avoid too many useless updates of this file in Seafile history:
|
||||||
|
FETCH_HEAD
|
||||||
|
*/FETCH_HEAD
|
||||||
|
|
||||||
|
.Trash/
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
*/.DS_Store
|
||||||
|
|
||||||
|
.thumbnails
|
||||||
|
*/.thumbnails
|
||||||
|
|
||||||
|
Thumbs.db
|
||||||
|
*/Thumbs.db
|
||||||
|
thumbs.db
|
||||||
|
*/thumbs.db
|
||||||
|
|
||||||
|
_desktop.ini
|
||||||
|
*/_desktop.ini
|
||||||
|
|
||||||
|
._*
|
||||||
|
*/._*
|
||||||
|
|
||||||
|
.$*
|
||||||
|
*/.$*
|
||||||
|
|
||||||
|
~$*
|
||||||
|
*/~$*
|
||||||
|
|
||||||
|
node_modules/
|
||||||
|
*/node_modules/
|
||||||
|
package-lock.json
|
||||||
|
*/package-lock.json
|
||||||
|
|
||||||
|
pages4loader.json5
|
||||||
|
*/pages4loader.json5
|
||||||
|
|
||||||
|
.deploy_git/
|
||||||
|
*/.deploy_git/
|
||||||
|
|
||||||
|
# next.js 项目
|
||||||
|
.next/
|
||||||
|
*/.next/
|
||||||
|
|
||||||
|
# HBuilder 目录
|
||||||
|
unpackage/
|
||||||
|
*/unpackage/
|
||||||
|
|
||||||
|
Icon
|
||||||
|
OneDrive/Icon
|
||||||
|
|
||||||
|
# wrangler project
|
||||||
|
|
||||||
|
.dev.vars*
|
||||||
|
*/.dev.vars*
|
||||||
|
.wrangler/
|
||||||
|
*/.wrangler/
|
||||||
|
|
||||||
|
### seafile-ignore.local.txt ###
|
||||||
|
|
||||||
4
ssh.sh
4
ssh.sh
@@ -66,7 +66,7 @@ then
|
|||||||
port=22
|
port=22
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "::*** Coonecting to ${label}"
|
echo "::*** Connecting to ${label}"
|
||||||
if [ "$password" != "null" ]
|
if [ "$password" != "null" ]
|
||||||
then
|
then
|
||||||
if [ "$(which sshpass)" ]
|
if [ "$(which sshpass)" ]
|
||||||
@@ -75,7 +75,7 @@ then
|
|||||||
sshpass -p $password ssh -X -p $port "$username@$host" $2
|
sshpass -p $password ssh -X -p $port "$username@$host" $2
|
||||||
else
|
else
|
||||||
echo "::*** ssh -X -p $port $username@$host"
|
echo "::*** ssh -X -p $port $username@$host"
|
||||||
ssh -X -p $port "$username@$host" $2
|
ssh -X -p $port "$username@$host" $2 # -X 在 linux 安装 xrdp 后连接时报错,改 -Y 就可。
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "::*** ssh -X -p $port $username@$host"
|
echo "::*** ssh -X -p $port $username@$host"
|
||||||
|
|||||||
Reference in New Issue
Block a user