Manjaro-chroot fix

Hi,

manjaro-chroot has had a bug for long time, where in UEFI mode it shows the wrong numbers for the systems it founds. I made a simple patch for that and tried to make a pull request or at least that some Manjaro developer take a look at it in the gitlab, but without luck.

So maybe here it’s different. Here my the patch for development-tools/manjaro-tools/lib/util-mount.sh:

diff --git a/lib/util-mount.sh b/lib/util-mount.sh
index 1897e4d..a707cb7 100644
--- a/lib/util-mount.sh
+++ b/lib/util-mount.sh
@@ -45,33 +45,31 @@ chroot_part_mount() {
 }
 
 select_os(){
-        local os_list=( $(detect) ) count=${#os_list[@]}
+    local detected_os_list=( $(detect) ) os_list=() count select os_str os_root
+    for os in ${detected_os_list[@]}; do
+        case ${os##*:} in
+            'linux') os_list+=($os)
+        esac
+    done
+    count=${#os_list[@]}
+    if [[ ${count} < 1 ]]; then
+        die "No Linux partitions detected!"
+    fi
     if [[ ${count} > 1 ]]; then
-                msg "Detected systems:"
-                local i=0
-                for os in ${os_list[@]}; do
-            local last=${os##*:}
-            case $last in
-                'efi') count=$((count-1)) ;;
-                *) info "$i) $(get_os_name $os)"; i=$((i+1)) ;;
-            esac
-                done
-                i=0
+        msg "Detected systems:"
+        local i=0
+        for os in ${os_list[@]}; do
+            info "$i) $(get_os_name $os)"; i=$((i+1))
+        done
         msg "Select system to mount [0-%s] : " "$((count-1))"
-                read select
-        else
+        read select
+    else
         select=0
     fi
-    local os_str=${os_list[$select]} type
-    type=$os_str
-    root=${os_str%%:*}
-    type=${type##*:}
-        if [[ "${type##*:}" == 'linux' ]]; then
-        msg "Mounting (%s) [%s]" "$(get_os_name $os_str)" "$root"
-        chroot_mount_partitions "$1" "$root"
-        else
-                die "You can't mount %s!" "$select"
-        fi
+    os_str=${os_list[$select]}
+    os_root=${os_str%%:*}
+    msg "Mounting (%s) [%s]" "$(get_os_name $os_str)" "$os_root"
+    chroot_mount_partitions "$1" "$os_root"
 }
 
 chroot_mount_partitions(){

Probably there is a lot to improve in all those scripts, but I just want to fix this, so it’s easier to help other users in the forums when they have to chroot to their systems. Could it be? :relaxed:

7 Likes

Thanks for turning your attention to this irritating bug. Just for completeness sake, I’m linking your (almost 4 momths old !) comment on the gitlab bug issue:

1 Like

funny. I posted similar fix:


But … your solution looks like it might be better … I just hacked at the listing.

1 Like

This is an old problem going back at least to 2017 (Edit: as noted in post 3 fix link!) Back then there was some kind of issue between legacy and uefi systems. The selections worked for BIOS systems but were offset for UEFI. Would be great to see this repair implemented.

Yes, I just noticed your post. But it seems that it neither went far? I mean, do you know got it the attention of the devs?

And about the fix, yes, I tried to fix the systems list creation instead of hacking it.

1 Like

A number know like chrys or eugen … but people who ‘matter’ and can change it like oberon or phil … havent even acknowledged it yet … so I guess we will see?

It seems that nobody is in charge of that branch but it’s sadder to see that nobody seems to care.

I would be glad to help on that even if I’m not bash master (because anyway that’s better than no one). But obviously I’m nobody here. It would be great if at least users can send pull requests. I’m not sure why the gitlab is for devs only when open source is about collaborating…

4 Likes

For what its worth its my understanding people are rather busy right now.

I think “right now” has been for a couple of years :smile:. At least that’s what I have understood (I have been full-time Manjaro user less than a year).

I don’t know about Manjaro politics, but wouldn’t be possible to open the door to more user collaboration? And I don’t mean necessarily adding more devs (that can also be good) but at least accepting fixes and patching from users.

2 Likes

subject here

1 Like

2 posts were merged into an existing topic: Lowering the threshold of contributing

Thanks @papajoke and @codesardine for the link!

Thank you @cfinnberg for a patch… you are right this Is a very old issue… the problem of contributions Is still present as we move to our self gitlab instance. A solution can be mirroring our repository from gitlab or GitHub or another Git service to Easy fork access. This Is what plus or Minus what gnome do for the contributions… anyway you or another contributor can ping a core dev to a post where submit a patch or other things and also can use the snippets function of gitlab but since we can post the notifications i suggest to ping manjaro team then One can look at this and not ping only One Person… I adopt your change in manjaro chroot this evening and After pushing in unstable for testing … we are a Little team and see everywhere Is hard… so don t think we not accept contributions only wait and if more time passed please re ping …

1 Like

The updated chroot is now in manjaro tools at least the git version.

Hi! Sorry to bump an old thread. But how is that the patch made to the Manjaro’s GitLab like 6 months ago but ISOs are not still using it? I still see users asking about this annoyance…

6 months old or 6 days, an annoyance remains to be solved.

I dont know about that … fixes were pushed a long time ago, as can be seen at gitlab, and it seems to work.

So … what do you mean?