-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall_macos.sh
50 lines (42 loc) · 1.16 KB
/
install_macos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
function PROCESS_ALIAS()
{
local aliasName="alias.$(basename $1).$(basename $2)";
local aliasName=${aliasName/".sh"/""}
local gitCmd="git config --global --unset-all $aliasName"
echo $gitCmd >> temp_install.bash
local filename="$(pwd)/$2"
local aliasCmd="!func() { bash $filename \\\$@; }; func"
local gitCmd="git config --global --replace-all $aliasName \"$aliasCmd\" "
echo $gitCmd >> temp_install.bash
}
function PROCESS_BAT()
{
local filename="$(pwd)/$2"
echo "" >> temp_install.bash
cat $filename >> temp_install.bash
echo "" >> temp_install.bash
}
set +v
rm -Rf ~/gitflow/
mkdir ~/gitflow/
cp -f HELP.md ~/gitflow/
cp -Rf config ~/gitflow/config/
cp -Rf modules ~/gitflow/modules/
cp -Rf aliases ~/gitflow/aliases/
pushd ~/gitflow/
echo "#!/bin/bash" > temp_install.bash
for A in aliases/*; do
if [ -d "${A}" ]; then
for S in "${A}"/*.sh; do
[ -e "$S" ] || continue
PROCESS_ALIAS "${A}" "${S}";
done
for B in "${A}"/*.bat; do
[ -e "$B" ] || continue
PROCESS_BAT "${A}" "${B}";
done
fi
done
bash temp_install.bash
popd