forked from PeterSuh-Q3/tinycore-redpill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mvapp.sh
executable file
·77 lines (62 loc) · 2.08 KB
/
mvapp.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
echo "Prepare Make Direcrtory for volume$2"
[ ! -d /volume$2/\@appstore/ ] && mkdir /volume$2/\@appstore/
[ ! -d /volume$2/\@apphome/ ] && mkdir /volume$2/\@apphome/
[ ! -d /volume$2/\@apptemp/ ] && mkdir /volume$2/\@apptemp/
[ ! -d /volume$2/\@appdata/ ] && mkdir /volume$2/\@appdata/
[ ! -d /volume$2/\@appconf/ ] && mkdir /volume$2/\@appconf/
echo
for app in $(ls /volume$1/\@appstore); do
echo
echo "Stopping Package $app"
if [ $app = "Docker" ]; then
for cont in $(docker ps -q); do
echo "Stopping Docker Container $cont"
docker stop $cont
done
fi
synopkg stop $app
sleep 3
done
for app in $(ls /volume$1/\@appstore); do
if [ $app = "Docker" ]; then
echo "=> skip coping docker folder..."
continue
# echo "=>coping docker folder..."
# rsync -av /volume$1/\@docker /volume$2/\@docker
fi
echo
echo "Moving $app from volume$1 to volume$2"
echo "=>moving appstore for $app"
mv /volume$1/\@appstore/$app /volume$2/\@appstore/.
echo "=>moving apphome for $app"
mv /volume$1/\@apphome/$app /volume$2/\@apphome/.
echo "=>moving apptemp for $app"
mv /volume$1/\@apptemp/$app /volume$2/\@apptemp/.
echo "=>moving appdata for $app"
mv /volume$1/\@appdata/$app /volume$2/\@appdata/.
echo "=>moving appconf for $app"
mv /volume$1/\@appconf/$app /volume$2/\@appconf/.
echo
cd /var/packages/$app/
echo "=== Link Before ==="
ls -list target home tmp var etc
rm -f etc;ln -s /volume$2/\@appconf/$app etc
rm -f home;ln -s /volume$2/\@apphome/$app home
rm -f target;ln -s /volume$2/\@appstore/$app target
rm -f tmp;ln -s /volume$2/\@apptemp/$app tmp
rm -f var;ln -s /volume$2/\@appdata/$app var
echo
echo "Starting Package $app"
synopkg start $app
sleep 3
echo
echo "=== Link After ==="
ls -list target home tmp var etc
echo
echo "=== Left ==="
ls /volume$1/\@appstore
echo
echo "======================================================="
done
echo "=== DONE ==="