git服务器迁移到美国凤凰城后第一次提交

This commit is contained in:
陆柯 2023-03-05 15:23:46 +08:00
parent 2657f84c2c
commit dd3c8ab167
12 changed files with 113 additions and 44 deletions

View File

@ -3,7 +3,7 @@
echo "Thanks https://github.com/bohanyang/debi"
echo
echo "=== Enter debian version [8,9,10,11,12] or [leave blank] for 11"
echo "=== Enter debian version [8,9,10,11] or [leave blank] for 11"
read -p ">>> " DEBIAN_VERSION
if [ -z "${DEBIAN_VERSION}" ]
then
@ -28,5 +28,5 @@ sudo curl -fLO https://raw.githubusercontent.com/bohanyang/debi/master/debi.sh
sudo chmod a+rx debi.sh
sudo ./debi.sh --version $DEBIAN_VERSION --architecture $DEBIAN_ARCH --user root --$PRESET # --architecture 可参略,默认为 amd64--password 可省略,则脚本启动后会问你要密码
echo "=== Shutdown now, wait for about 30 seconds, then try to ssh"
echo "=== Shutdown now, wait for about 30 minutes (the project's github says 30 seconds), then try to ssh"
sudo shutdown -r now

View File

@ -1,14 +1,26 @@
#!/bin/bash
echo "in [RepoRoot]/*/*/hooks/[pre|update|post]-receive.d/*, path is hard-coded in full such as `/faronear/git/gitea/custom/conf/app.ini`, you need to replace it if the path is changed."
read -p "Enter old hook path: >> " OLDPATH
read -p "Enter new hook path: >> " NEWPATH
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':"
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
if [ ! "$NEWPATH" ]
then
NEWPATH=/usr/local/bin/gitea
fi
read -p "Enter repository root path: >> " REPOROOT
sed -i "s:$OLDPATH:$NEWPATH:g" `grep "$OLDPATH" -rl $REPOROOT/*/*/hooks/`
# 用 : 来取代 /,以避免大量出现 \/
# sed -i "s/\/home\/fon\//\/root\//g" `grep '/home/fon' -rl git.repo/*/*/hooks/*.d/gitea`
sed -i "s:$OLDPATH:$NEWPATH:g" `grep "$OLDPATH" -rl $REPOROOT/*/*/hooks/*.d/gitea`
echo "Completed replacing $OLDPATH to $NEWPATH recursively in folder $REPOROOT"
# 参数 -i 代表在文件里直接替换。但发现在 MacOS 里这会报错,在 Debian 里没问题。
# 可以用 : 来取代 /,以避免大量出现 \/
# sed -i "s/\/home\/fon\//\/root\//g" `grep '/home/fon' -rl git.repo/*/*/hooks`

View File

@ -107,7 +107,7 @@ then
mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-$(date +%Y%m%dT%H%M%S)
fi
echo "=== Append or link or omit [$HomePath/.ssh/authorized_keys] to config ssh server? <a> for append, <l> for link, <<anything else>> for omit:"
echo "=== Append or link or omit [$HomePath/.ssh/authorized_keys] to config ssh server? <a> for append, <l> for link, <anything else> for omit:"
read -p ">>> " CopyOrLinkOrOmitAuthorizedKeys
if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ]

View File

@ -51,16 +51,17 @@ alias emacst='emacs -nw'
alias myip='ifconfig | grep netmask'
# Always list long directory and time.
# Set aliases
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias su='su -'
if [[ "$(uname)" = "Darwin" ]];
then
alias l='ls -lG'
alias ll='ls -lGA' # show .xxx
alias dir='ls -lGA'
alias lll='ls -lGa' # show .xxx and . and ..
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias sedi='sed -i ""'
export HOMEBREW_NO_AUTO_UPDATE=true
export BASH_SILENCE_DEPRECATION_WARNING=1
@ -69,9 +70,6 @@ else
alias ll='ls -lA --color=auto'
alias dir='ls -lA --color=auto'
alias lll='ls -la --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias sedi='sed -i'
export TIME_STYLE='+%Y-%m-%d--%H:%M:%S'
fi
@ -165,6 +163,7 @@ tp3=/faronear/fon/sysconfig
tp4=/faronear/fon.git/sysconfig
tp5=/mnt/c/faronear/fon.git/sysconfig
tp6=/mnt/d/faronear/fon.git/sysconfig
tp7=/faronear/sysconfig
if [ -d $tp1 ]
then
export PATH=$tp1:$PATH
@ -183,6 +182,9 @@ then
elif [ -d $tp6 ]
then
export PATH=$tp6:$PATH
elif [ -d $tp7 ]
then
export PATH=$tp7:$PATH
fi
if [ -f ~/.bashrc_custom ]

7
nixhome/.npmrc_taobao Normal file
View File

@ -0,0 +1,7 @@
registry=https://registry.npm.taobao.org
## npm config set registry https://registry.npm.taobao.org
## npm config set registry https://registry.npmjs.org
## npm config get registry
## npm config ls -l
## npm --registry registry https://registry.npm.taobao.org ...

View File

