Skip to content

Commit 0a704b0

Browse files
fixup paths
1 parent 2522548 commit 0a704b0

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

udroid/src/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
BIN="$PREFIX/bin"
44
INSTALL_DIR="${PREFIX}/etc/udroid"
55

6-
DEFAULT_ROOT="${PREFIX}/var/lib/udroid"
7-
DEFAULT_FS_INSTALL_DIR="${FS_DIR}/installed_fs"
6+
DEFAULT_ROOT="${PREFIX}/usr/var/lib/udroid"
7+
DEFAULT_FS_INSTALL_DIR="${DEFAULT_ROOT}/installed-filesystems"
88
DLCACHE="${DEFAULT_ROOT}/dlcache"
99
RTCACHE="${RTR}/.cache"
1010

udroid/src/udroid.sh

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ source gum_wrapper.sh
99
export distro_data
1010

1111
RTR="${PREFIX}/etc/udroid"
12-
DEFAULT_ROOT="${PREFIX}/var/lib/udroid"
13-
DEFAULT_FS_INSTALL_DIR="installed-filesystems"
14-
DLCACHE="${TODO_DIR}/dlcache"
12+
DEFAULT_ROOT="${PREFIX}/usr/var/lib/udroid"
13+
DEFAULT_FS_INSTALL_DIR="${DEFAULT_ROOT}/installed-filesystems"
14+
DLCACHE="${DEFAULT_ROOT}/dlcache"
1515
RTCACHE="${RTR}/.cache"
1616

1717
fetch_distro_data() {
@@ -31,14 +31,32 @@ fetch_distro_data() {
3131
}
3232

3333
install() {
34-
local arg=$1
34+
###
35+
# install()
36+
#
37+
# stages:
38+
# 1) take the arguments supplied ( i.e "arg"->$1 and "path"->$2 )
39+
# 2) parse the arg for suite and varient
40+
# 2-1) if suite or varient is null (i.e not supplied) the try to prompt by guessing it with avalible arguments
41+
# 3) parse the download link from json ( if null exit )
42+
# 4) Extract the filesystem to target path
43+
# 5) execute fixes file
44+
45+
local arg=$1; shift 1
3546
local path=""
3647
local suite=${arg%%:*}
3748
local varient=${arg#*:}
3849

3950
while [[ $# -gt 0 ]]; do
4051
case $1 in
4152
-p | --path)
53+
54+
# Custom paths are set either to point a new directory instead of default
55+
# this is not-recommended cause managing installed filesystems becomes harder when they are outside of DEFAULT directories
56+
# operations like: remove, reset or analyzing filesystems
57+
# using custom path results in abonded installation -> script only cares when its path is supplied again
58+
#
59+
# possible solution is to cache the loaction every time a path is supplied and use that for operations
4260
shift
4361
local path=$1
4462
LOG "(install) custom installation path set to $path"
@@ -48,6 +66,8 @@ install() {
4866
done
4967

5068
LOG "[USER] function args => suite=$suite varient=$varient"
69+
70+
# if TEST_MODE is set run scripts in current directory and use test.json for distro_conf
5171
[[ -n $TEST_MODE ]] && {
5272
LOG "[TEST] test mode enabled"
5373
distro_data=test.json
@@ -128,6 +148,12 @@ install() {
128148
echo "Report this issue at https://github.com/RandomCoderOrg/ubuntu-on-android/issues"
129149
exit 1
130150
}
151+
if [[ -d $DEFAULT_FS_INSTALL_DIR/$name ]]; then
152+
ELOG "filesystem already installed"
153+
echo "filesystem already installed ."
154+
# [TODO]: write about reset and remove
155+
exit 1
156+
fi
131157

132158
# file extension
133159
ext=$(echo $link | awk -F. '{print $NF}')
@@ -173,7 +199,8 @@ download() {
173199
[[ -z $path ]] && path="$DLCACHE"
174200

175201
LOG "download() args => name=$name link=$link path=$path"
176-
axel -a -o ${path}/$name $link || {
202+
203+
wget -q --show-progress --progress=bar:force -o ${path}/$name "$link" 2>&1 | progressfilt || {
177204
ELOG "failed to download $name"
178205
echo "failed to download $name"
179206
exit 1

0 commit comments

Comments
 (0)