[Solved] How do i apply a patch to embedded/nanobsd (read-only filesystem?)



  • I am trying to set up pfSense on a Compact Flash card. I have applied this patch to a VMware virtual machine running 1.2.2, using this command:

    patch -p1 -d / < wildcards.patch

    It works as expected.

    Now I want to add the patch to an embedded version on a CF, but there seems to be a problem with writing permissions:

    [1.2.3-RELEASE] [root@pfSense.local]/root(1): fetch http://cvstrac.pfsense.com/attach_get/132/wildcards.patch
    fetch: wildcards.patch: open(): Read-only file system
    [1.2.3-RELEASE] [root@pfSense.local]/root(2): pwd
    /root
    [1.2.3-RELEASE] [root@pfSense.local]/root(3): cd /tmp/
    [1.2.3-RELEASE] [root@pfSense.local]/tmp(4): fetch http://cvstrac.pfsense.com/attach_get/132/wildcards.patch
    wildcards.patch                               100% of   12 kB   56 kBps
    [1.2.3-RELEASE] [root@pfSense.local]/tmp(5): patch -p1 -C -d / < wildcards.patch
    
    Hmm...  Looks like a unified diff to me...
    The text leading up to this was:
    --------------------------
    |diff -Nrub orig/etc/inc/services.inc patched/etc/inc/services.inc
    |--- orig/etc/inc/services.inc  2008-06-01 19:21:06.000000000 +0200
    |+++ patched/etc/inc/services.inc       2008-06-01 23:43:04.000000000 +0200
    --------------------------
    Patching file etc/inc/services.inc using Plan A...
    Hunk #1 succeeded at 626 (offset 1 line).
    Hmm...  The next patch looks like a unified diff to me...
    The text leading up to this was:
    --------------------------
    |diff -Nrub orig/etc/inc/xmlparse.inc patched/etc/inc/xmlparse.inc
    |--- orig/etc/inc/xmlparse.inc  2008-06-01 21:56:17.000000000 +0200
    |+++ patched/etc/inc/xmlparse.inc       2008-06-01 23:43:05.000000000 +0200
    --------------------------
    Patching file etc/inc/xmlparse.inc using Plan A...
    Hunk #1 succeeded at 32.
    Hmm...  The next patch looks like a unified diff to me...
    The text leading up to this was:
    --------------------------
    |diff -Nrub orig/usr/local/www/services_dnsmasq_domainwildcard_edit.php patched/
    usr/local/www/services_dnsmasq_domainwildcard_edit.php
    |--- orig/usr/local/www/services_dnsmasq_domainwildcard_edit.php        1970-01-01 01:00:00.000000000 +0100
    |+++ patched/usr/local/www/services_dnsmasq_domainwildcard_edit.php     2008-06-01 23:44:36.000000000 +0200
    --------------------------
    (Creating file usr/local/www/services_dnsmasq_domainwildcard_edit.php...)
    Patching file usr/local/www/services_dnsmasq_domainwildcard_edit.php using Plan
    A...
    Hunk #1 succeeded at 1.
    Hmm...  The next patch looks like a unified diff to me...
    The text leading up to this was:
    --------------------------
    |diff -Nrub orig/usr/local/www/services_dnsmasq.php patched/usr/local/www/services_dnsmasq.php
    |--- orig/usr/local/www/services_dnsmasq.php    2008-06-01 19:22:24.000000000 +0200
    |+++ patched/usr/local/www/services_dnsmasq.php 2008-06-01 23:44:24.000000000 +0200
    --------------------------
    Patching file usr/local/www/services_dnsmasq.php using Plan A...
    Hunk #1 succeeded at 41.
    Hunk #2 succeeded at 74 (offset 3 lines).
    Hunk #3 succeeded at 98 (offset 3 lines).
    Hunk #4 succeeded at 130 (offset 3 lines).
    Hunk #5 succeeded at 276 (offset 3 lines).
    done
    [1.2.3-RELEASE] [root@pfSense.local]/tmp(8): patch -p1 -d / < wildcards.patch
    Hmm...  Looks like a unified diff to me...
    The text leading up to this was:
    --------------------------
    |diff -Nrub orig/etc/inc/services.inc patched/etc/inc/services.inc
    |--- orig/etc/inc/services.inc  2008-06-01 19:21:06.000000000 +0200
    |+++ patched/etc/inc/services.inc       2008-06-01 23:43:04.000000000 +0200
    --------------------------
    Patching file etc/inc/services.inc using Plan A...
    Hunk #1 succeeded at 626 (offset 1 line).
    Can't backup etc/inc/services.inc, output is in /tmp//patchos5gfZ2: Read-only file system
    Hmm...  The next patch looks like a unified diff to me...
    The text leading up to this was:
    --------------------------
    |diff -Nrub orig/etc/inc/xmlparse.inc patched/etc/inc/xmlparse.inc
    |--- orig/etc/inc/xmlparse.inc  2008-06-01 21:56:17.000000000 +0200
    |+++ patched/etc/inc/xmlparse.inc       2008-06-01 23:43:05.000000000 +0200
    --------------------------
    Patching file etc/inc/xmlparse.inc using Plan A...
    Hunk #1 succeeded at 32.
    Can't backup etc/inc/xmlparse.inc, output is in /tmp//patchos5gfZ2: Read-only file system
    Hmm...  The next patch looks like a unified diff to me...
    The text leading up to this was:
    --------------------------
    |diff -Nrub orig/usr/local/www/services_dnsmasq_domainwildcard_edit.php patched/
    usr/local/www/services_dnsmasq_domainwildcard_edit.php
    |--- orig/usr/local/www/services_dnsmasq_domainwildcard_edit.php        1970-01-01 01:00:00.000000000 +0100
    |+++ patched/usr/local/www/services_dnsmasq_domainwildcard_edit.php     2008-06-01 23:44:36.000000000 +0200
    --------------------------
    (Creating file usr/local/www/services_dnsmasq_domainwildcard_edit.php...)
    patch: **** can't find usr/local/www/services_dnsmasq_domainwildcard_edit.php
    

    As you can see, I tried using /tmp instead of /root, but to no avail.

    Is there a way to make this patch work on nanobsd/embedded?

    Or is it maybe possible to patch the img file before writing it to the CF?



  • Start with the command:  /etc/rc.conf_mount_rw

    And end with:  /etc/rc.conf_mount_ro

    Cheers.



  • Thanks, that helped.


Log in to reply