@ -1,17 +1,22 @@
## 注意,这个安装脚本先会查看 NVM_DIR。如果是从其他用户 `su` 过来的,继承了这个变量 NVM_DIR=/home/原用户/.nvm导致无法安装在当前 root 用户下。
## 因此要么 `su -` 要么不使用安装脚本,而是直接执行脚本里的真正安装动作,即 git clone
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
# pushd /faronear/fon/sysconfig
# # 取消被默认添加到 .bashrc 的设置already integrated in .bashrc
## Add these lines to your launch script such as .bashrc :
## '########################################################################'
## 'export NVM_DIR="$HOME/.nvm"'
## '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"'
## '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"'
## '########################################################################'
## 取消被默认添加到 .bashrc 的设置already integrated in nixhome/.bashrc
# pushd /faronear/sysconfig
# git reset . && git checkout .
# popd
# 注意,这个安装脚本先会查看 NVM_DIR。如果是从其他用户 `su` 过来的,继承了这个变量 NVM_DIR=/home/原用户/.nvm导致无法安装在当前 root 用户下。
# 因此要么 `su -` 要么不使用安装脚本,而是直接执行脚本里的真正安装动作,即 git clone
git clone https://github.com/nvm-sh/nvm.git ~/.nvm
echo Add these lines to your launch script such as .bashrc :
echo '########################################################################'
echo 'export NVM_DIR="$HOME/.nvm"'
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"'
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"'
echo '########################################################################'
echo If in China, set mirror before nvm install
echo ########################################################################
echo export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
echo ########################################################################

View File

@ -1,2 +0,0 @@
set http_proxy=
set https_proxy=

View File

@ -1,7 +0,0 @@
set HTTP_PROXY=http://127.0.0.1:41091
@REM set HTTP_PROXY_USER=username
@REM set HTTP_PROXY_PASS=password
set HTTPS_PROXY=http://127.0.0.1:41091
@REM set HTTPS_PROXY_USER=username
@REM set HTTPS_PROXY_PASS=password

30
proxy.bat Normal file
View File

@ -0,0 +1,30 @@
@REM 在 powershell 里,只要 ssr 打开全局模式,不需要设置 proxy 就可以。
@REM 在 cmd 里,需要设置 proxy 才可以。
echo === Enter [s] to start, [t] to terminate or [anything else] for no change
set /p TODOMODE=">>> "
echo;
if "s" == "%TODOMODE%" (
set ALL_PROXY=socks5://127.0.0.1:1080
echo "--- 已开启网络代理"
) else if "t" == "%TODOMODE%" (
set all_proxy=
set http_proxy=
set https_proxy=
echo "--- 已关闭网络代理"
) else (
echo No change.
)
@REM 测试 ip.gs, ip.sb, ipinfo.io
curl ipinfo.io
@REM set HTTP_PROXY=socks5://127.0.0.1:1080
@REM set HTTP_PROXY_USER=username
@REM set HTTP_PROXY_PASS=password
@REM set HTTPS_PROXY=socks5://127.0.0.1:1080
@REM set HTTPS_PROXY_USER=username
@REM set HTTPS_PROXY_PASS=password

View File

@ -1,15 +1,15 @@
#!/bin/bash
function proxy(){
echo "=== 开启或关闭网络代理? u for up, d for down, anything else for no change."
echo "=== 开启或关闭网络代理? s for start, t for terminate, anything else for no change."
read -p ">>> " proxySwitch
if [ $proxySwitch ] && [ $proxySwitch == "u" ]
if [ $proxySwitch ] && [ $proxySwitch == "s" ]
then
export ALL_PROXY=socks5://127.0.0.1:1090
export http_proxy=http://127.0.0.1:41091
export https_proxy=https://127.0.0.1:41091
export ALL_PROXY=socks5://127.0.0.1:1086
export http_proxy=http://127.0.0.1:8090
export https_proxy=https://127.0.0.1:8090
echo -e "--- 已开启网络代理"
elif [ $proxySwitch ] && [ $proxySwitch == "d" ]
elif [ $proxySwitch ] && [ $proxySwitch == "t" ]
then
unset ALL_PROXY
unset http_proxy
@ -18,5 +18,9 @@ function proxy(){
else
echo "--- Nothing changed."
fi
echo 测试 ip.gs, ip.sb, ipinfo.io
curl ipinfo.io
}
proxy

0
remote-sync.sh → rsync-folder.sh Executable file → Normal file
View File

View File

@ -9,6 +9,24 @@ unzip ssr.zip
cd SSR*
bash install.sh
# if [ "$1" ]
# then
# KEYCODE=$1
# else
# KEYCODE=44444
# fi
# USERNAME=$KEYCODE
# PORT=$KEYCODE
# PASSWORD=$KEYCODE
# ENCRYPTION=5
# PROTOCOL=4
# OBFS=4
# ORIGINAL_OBFS=n
# QUOTA=1000
# SPEEDLIMIT=n
# echo -e "2\n1\n$USER\n$PORT\n$PASSWORD\$ENCRYPTION\n$PROTOCOL\n\$OBFS\n$ORIGINAL_OBFS\n$QUOTA\n$SPEEDLIMIT\n" | ssr
## 报错,不能这样调用
# [2020-02-13] 以下标准安装脚本无法使用,因为里面调用 http:// 但是现已转为 https://
# wget https://www.gigsgigscloud.com/cn/downloads/ssr.sh --no-check-certificate
# sudo bash ssr.sh