Skip to content

Commit 46bd164

Browse files
authored
Merge pull request #407 from yungwine/update
improve update and upgrade
2 parents 5294f12 + a7c6c02 commit 46bd164

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

mytonctrl/scripts/update.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ author="ton-blockchain"
1212
repo="mytonctrl"
1313
branch="master"
1414
srcdir="/usr/src/"
15-
bindir="/usr/bin/"
15+
tmpdir="/tmp/mytonctrl_src/"
1616

1717
# Get arguments
1818
while getopts a:r:b: flag
@@ -28,16 +28,18 @@ done
2828
COLOR='\033[92m'
2929
ENDC='\033[0m'
3030

31-
# Go to work dir
32-
cd ${srcdir}
31+
mkdir -p ${tmpdir}
32+
cd ${tmpdir}
33+
rm -rf ${tmpdir}/${repo}
34+
echo "https://github.com/${author}/${repo}.git -> ${branch}"
35+
git clone --recursive https://github.com/${author}/${repo}.git || exit 1
3336

34-
# uninstall previous version
3537
rm -rf ${srcdir}/${repo}
3638
pip3 uninstall -y mytonctrl
3739

3840
# Update code
39-
echo "https://github.com/${author}/${repo}.git -> ${branch}"
40-
git clone --recursive https://github.com/${author}/${repo}.git
41+
cd ${srcdir}
42+
cp -rf ${tmpdir}/${repo} ${srcdir}
4143
cd ${repo} && git checkout ${branch}
4244
pip3 install -U .
4345

mytonctrl/scripts/upgrade.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ repo="ton"
1313
branch="master"
1414
srcdir="/usr/src/"
1515
bindir="/usr/bin/"
16+
tmpdir="/tmp/ton_src/"
1617

1718
# Get arguments
1819
while getopts a:r:b: flag
@@ -59,13 +60,18 @@ else
5960
opensslPath=${bindir}/openssl_3
6061
fi
6162

63+
rm -rf ${tmpdir}/${repo}
64+
mkdir -p ${tmpdir}/${repo}
65+
cd ${tmpdir}/${repo}
66+
echo "https://github.com/${author}/${repo}.git -> ${branch}"
67+
git clone --recursive https://github.com/${author}/${repo}.git . || exit 1
68+
6269
# Go to work dir
6370
cd ${srcdir}/${repo}
6471
ls -A1 | xargs rm -rf
6572

6673
# Update code
67-
echo "https://github.com/${author}/${repo}.git -> ${branch}"
68-
git clone --recursive https://github.com/${author}/${repo}.git .
74+
cp -rfT ${tmpdir}/${repo} .
6975
git checkout ${branch}
7076

7177
git submodule sync --recursive

0 commit comments

Comments
 (0)