Skip to content

Commit 6595747

Browse files
committed
fix cp in restore_backup
1 parent 0f90ecd commit 6595747

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

mytonctrl/scripts/restore_backup.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
name="backup.tar.gz"
22
mtc_dir="$HOME/.local/share/mytoncore"
33
ip=0
4+
user=$(logname)
45
# Get arguments
5-
while getopts n:m:i: flag
6+
while getopts n:m:i:u: flag
67
do
78
case "${flag}" in
89
n) name=${OPTARG};;
910
m) mtc_dir=${OPTARG};;
1011
i) ip=${OPTARG};;
12+
u) user=${OPTARG};;
1113
*)
1214
echo "Flag -${flag} is not recognized. Aborting"
1315
exit 1 ;;
@@ -38,9 +40,13 @@ if [ ! -d ${tmp_dir}/db ]; then
3840
fi
3941

4042
rm -rf /var/ton-work/db/keyring
41-
cp -rf ${tmp_dir}/db /var/ton-work
42-
cp -rf ${tmp_dir}/keys /var/ton-work
43-
cp -rfT ${tmp_dir}/mytoncore $mtc_dir
43+
44+
chown -R $user:$user ${tmp_dir}/mytoncore
45+
chown -R $user:$user ${tmp_dir}/keys
46+
47+
cp -rfp ${tmp_dir}/db /var/ton-work
48+
cp -rfp ${tmp_dir}/keys /var/ton-work
49+
cp -rfpT ${tmp_dir}/mytoncore $mtc_dir
4450

4551
chown -R validator:validator /var/ton-work/db/keyring
4652

mytoninstaller/settings.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -959,9 +959,6 @@ def ConfigureFromBackup(local):
959959
except:
960960
local.add_log("Can't get ip from validator", "error")
961961
return
962-
user = local.buffer.user
963-
args = ["chown", '-R', user + ':' + user, local.buffer.keys_dir]
964-
subprocess.run(args)
965962
set_external_ip(local, node_ip)
966963

967964

0 commit comments

Comments
 (0)