Skip to content

Commit c3ab243

Browse files
Merge pull request #42 from ThatMG393/experimental
(experimental): fix supported variant logic, added some info when ins…
2 parents 115adf5 + f8152b7 commit c3ab243

File tree

1 file changed

+23
-28
lines changed

1 file changed

+23
-28
lines changed

udroid/src/udroid.sh

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,11 @@ install() {
202202

203203
# final checks
204204
[[ "$link" == "null" ]] && {
205-
ELOG "link not found for $suite:$varient"
205+
ELOG "link not found for $suite:$varient on $arch"
206206
echo "ERROR:"
207-
echo "link not found for $suite:$varient"
208-
echo "either the suite or varient is not supported or invalid options supplied"
207+
echo "link not found for $suite:$varient on $arch"
208+
echo "either the suite or varient is invalid, is not supported, or invalid options are supplied"
209+
# echo "either the suite or varient is not supported or invalid options supplied"
209210
echo "Report this issue at https://github.com/RandomCoderOrg/ubuntu-on-android/issues"
210211
exit 1
211212
}
@@ -757,8 +758,8 @@ login() {
757758
parser() {
758759
local arg=$1
759760
local mode=$2
760-
local suite=${arg%%:*}
761-
local varient=${arg#*:}
761+
readonly suite=${arg%%:*} # readonly basically makes this public and
762+
readonly varient=${arg#*:} # unchangeable outside of this function
762763

763764
LOG "[USER] function args => suite=$suite varient=$varient"
764765

@@ -832,14 +833,6 @@ parser() {
832833
############### END OF OPTION PARSER ##############
833834

834835
# Finally to get link
835-
836-
# arch transition
837-
case $(dpkg --print-architecture) in
838-
arm64 | aarch64) arch=aarch64 ;;
839-
arm | armhf | armv7l | armv8l) arch=armhf ;;
840-
x86_64| amd64) arch=amd64;;
841-
*) die "unsupported architecture" ;;
842-
esac
843836

844837
link=$(cat $distro_data | jq -r ".$suite.$varient.${arch}url")
845838
LOG "link=$link"
@@ -880,22 +873,16 @@ list() {
880873
tempfile=$(mktemp udroid-list-table-XXXXXX)
881874

882875
if $size; then
883-
_size_header=" size |"
884-
_size_line="--|"
885-
else
886-
_size_header=""
887-
_size_line=""
876+
_size_header+=" size |"
877+
_size_line+="--|"
888878
fi
889879

890880
if $show_remote_download_size; then
891-
_r_size_header=" down* size |"
892-
_r_size_line="--|"
893-
else
894-
_r_size_header=""
895-
_r_size_line=""
881+
_r_size_header+=" down* size |"
882+
_r_size_line+="--|"
896883
fi
897884

898-
echo -e "reading data ( This a may take a minute ) ..."
885+
echo -e "reading data ( this may take a couple minutes ) ..."
899886

900887
# header
901888
echo -e "| suites | supported | status |$_size_header$_r_size_header" > $tempfile
@@ -908,18 +895,17 @@ list() {
908895
# get name
909896
name=$(cat $distro_data | jq -r ".$suite.$varient.Name")
910897
supported_arch=$(cat $distro_data | jq -r ".$suite.$varient.arch")
911-
host_arch=$(dpkg --print-architecture)
912898

913-
LOG "list(): host_arch=$host_arch ||| supported_arch=$supported_arch"
914-
if [[ $host_arch =~ $supported_arch ]]; then
899+
LOG "list(): suite=$suite ||| varient=$varient ||| arch=$arch ||| supported_arch=$supported_arch"
900+
if [[ $supported_arch =~ $arch ]]; then
915901
supported=true
916902
else
917903
supported=false
918904
fi
919905

920906
if $supported; then
921907
if $show_remote_download_size; then
922-
link=$(cat $distro_data | jq -r ".$suite.$varient.${host_arch}url")
908+
link=$(cat $distro_data | jq -r ".$suite.$varient.${arch}url")
923909
remote_size=$( wget --spider -m -np $link 2>&1 | grep -i Length | awk '{print $2}')
924910
if [[ -z $remote_size ]]; then
925911
remote_size="?"
@@ -1244,6 +1230,15 @@ if [ $# -eq 0 ]; then
12441230
exit 1
12451231
fi
12461232

1233+
# move it to here
1234+
# so it can be used anywhere
1235+
case $(dpkg --print-architecture) in
1236+
arm64 | aarch64) arch=aarch64 ;;
1237+
arm | armhf | armv7l | armv8l) arch=armhf ;;
1238+
x86_64| amd64) arch=amd64;;
1239+
*) die "unsupported architecture" ;;
1240+
esac
1241+
12471242
while [ $# -gt 0 ]; do
12481243
case $1 in
12491244
help | --help|-h) shift 1; help_root; break ;;

0 commit comments

Comments
 (0)