Announcement

Collapse
No announcement yet.

Adding an ISO to grub

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Work on your script-foo and make it work for either.

    Here, I'll get you started:

    if [[ -f initrd.lz


    Please Read Me

    Comment


      #17
      So what.. I extract initrd* from the ISO and parse it?

      Comment


        #18
        No eh?

        Anyway, I've added a big fat warning popup to cover that:

        Click image for larger version

Name:	warning.png
Views:	1
Size:	25.6 KB
ID:	644663

        Comment


          #19
          Code:
          [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#54FFFF][B]/subvol/@grub[/B][/COLOR][COLOR=#000000]$ isoinfo -l -i focal-desktop-amd64.iso |grep -i initrd[/COLOR]
          ----------   0    0    0        86500898 Apr 13 2020 [ 878291 00]  [COLOR=#FF5454][B]INITRD[/B][/COLOR][COLOR=#000000].;1  [/COLOR]
          [COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#54FFFF][B]/subvol/@grub[/B][/COLOR][COLOR=#000000]$ isoinfo -l -i neon-useredition-amd64.iso |grep -i initrd                          [/COLOR]
          ----------   0    0    0        41101734 Apr  9 2020 [ 732392 00]  [COLOR=#FF5454][B]INITRD[/B][/COLOR][COLOR=#000000].LZ;1 [/COLOR]
          
          
          
          [/FONT]

          Please Read Me

          Comment


            #20
            NOt pretty, but seems to work:

            $ isoinfo -l -i focal-desktop-amd64.iso |grep -i initrd | awk '{ print substr($NF, 1, length($NF)-2)}'
            INITRD.

            $ isoinfo -l -i neon-useredition-amd64.iso |grep -i initrd | awk '{ print substr($NF, 1, length($NF)-2)}'
            INITRD.LZ

            Please Read Me

            Comment


              #21
              BTW, @here df -P does indeed return /dev/nvme0n1p3, etc.

              Please Read Me

              Comment


                #22
                Originally posted by oshunluvr View Post
                NOt pretty, but seems to work:

                $ isoinfo -l -i focal-desktop-amd64.iso |grep -i initrd | awk '{ print substr($NF, 1, length($NF)-2)}'
                INITRD...
                Thanks :·)
                No, it's not pretty, because isoinfo converts everything to uppercase ;·) but that should easy to fix - even for me.

                BTW, @here df -P does indeed return /dev/nvme0n1p3, etc.
                OK, I guess I can also work on accounting for that... hopefully.
                If not, I can always - after the required amount of groogling around - ask on a friendly forum we happen to know about, can't I?

                Comment


                  #23
                  If you end up using the awk command, you can just add "tolower" function to it.

                  isoinfo -l -i neon-useredition-amd64.iso |grep -i initrd | awk '{ print tolower ( substr($NF, 1, length($NF)-2) )}
                  initrd.lz


                  Please Read Me

                  Comment


                    #24
                    I assumed you'd use a bash if in your script so you wouldn't actually need to convert the case, just adjust for it.

                    Please Read Me

                    Comment


                      #25
                      Curious as to why the "df -P" using only /dev/sdX9 is an issue?

                      Please Read Me

                      Comment


                        #26
                        I see now, the bit in your script. Gotta be another way to get what you're looking for.

                        Why not just us "df" and the filename:
                        Code:
                        [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#54FFFF][B]~[/B][/COLOR][COLOR=#000000]$ [/COLOR][/FONT]df --output=source testrun | sed 1d
                        /dev/nvme0n1p3
                        [FONT=monospace]
                        [/FONT]
                        If your service menu picks up the filename, then send it to the script and use "df", --output=source lists only the device name, then "| sed 1d" strips off the header line.

                        So this should work:

                        part=`df --output=source $1 | sed 1d`
                        Last edited by oshunluvr; Apr 27, 2020, 03:30 PM.

                        Please Read Me

                        Comment


                          #27
                          Thank you. Late here, going to bed. I'll certainly look into it tomorrow

                          Comment


                            #28
                            Originally posted by Don B. Cilly View Post
                            No, it's not pretty, because isoinfo converts everything to uppercase
                            You can avoid isoinfo by using the fuseiso package, which lets you do a fuse mount of the iso. F.ex.:
                            Code:
                            $ mkdir ~/lub
                            $ fuseiso /t/iso/lubuntu/focal-desktop-amd64.iso lub
                            $ ls ~/lub/casper
                            filesystem.manifest         filesystem.squashfs      vmlinuz
                            filesystem.manifest-remove  filesystem.squashfs.gpg
                            filesystem.size             initrd
                            $ fusermount -u ~/lub
                            (isoinfo looks like a minimal port of a MSDOS utility .)
                            Regards, John Little

                            Comment


                              #29
                              Right, but fuseiso (here) says Command not found, whereas isoinfo doesn't.
                              So, since I persist in my silly idea that the script could be useful to people who would like to boot and image without external media, and can't be bothered to edit configuration files, work out what hdx,y (/location) their image is, whether their initrd has an lz (for landing choppers? ;·) or not, and so on... chances are that they already have isoinfo. I don't think I installed it... I'm trying to find out if it's a "base" utility... it comes with genisoimage and I don't think I ever heard the name... oh well. We'll see.

                              Converting to lowercase is easy, anyway :·)

                              Comment


                                #30
                                Originally posted by oshunluvr View Post
                                So this should work: part=`df --output=source $1 | sed 1d`
                                But that still returns /dev/sdc2 here. So it would return /dev/nvme0n1p3 there, right?
                                I did make a bit that would parse /dev/nvme* partitions and convert them to hdx,y grub notation, but then I realised:
                                1) no-one has read RFC 9999(½) or if they have, they don't care :·)
                                2) nvme* partitions are for NVMe disks.
                                3) there's no telling what other mysterious/obnoxious/counterproductive naming schemes (like /dev/mmcblk0 and such) are - or will shortly be - out there.

                                So there's no way really to convert all possible user's partition names to the grub ones, right?
                                Or is there? Click image for larger version

Name:	arrabbiato1.gif
Views:	12
Size:	525 Bytes
ID:	644669

                                So, thanks to your suggestion - and assuming that isoinfo is installed in most KDE distros (well, Kubuntu and neon would be good enough, the rest can... ;·) - I can probably limit the warning to a partition-name check (within the script, not as a popup), check that isoinfo is installed, and have the script work for the "masses".

                                Comment

                                Working...
                                X