2020-03-08 02:56:58 +00:00
|
|
|
#!bash
|
|
|
|
|
2020-04-02 08:27:45 +00:00
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
echo "
|
|
|
|
"$0" -i|u [-b branch]
|
|
|
|
i a new install with empty config.
|
|
|
|
u update use exist config.
|
|
|
|
b install the branch after parameter b, default master
|
|
|
|
|
|
|
|
example:
|
|
|
|
"$0" -i
|
|
|
|
"$0" -u
|
|
|
|
"$0" -b master
|
2020-05-03 10:21:07 +00:00
|
|
|
"$0" -u -b master
|
2020-04-02 08:27:45 +00:00
|
|
|
"$0" -ib test
|
|
|
|
"
|
|
|
|
# exit
|
|
|
|
echo "###############
|
|
|
|
0, new install
|
|
|
|
1, update"
|
|
|
|
read -p "Input:" c
|
|
|
|
[ g"$c" == g"0" ] && install=1
|
|
|
|
[ g"$c" == g"1" ] && update=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
i=0
|
|
|
|
para[$i]=$0
|
|
|
|
for av in "$@"
|
|
|
|
do
|
|
|
|
#echo $av
|
|
|
|
((i++))
|
|
|
|
para[$i]=$av
|
|
|
|
if [ g"${av:0:1}" == g"-" ]; then
|
|
|
|
while [ g"$av" != g"" ]
|
|
|
|
do
|
|
|
|
ag=${av:0:1}
|
|
|
|
av=${av:1}
|
|
|
|
[ g"$ag" == g"b" ] && isbranch=1
|
|
|
|
[ g"$ag" == g"i" ] && install=1
|
|
|
|
[ g"$ag" == g"u" ] && update=1
|
|
|
|
done
|
|
|
|
else
|
|
|
|
if [ g"$isbranch" == g"1" ]; then
|
|
|
|
branch="-b $av"
|
|
|
|
isbranch=0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2020-04-02 08:33:55 +00:00
|
|
|
if [ g"$install" == g"1" -a g"$update" == g"1" ]; then
|
|
|
|
echo "Both install & update, exit"
|
|
|
|
exit
|
|
|
|
fi
|
2020-04-02 08:27:45 +00:00
|
|
|
if [ g"$install" != g"1" -a g"$update" != g"1" ]; then
|
|
|
|
echo "Not install & Not update, exit"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2020-03-08 02:56:58 +00:00
|
|
|
gitsource='https://github.com/qkqpttgf/OneManager-php'
|
|
|
|
|
2020-03-08 03:02:49 +00:00
|
|
|
OneManagerPath=`cd $(dirname $0);pwd -P`
|
|
|
|
cd ${OneManagerPath}
|
|
|
|
|
2020-04-02 08:27:45 +00:00
|
|
|
git clone ${branch} ${gitsource}
|
2020-11-07 09:05:07 +00:00
|
|
|
[ g"$install" == g"1" ] || \mv -b .data/config.php OneManager-php/.data/
|
2020-03-08 02:56:58 +00:00
|
|
|
\mv -b OneManager-php/* ./
|
|
|
|
\mv -b OneManager-php/.[^.]* ./
|
|
|
|
rm -rf *~
|
2020-11-17 15:22:56 +00:00
|
|
|
#rm -rf .[^.]*~
|
2020-03-08 02:56:58 +00:00
|
|
|
rm -rf OneManager-php
|
2020-11-17 15:22:56 +00:00
|
|
|
chmod 666 .data/config.php
|