Manually editing a existing apkovl: Difference between revisions

From Alpine Linux
(Category:HOWTO)
(replaced category:LBU by category:Diskless as diskless is more generic)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
You might end up in a situation when you find it necessary to edit a apkovl (without having to boot a box using the apkovl itself).
{{TOC right}}
 
You might end up in a situation when you find it necessary to edit an apkovl (without having to boot a box using the apkovl itself).


== Unpack the apkovl ==
== Unpack the apkovl ==
Unpack the apkovl into a temp dir.
Unpack the apkovl into a temp dir (''preferably run tar as root to preserve target's UIDs & GIDs''):
mkdir /tmp/testbox
{{Cmd|mkdir /tmp/testbox
  tar -xvzf testbox.apkovl.tar.gz -C /tmp/testbox/
  tar -xvzf testbox.apkovl.tar.gz -C /tmp/testbox/}}


== Make your modifications ==
== Make your modifications ==
Now do your modifications in '/tmp/testbox/'<BR>
Do your modifications in '/tmp/testbox/'<BR>
* Edit files/folders
* Edit files/folders
* Add files/folders
* Add files/folders
* Remove files/folders
* Remove files/folders
* etc.
* etc.
== Ensure proper ownership ==
By default, tar will preserve file permissions and ownership when creating an archive.  However, on extraction, if you did not extract the archive as root, file ownership may have been substituted with the current user (since changing file ownership usually requires superuser privileges).  If you didn't extract the apkovl as root, take a moment to correct ownership (by target's UIDs & GIDs rather than local user & group names)—especially for important directories like ''/etc'' and ''/root''.


== Pack the apkovl ==
== Pack the apkovl ==
When your modifications are done you should pack your apkovl
When your modifications are done, you should pack your apkovl
cd /tmp/testbox
{{Cmd|cd /tmp/testbox
  tar -czf /tmp/testbox.apkovl.tar.gz *
  tar -czf /tmp/testbox.apkovl.tar.gz *}}


== Replace the original apkovl ==
== Replace the original apkovl ==
Now you have a new/modified apkovl.<BR>
You now have a new/modified apkovl.<BR>
Replace your original apkovl (on your media) with '/tmp/testbox.apkovl.tar.gz' and boot your Alpine.
Replace your original apkovl (on your media) with '/tmp/testbox.apkovl.tar.gz' and boot.


[[Category:HOWTO]]
[[category:Diskless]]

Latest revision as of 07:07, 6 November 2024

You might end up in a situation when you find it necessary to edit an apkovl (without having to boot a box using the apkovl itself).

Unpack the apkovl

Unpack the apkovl into a temp dir (preferably run tar as root to preserve target's UIDs & GIDs):

mkdir /tmp/testbox tar -xvzf testbox.apkovl.tar.gz -C /tmp/testbox/

Make your modifications

Do your modifications in '/tmp/testbox/'

  • Edit files/folders
  • Add files/folders
  • Remove files/folders
  • etc.

Ensure proper ownership

By default, tar will preserve file permissions and ownership when creating an archive. However, on extraction, if you did not extract the archive as root, file ownership may have been substituted with the current user (since changing file ownership usually requires superuser privileges). If you didn't extract the apkovl as root, take a moment to correct ownership (by target's UIDs & GIDs rather than local user & group names)—especially for important directories like /etc and /root.

Pack the apkovl

When your modifications are done, you should pack your apkovl

cd /tmp/testbox tar -czf /tmp/testbox.apkovl.tar.gz *

Replace the original apkovl

You now have a new/modified apkovl.
Replace your original apkovl (on your media) with '/tmp/testbox.apkovl.tar.gz' and boot.