Compare commits
2 Commits
746970f1ff
...
f0a723e35e
| Author | SHA1 | Date | |
|---|---|---|---|
| f0a723e35e | |||
| a8d4e82d0b |
54
git-push-all.sh
Executable file
54
git-push-all.sh
Executable file
@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ $1 ]
|
||||||
|
then
|
||||||
|
FONPATH=$1
|
||||||
|
else
|
||||||
|
echo Leave blank for default [/faronear], [~/faronear], [.],
|
||||||
|
read -p "or enter faronear path to git push >> " FONPATH
|
||||||
|
if [ ! $FONPATH ]
|
||||||
|
then
|
||||||
|
if [ -d /faronear ]
|
||||||
|
then
|
||||||
|
FONPATH=/faronear
|
||||||
|
else
|
||||||
|
if [ -d ~/faronear ]
|
||||||
|
then
|
||||||
|
FONPATH=~/faronear
|
||||||
|
else
|
||||||
|
FONPATH=.
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d $FONPATH ]
|
||||||
|
then
|
||||||
|
echo "*** [$FONPATH] not exist! Exit now. ***"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd $FONPATH
|
||||||
|
echo "*** Current path = [`pwd`] ***"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
|
||||||
|
ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
|
||||||
|
do
|
||||||
|
echo "======== entering [$FONPATH/$org] ========"
|
||||||
|
echo ""
|
||||||
|
cd "$org";
|
||||||
|
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
|
||||||
|
do
|
||||||
|
if [ -d "$repo/.git" ]
|
||||||
|
then
|
||||||
|
echo "---- git pushing [`pwd`/$repo] ----"
|
||||||
|
cd "$repo"
|
||||||
|
git push
|
||||||
|
echo ""
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cd ..
|
||||||
|
done
|
||||||
|
popd
|
||||||
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "in [RepoRoot]/*/*/hooks/post-receive & pre-receive, gogs is hard-coded with full path such as /faronear/git/gogs, you need to replace it if the path is changed."
|
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 old hook path: >> " OLDPATH
|
||||||
read -p "Enter new hook path: >> " NEWPATH
|
read -p "Enter new hook path: >> " NEWPATH
|
||||||
read -p "Enter repository root path: >> " REPOROOT
|
read -p "Enter repository root path: >> " REPOROOT
|
||||||
@ -13,3 +13,6 @@ get_char()
|
|||||||
|
|
||||||
echo "Press any key to exit!"
|
echo "Press any key to exit!"
|
||||||
char=`get_char`
|
char=`get_char`
|
||||||
|
|
||||||
|
# read -p "press Enter to exit!"
|
||||||
|
# echo "Bye!"
|
||||||
22
proxy.sh
Executable file
22
proxy.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function proxy(){
|
||||||
|
echo "=== 开启或关闭网络代理? u for up, d for down, anything else for no change."
|
||||||
|
read -p ">>> " proxySwitch
|
||||||
|
if [ $proxySwitch ] && [ $proxySwitch == "u" ]
|
||||||
|
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
|
||||||
|
echo -e "--- 已开启网络代理"
|
||||||
|
elif [ $proxySwitch ] && [ $proxySwitch == "d" ]
|
||||||
|
then
|
||||||
|
unset ALL_PROXY
|
||||||
|
unset http_proxy
|
||||||
|
unset https_proxy
|
||||||
|
echo -e "--- 已关闭网络代理"
|
||||||
|
else
|
||||||
|
echo "--- Nothing changed."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
proxy
|
||||||
Loading…
Reference in New Issue
Block a user