Cool Installer Idea I had



  • well this was an idea I had to make using a usb for piviot-overlay really easy but I can't get it to work yet...

    But here is the code I got now,

    https://gist.github.com/Immortal-/43750e9dabbef8811948d87beef012ac

    Credit to all the people I copied and pasted from and modify their code to work.
    maybe we can get it working but for now i gotta go to work

    Here is the php version of this installer.

    https://gist.github.com/Immortal-/39c79320f396755454bb8a425575d8b0



  • Thank you Chris. One questions is there a way to check what partition label to use?
    Your code assumes or I assumed it would work only if the partition was labeled sda1?
    For example on my omega there are three /dev listings they are sda, sda1 and sda5.
    root@Omega-xxxx:/# ls /dev/
    sda1
    sda5
    sda

    When I do fdisk it lists
    Device Boot Start End Blocks Id System
    /dev/sda1 1 1944 1950751+ f Win95 Ext'd (LBA)
    /dev/sda5 2 1944 1950720 6 FAT16 <--why thi shows up I have no idea but when viewing df -hT it shows as /overlay

    During manual setup(using sda1) it fails only when I select sda5 does it setup correctly.
    When I say manual setup I mean using the tutorial on Onion's website.
    Again thank you for taking the time to write the code.



  • @Guest From your fdisk output, I would say your USB device has been formatted with a single Extended Partition (/dev/sda1) containing a single Logical Partition (/dev/sda5) for the data. You should be using /dev/sda5

    However, I would be slightly surprised if all works OK with /dev/sda5 as shown in your fdisk output. It indicates that it is formatted as FAT16 but various instructions indicate that ext4 should be used.

    Unless you have anything you currently want to preserve on your USB, I would recommend completely deleting the existing partitions and reformatting your USB with a single Primary Partition formatted as ext4 which would then appear as /dev/sda1. You should be able to use fdisk or other partitioning tools to do this.



  • @Guest said:

    Thank you Chris. One questions is there a way to check what partition label to use?
    Your code assumes or I assumed it would work only if the partition was labeled sda1?
    For example on my omega there are three /dev listings they are sda, sda1 and sda5.
    root@Omega-xxxx:/# ls /dev/
    sda1
    sda5
    sda

    When I do fdisk it lists
    Device Boot Start End Blocks Id System
    /dev/sda1 1 1944 1950751+ f Win95 Ext'd (LBA)
    /dev/sda5 2 1944 1950720 6 FAT16 <--why thi shows up I have no idea but when viewing df -hT it shows as /overlay

    During manual setup(using sda1) it fails only when I select sda5 does it setup correctly.
    When I say manual setup I mean using the tutorial on Onion's website.
    Again thank you for taking the time to write the code.

    Well I do sda1 because that's the one I specified to be formatted. using

    mkfs.ext4 -F /dev/sda1
    

    This eminently crude code is nowhere near production. But I wanted to share this idea and a basic prototype.



  • @Chris-McCaslin All good. And I like the general concept of the code you provided - a good idea. 🙂

    My previous post was simply to assist @Guest in understanding why he had /dev/sda1 and /dev/sda5


  • administrators

    I like the idea, but it might be easier in something like Python or even Shell? Just a thought



  • @Lazar-Demin said:

    I like the idea, but it might be easier in something like Python or even Shell? Just a thought

    Yeah I could aslo write this in php with the wrapper I wrote. Im new to C++ though so I wanted to give it a shot to try to learn.



  • @Kit-Bishop said:

    However, I would be slightly surprised if all works OK with /dev/sda5 as shown in your fdisk output. It indicates that it is formatted as FAT16 but various instructions indicate that ext4 should be used.
    Surprise!
    Device Boot Start End Blocks Id System
    /dev/sda1 1 1944 1950751+ f Win95 Ext'd (LBA)
    /dev/sda5 2 1944 1950720 6 FAT16 <-me thinks this is an error as it show as ext4 else where

    Filesystem Type Size Used Available Use% Mounted on
    rootfs rootfs 1.8G 14.6M 1.7G 1% /
    /dev/root squashfs 7.3M 7.3M 0 100% /rom
    tmpfs tmpfs 29.9M 92.0K 29.8M 0% /tmp
    /dev/sda5 ext4 1.8G 14.6M 1.7G 1% /overlay
    overlayfs:/overlay overlay 1.8G 14.6M 1.7G 1% /
    tmpfs tmpfs 512.0K 0 512.0K 0% /dev



  • Added a nicer php version for everyone 😄



  • Credit Lazar for helping me sort out the sed section.
    @Chris-McCaslin shell version:
    opkg update
    opkg install block-mount kmod-fs-ext4 kmod-usb-storage-extras
    if [ ! -d "/mnt/sda1" ]; then
    mkdir /mnt/sda1
    fi
    mount /dev/sda1 /mnt/sda1
    mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt
    block detect > /etc/config/fstab
    cat /etc/config/fstab | sed -e 's//mnt/sda1//overlay/' -e "s/enabled[[:space:]]*'0'/enabled '1'/" | tee /tmp/fstab

    cp /tmp/fstab /etc/config/fstab



  • @Guest thanks!


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.