Skip to content

Commit beea3d9

Browse files
fixed scripts
1 parent e1ccec7 commit beea3d9

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

Diff for: install.sh

+25-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ source ./plugins/colors-and-fun.sh
55

66
link="https://github.com/RandomCoderOrg/ubuntu-arm64-qemu/releases/download/test-v01/qemu-ubuntu-18-test.tgz"
77
WORK_DIR="${HOME}/hippo-qemu"
8+
curpwd="$(pwd)"
89

910
if [ "$(id -u)" != 0 ]; then
1011
if command -v sudo >> /dev/null 2>&1; then
@@ -14,8 +15,10 @@ fi
1415

1516
function download()
1617
{
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
1922
}
2023

2124
function setup_dependencies()
@@ -30,28 +33,41 @@ function setup_dependencies()
3033

3134
function start_extract_sequence()
3235
{
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"
3637

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.."
3941
rm -rf "$item"
4042
done
41-
cd ..
43+
# cd "${curpwd}" || die "failed.."
4244
}
4345

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+
4456
shout "making sure of dependencies..."
4557
setup_dependencies
4658
lshout "Done"
59+
4760
shout "Downloading..."
4861
download
4962
msg "Done"
63+
5064
shout "Starting extraction..."
5165
lshout "This may take a while"
5266
start_extract_sequence
5367
msg "Done"
68+
5469
msg "Setting up boot.sh.."
55-
cp boot.sh "$WORK_DIR"
70+
cp "${curpwd}"/boot.sh "$WORK_DIR"
5671
msg "Done"
72+
5773
shout "Now you can start ubuntu with command ${GREEN}${WORK_DIR}/boot.sh${DC}"

0 commit comments

Comments
 (0)