@@ -5,6 +5,7 @@ source ./plugins/colors-and-fun.sh
5
5
6
6
link=" https://github.com/RandomCoderOrg/ubuntu-arm64-qemu/releases/download/test-v01/qemu-ubuntu-18-test.tgz"
7
7
WORK_DIR=" ${HOME} /hippo-qemu"
8
+ curpwd=" $( pwd) "
8
9
9
10
if [ " $( id -u) " != 0 ]; then
10
11
if command -v sudo >> /dev/null 2>&1 ; then
14
15
15
16
function download()
16
17
{
17
- mkdir -p " $WORK_DIR "
18
- bash plugins/download.sh " ${link} "
18
+ if [ ! -f " ${HOME} /$( basename ${link} ) " ]; then
19
+ bash plugins/download.sh " ${link} "
20
+ mv " $( basename ${link} ) " " $HOME "
21
+ fi
19
22
}
20
23
21
24
function setup_dependencies()
@@ -30,28 +33,41 @@ function setup_dependencies()
30
33
31
34
function start_extract_sequence()
32
35
{
33
- cd " $WORK_DIR " || die " failed.."
34
- tar -xf " $WORK_DIR /$( basename ${link} ) "
35
- FILE_BUFFER=" $( ls " $WORK_DIR " ) "
36
+ tar -xf " ${HOME} " /" $( basename ${link} ) " -C " $HOME "
36
37
37
- for item in $FILE_BUFFER ; do
38
- lz4 -d " $item " " $( cut -d " ." -f -2 " $item " ) "
38
+ cd " $WORK_DIR " || die " Failed"
39
+ for item in $( ls) ; do
40
+ lz4 -d " $item " " $( echo " $item " | cut -d " ." -f -2) " || die " failed.."
39
41
rm -rf " $item "
40
42
done
41
- cd ..
43
+ # cd "${curpwd}" || die "failed.."
42
44
}
43
45
46
+ function cleanup()
47
+ {
48
+ msg " \nCleanUp.."
49
+ lwarn " Removing $WORK_DIR "
50
+ rm -rvf " $WORK_DIR "
51
+ msg " Done.."
52
+ }
53
+
54
+ trap ' cleanup; exit 1;' HUP INT TERM
55
+
44
56
shout " making sure of dependencies..."
45
57
setup_dependencies
46
58
lshout " Done"
59
+
47
60
shout " Downloading..."
48
61
download
49
62
msg " Done"
63
+
50
64
shout " Starting extraction..."
51
65
lshout " This may take a while"
52
66
start_extract_sequence
53
67
msg " Done"
68
+
54
69
msg " Setting up boot.sh.."
55
- cp boot.sh " $WORK_DIR "
70
+ cp " ${curpwd} " / boot.sh " $WORK_DIR "
56
71
msg " Done"
72
+
57
73
shout " Now you can start ubuntu with command ${GREEN}${WORK_DIR} /boot.sh${DC} "
0 commit comments