[arch-releng] [PATCH] Update archiso hooks to work with next mkinitcpio 0.6
Some basic changes to make archiso hooks work with the next mkinitcpio 0.6 Tested under KVM, a ""2010.02"" and works fine with it. NOTE: current mkinitcpio-0.5.99.2-2 does not include "losetup", maybe will be included in next version, see #[1]. For now must be added manually. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- archiso/hooks/archiso | 22 ++++++++++++---------- archiso/hooks/archiso-early | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index bed8f7a..5b102d7 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -9,7 +9,7 @@ _mnt_bind() # args: /path/to/image_file _mnt_squashfs() { - /bin/modprobe -q loop >/dev/null 2>&1 + /sbin/modprobe -q loop >/dev/null 2>&1 img="${1}" base_img="${img##*/}"; @@ -27,7 +27,7 @@ _mnt_squashfs() while [ ! -e "/dev/loop${LOOP_NUM}" ]; do sleep 1 done - if ! /bin/losetup "/dev/loop${LOOP_NUM}" ${img}; then + if ! /sbin/losetup "/dev/loop${LOOP_NUM}" ${img}; then echo "ERROR: Cannot mount loop device /dev/loop${LOOP_NUM}" break fi @@ -70,7 +70,7 @@ run_hook () PS1="ramfs$ " /bin/sh -i done - eval $(fstype < /dev/archiso 2>/dev/null) + FSTYPE=$(blkid -o value -s TYPE /dev/archiso 2>/dev/null) if [ -n "${FSTYPE}" ]; then if [ "${FSTYPE}" = "unknown" ]; then # First try mounting then with vfat, maybe someone put the image on @@ -98,8 +98,8 @@ run_hook () echo "ERROR: /dev/archiso found, but the filesystem type is unknown." fi - /bin/modprobe -q squashfs >/dev/null 2>&1 - /bin/modprobe -q aufs >/dev/null 2>&1 + /sbin/modprobe -q squashfs >/dev/null 2>&1 + /sbin/modprobe -q aufs >/dev/null 2>&1 msg ":: Mounting root (aufs) filesystem" /bin/mount -t aufs -o dirs=/tmpfs=rw none /real_root @@ -137,17 +137,19 @@ run_hook () if [ "${break}" = "y" ]; then echo ":: Break requested, type 'exit' to resume operation" - echo " NOTE: klibc contains no 'ls' binary, use 'echo *' instead" PS1="ramfs$ " /bin/sh -i fi - udevpid=$(/bin/minips -C udevd -o pid=) - [ "x${udevpid}" != "x" ] && /bin/kill -9 $udevpid 2>&1 >/dev/null - #Yep, we're bailing out here. We don't need kinit. + #Special handling if udev is running + udevpid=$(/bin/pidof udevd) + if [ -n "${udevpid}" ]; then + /bin/kill -9 ${udevpid} > /dev/null 2>&1 + /bin/sleep 0.01 + fi msg ":: Passing control to Arch Linux Initscripts...Please Wait" /bin/umount /sys /bin/umount /proc - exec /bin/run-init -c /dev/console /real_root /sbin/init ${CMDLINE} + exec /sbin/switch_root -c /dev/console /real_root /sbin/init ${CMDLINE} } # vim:ft=sh:ts=4:sw=4:et: diff --git a/archiso/hooks/archiso-early b/archiso/hooks/archiso-early index d57b73b..edd554b 100644 --- a/archiso/hooks/archiso-early +++ b/archiso/hooks/archiso-early @@ -2,7 +2,7 @@ run_hook () { if [ -n "${archisolabel}" ]; then - echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", IMPORT{program}=\"vol_id --export \$tempnode\"" > /lib/udev/rules.d/00-archiso-device.rules + echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", IMPORT{program}=\"/sbin/blkid -o udev \$tempnode\"" > /lib/udev/rules.d/00-archiso-device.rules echo "ENV{ID_FS_LABEL_ENC}==\"${archisolabel}\", SYMLINK+=\"archiso\"" >> /lib/udev/rules.d/00-archiso-device.rules fi } -- 1.6.6.1
Am 04.02.2010 23:00, schrieb Gerardo Exequiel Pozzi:
Some basic changes to make archiso hooks work with the next mkinitcpio 0.6 Tested under KVM, a ""2010.02"" and works fine with it.
NOTE: current mkinitcpio-0.5.99.2-2 does not include "losetup", maybe will be included in next version, see #[1]. For now must be added manually.
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- archiso/hooks/archiso | 22 ++++++++++++---------- archiso/hooks/archiso-early | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index bed8f7a..5b102d7 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -9,7 +9,7 @@ _mnt_bind() # args: /path/to/image_file _mnt_squashfs() { - /bin/modprobe -q loop >/dev/null 2>&1 + /sbin/modprobe -q loop >/dev/null 2>&1
img="${1}" base_img="${img##*/}"; @@ -27,7 +27,7 @@ _mnt_squashfs() while [ ! -e "/dev/loop${LOOP_NUM}" ]; do sleep 1 done - if ! /bin/losetup "/dev/loop${LOOP_NUM}" ${img}; then + if ! /sbin/losetup "/dev/loop${LOOP_NUM}" ${img}; then echo "ERROR: Cannot mount loop device /dev/loop${LOOP_NUM}" break fi
My local config already has losetup, it's just not commited yet.
@@ -70,7 +70,7 @@ run_hook () PS1="ramfs$ " /bin/sh -i done
- eval $(fstype < /dev/archiso 2>/dev/null) + FSTYPE=$(blkid -o value -s TYPE /dev/archiso 2>/dev/null) if [ -n "${FSTYPE}" ]; then if [ "${FSTYPE}" = "unknown" ]; then # First try mounting then with vfat, maybe someone put the image on
We can revert Gerhard's last commit now, blkid will detect vfat just fine, while klibc/fstype didn't.
diff --git a/archiso/hooks/archiso-early b/archiso/hooks/archiso-early index d57b73b..edd554b 100644 --- a/archiso/hooks/archiso-early +++ b/archiso/hooks/archiso-early @@ -2,7 +2,7 @@ run_hook () { if [ -n "${archisolabel}" ]; then - echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", IMPORT{program}=\"vol_id --export \$tempnode\"" > /lib/udev/rules.d/00-archiso-device.rules + echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", IMPORT{program}=\"/sbin/blkid -o udev \$tempnode\"" > /lib/udev/rules.d/00-archiso-device.rules echo "ENV{ID_FS_LABEL_ENC}==\"${archisolabel}\", SYMLINK+=\"archiso\"" >> /lib/udev/rules.d/00-archiso-device.rules fi }
I was thinking about dropping the special udev rule and using blkid to find the right device, it has an option for that. I also thought about a failsafe mechanism in case the label is incorrect. For now, we can apply this patch as it is, but we should base it on archiso with commit fd93e7c9bd614a026f1d661f359012a4c1e080d7 reverted, as per the comment above.
On 02/04/2010 08:28 PM, Thomas Bächler wrote:
Am 04.02.2010 23:00, schrieb Gerardo Exequiel Pozzi:
Some basic changes to make archiso hooks work with the next mkinitcpio 0.6 Tested under KVM, a ""2010.02"" and works fine with it.
NOTE: current mkinitcpio-0.5.99.2-2 does not include "losetup", maybe will be included in next version, see #[1]. For now must be added manually.
Signed-off-by: Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> --- archiso/hooks/archiso | 22 ++++++++++++---------- archiso/hooks/archiso-early | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index bed8f7a..5b102d7 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -9,7 +9,7 @@ _mnt_bind() # args: /path/to/image_file _mnt_squashfs() { - /bin/modprobe -q loop>/dev/null 2>&1 + /sbin/modprobe -q loop>/dev/null 2>&1
img="${1}" base_img="${img##*/}"; @@ -27,7 +27,7 @@ _mnt_squashfs() while [ ! -e "/dev/loop${LOOP_NUM}" ]; do sleep 1 done - if ! /bin/losetup "/dev/loop${LOOP_NUM}" ${img}; then + if ! /sbin/losetup "/dev/loop${LOOP_NUM}" ${img}; then echo "ERROR: Cannot mount loop device /dev/loop${LOOP_NUM}" break fi
My local config already has losetup, it's just not commited yet.
Perfect!
@@ -70,7 +70,7 @@ run_hook () PS1="ramfs$ " /bin/sh -i done
- eval $(fstype< /dev/archiso 2>/dev/null) + FSTYPE=$(blkid -o value -s TYPE /dev/archiso 2>/dev/null) if [ -n "${FSTYPE}" ]; then if [ "${FSTYPE}" = "unknown" ]; then # First try mounting then with vfat, maybe someone put the image on
We can revert Gerhard's last commit now, blkid will detect vfat just fine, while klibc/fstype didn't.
I suspected that you say, archiso hook will look a bit smaller. :)
diff --git a/archiso/hooks/archiso-early b/archiso/hooks/archiso-early index d57b73b..edd554b 100644 --- a/archiso/hooks/archiso-early +++ b/archiso/hooks/archiso-early @@ -2,7 +2,7 @@ run_hook () { if [ -n "${archisolabel}" ]; then - echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", IMPORT{program}=\"vol_id --export \$tempnode\""> /lib/udev/rules.d/00-archiso-device.rules + echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", IMPORT{program}=\"/sbin/blkid -o udev \$tempnode\""> /lib/udev/rules.d/00-archiso-device.rules echo "ENV{ID_FS_LABEL_ENC}==\"${archisolabel}\", SYMLINK+=\"archiso\"">> /lib/udev/rules.d/00-archiso-device.rules fi }
I was thinking about dropping the special udev rule and using blkid to find the right device, it has an option for that. I also thought about a failsafe mechanism in case the label is incorrect.
This sound interesting. Are you talking about blkid -t LABEL="xyz" ?
For now, we can apply this patch as it is, but we should base it on archiso with commit fd93e7c9bd614a026f1d661f359012a4c1e080d7 reverted, as per the comment above.
Good. Anyway the idea of this patch is "to improvise" (I missed [RFC] in the title), doing only trivial changes to make things just works, details will come :) http://github.com/djgera/archiso/tree/experimental [based on "master" and "djgera" (things pending for master)] Thanks for your feedback. -- Gerardo Exequiel Pozzi ( djgera ) http://www.djgera.com.ar KeyID: 0x1B8C330D Key fingerprint = 0CAA D5D4 CD85 4434 A219 76ED 39AB 221B 1B8C 330D
On 02/04/2010 11:00 PM, Gerardo Exequiel Pozzi wrote:
On 02/04/2010 08:28 PM, Thomas Bächler wrote:
diff --git a/archiso/hooks/archiso-early b/archiso/hooks/archiso-early index d57b73b..edd554b 100644 --- a/archiso/hooks/archiso-early +++ b/archiso/hooks/archiso-early @@ -2,7 +2,7 @@ run_hook () { if [ -n "${archisolabel}" ]; then - echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", IMPORT{program}=\"vol_id --export \$tempnode\""> /lib/udev/rules.d/00-archiso-device.rules + echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", IMPORT{program}=\"/sbin/blkid -o udev \$tempnode\""> /lib/udev/rules.d/00-archiso-device.rules echo "ENV{ID_FS_LABEL_ENC}==\"${archisolabel}\", SYMLINK+=\"archiso\"">> /lib/udev/rules.d/00-archiso-device.rules fi } I was thinking about dropping the special udev rule and using blkid to find the right device, it has an option for that. I also thought about a failsafe mechanism in case the label is incorrect. This sound interesting. Are you talking about blkid -t LABEL="xyz" ?
Oops, I tried without this rule, works but only when booting the iso as disk (/dev/sd) if you boot the iso as cdrom blkid does not list any device. if you force blkid /dev/sr0 will work. -- Gerardo Exequiel Pozzi ( djgera ) http://www.djgera.com.ar KeyID: 0x1B8C330D Key fingerprint = 0CAA D5D4 CD85 4434 A219 76ED 39AB 221B 1B8C 330D
Am 05.02.2010 04:24, schrieb Gerardo Exequiel Pozzi:
I was thinking about dropping the special udev rule and using blkid to find the right device, it has an option for that. I also thought about a failsafe mechanism in case the label is incorrect. This sound interesting. Are you talking about blkid -t LABEL="xyz" ?
Didn't look at the manpage, but yes, something like that.
Oops, I tried without this rule, works but only when booting the iso as disk (/dev/sd) if you boot the iso as cdrom blkid does not list any device. if you force blkid /dev/sr0 will work.
Ah, not good. Maybe we keep the rule then. So my ideas were (if you have time to do them, I don't right now): - Remove the special vfat handling in favor of the cool blkid - Add an "archisodevice=" fallback option that will override archisolabel and simply mount the specified device. - If nothing can be found, use dialog to display a list of block devices archiso can try. And then something that needs changes in mkinitcpio: Instead of doing the mounting in a special hook (and not letting /init finish), register a "mount hook" that will be run right at the end of /init and let /init finish as usual. No idea if it's a good idea, I will have to look at the code again.
On 02/05/2010 05:13 AM, Thomas Bächler wrote:
Am 05.02.2010 04:24, schrieb Gerardo Exequiel Pozzi:
I was thinking about dropping the special udev rule and using blkid to find the right device, it has an option for that. I also thought about a failsafe mechanism in case the label is incorrect.
This sound interesting. Are you talking about blkid -t LABEL="xyz" ?
Didn't look at the manpage, but yes, something like that.
Oops, I tried without this rule, works but only when booting the iso as disk (/dev/sd) if you boot the iso as cdrom blkid does not list any device. if you force blkid /dev/sr0 will work.
Ah, not good. Maybe we keep the rule then. So my ideas were (if you have time to do them, I don't right now):
- Remove the special vfat handling in favor of the cool blkid - Add an "archisodevice=" fallback option that will override archisolabel and simply mount the specified device.
Implemented http://github.com/djgera/archiso/commit/fbb210ed79faec77985975fa6434c6088079...
- If nothing can be found, use dialog to display a list of block devices archiso can try.
I guess that the option archisodevice= is suficient. If something fails user can load the "special" module, then exit from the shell and continue with the device specified in parameter.
And then something that needs changes in mkinitcpio: Instead of doing the mounting in a special hook (and not letting /init finish), register a "mount hook" that will be run right at the end of /init and let /init finish as usual. No idea if it's a good idea, I will have to look at the code again.
This sound interesting. But I have no idea about this, I leave it in your hands :) Thanks, -- Gerardo Exequiel Pozzi ( djgera ) http://www.djgera.com.ar KeyID: 0x1B8C330D Key fingerprint = 0CAA D5D4 CD85 4434 A219 76ED 39AB 221B 1B8C 330D
On Fri, Feb 5, 2010 at 2:33 PM, Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> wrote:
On 02/05/2010 05:13 AM, Thomas Bächler wrote:
Am 05.02.2010 04:24, schrieb Gerardo Exequiel Pozzi:
I was thinking about dropping the special udev rule and using blkid to find the right device, it has an option for that. I also thought about a failsafe mechanism in case the label is incorrect.
This sound interesting. Are you talking about blkid -t LABEL="xyz" ?
Didn't look at the manpage, but yes, something like that.
Oops, I tried without this rule, works but only when booting the iso as disk (/dev/sd) if you boot the iso as cdrom blkid does not list any device. if you force blkid /dev/sr0 will work.
Ah, not good. Maybe we keep the rule then. So my ideas were (if you have time to do them, I don't right now):
- Remove the special vfat handling in favor of the cool blkid - Add an "archisodevice=" fallback option that will override archisolabel and simply mount the specified device.
Implemented http://github.com/djgera/archiso/commit/fbb210ed79faec77985975fa6434c6088079...
- If nothing can be found, use dialog to display a list of block devices archiso can try.
I guess that the option archisodevice= is suficient. If something fails user can load the "special" module, then exit from the shell and continue with the device specified in parameter.
And then something that needs changes in mkinitcpio: Instead of doing the mounting in a special hook (and not letting /init finish), register a "mount hook" that will be run right at the end of /init and let /init finish as usual. No idea if it's a good idea, I will have to look at the code again.
This sound interesting. But I have no idea about this, I leave it in your hands :)
Sorry about the long delay. I merged in all your changes to archiso and pushed to master. Thanks for all the work
On 02/06/2010 10:28 PM, Aaron Griffin wrote:
Sorry about the long delay. I merged in all your changes to archiso and pushed to master. Thanks for all the work
No problem. One thing: you have merged my branch "experimental" having changes for mkinitcpio-0.6 on master. In another email [#1] I talked about making a 2010.02 with the current mkinitcpio. But since mkinitcpio-0.6 is now in [testing] maybe in few time will go to [core]. I guess, can wait for it, skip 2010.02 with current mkinitcpio, and go directly for new mkinitcpio. Thanks. [#1] http://mailman.archlinux.org/pipermail/arch-releng/2010-February/000801.html -- Gerardo Exequiel Pozzi ( djgera ) http://www.djgera.com.ar KeyID: 0x1B8C330D Key fingerprint = 0CAA D5D4 CD85 4434 A219 76ED 39AB 221B 1B8C 330D
On 02/08/2010 12:03 AM, Gerardo Exequiel Pozzi wrote:
On 02/06/2010 10:28 PM, Aaron Griffin wrote:
Sorry about the long delay. I merged in all your changes to archiso and pushed to master. Thanks for all the work
No problem. One thing: you have merged my branch "experimental" having changes for mkinitcpio-0.6 on master. In another email [#1] I talked about making a 2010.02 with the current mkinitcpio. But since mkinitcpio-0.6 is now in [testing] maybe in few time will go to [core]. I guess, can wait for it, skip 2010.02 with current mkinitcpio, and go directly for new mkinitcpio.
Thanks.
[#1] http://mailman.archlinux.org/pipermail/arch-releng/2010-February/000801.html
I created a branch 'svenstaro' [#1] take pick all changes (except extra/ directory, keeping only one splash screen) from Sven-Hendrik Haase, with some conflicts against master resolved. So you can merge directly. I splited these in more but smalls commits. * Delete old configs files * Fixed offset of partition on iso * Update splash screen and minor cleanups. PS: You agree with these changes? [#1] http://github.com/djgera/archiso/commits/svenstaro/ -- Gerardo Exequiel Pozzi ( djgera ) http://www.djgera.com.ar KeyID: 0x1B8C330D Key fingerprint = 0CAA D5D4 CD85 4434 A219 76ED 39AB 221B 1B8C 330D
On Mon, Feb 8, 2010 at 1:20 AM, Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> wrote:
On 02/08/2010 12:03 AM, Gerardo Exequiel Pozzi wrote:
On 02/06/2010 10:28 PM, Aaron Griffin wrote:
Sorry about the long delay. I merged in all your changes to archiso and pushed to master. Thanks for all the work
No problem. One thing: you have merged my branch "experimental" having changes for mkinitcpio-0.6 on master. In another email [#1] I talked about making a 2010.02 with the current mkinitcpio. But since mkinitcpio-0.6 is now in [testing] maybe in few time will go to [core]. I guess, can wait for it, skip 2010.02 with current mkinitcpio, and go directly for new mkinitcpio.
Thanks.
[#1] http://mailman.archlinux.org/pipermail/arch-releng/2010-February/000801.html
I created a branch 'svenstaro' [#1] take pick all changes (except extra/ directory, keeping only one splash screen) from Sven-Hendrik Haase, with some conflicts against master resolved. So you can merge directly. I splited these in more but smalls commits.
* Delete old configs files * Fixed offset of partition on iso * Update splash screen and minor cleanups.
PS: You agree with these changes?
Part of me wanted to keep a handful of configs sitting in that directory. I'm fine with getting rid of the old "install-iso" if we no longer use it, but the xfce one was indented to be an example of how to get an X session from a live CD. I'll try to get these things merged in early next week, but I may keep the default and xfce dirs in the config section
participants (3)
-
Aaron Griffin
-
Gerardo Exequiel Pozzi
-
Thomas Bächler