From 50794b1de1b0211ee4c040a83bba9a5f3148d066 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 20 May 2015 08:19:39 +0200 Subject: [PATCH] Splitting non-live specific hooks into their own subdirectory within hooks. --- scripts/build/binary_hooks | 31 ++++++++++--------- scripts/build/chroot_hooks | 21 +++++++------ scripts/build/config | 10 +++++- scripts/build/source_hooks | 31 ++++++++++--------- .../0020-create-mtab-symlink.hook.chroot | 0 .../0030-enable-cryptsetup.hook.chroot | 0 .../0040-create-locales-files.hook.chroot | 0 ...0-remove-adjtime-configuration.hook.chroot | 0 .../0110-remove-backup-files.hook.chroot | 0 .../0120-remove-dbus-machine-id.hook.chroot | 0 .../0130-remove-gnome-icon-cache.hook.chroot | 0 .../0140-remove-log-files.hook.chroot | 0 ...150-remove-mdadm-configuration.hook.chroot | 0 ...emove-openssh-server-host-keys.hook.chroot | 0 .../0170-remove-python-py.hook.chroot | 0 ...0180-remove-systemd-machine-id.hook.chroot | 0 .../0190-remove-temporary-files.hook.chroot | 0 .../0195-remove-ssl-cert-snakeoil.hook.chroot | 0 ...emove-udev-persistent-cd-rules.hook.chroot | 0 ...move-udev-persistent-net-rules.hook.chroot | 0 .../0400-update-apt-file-cache.hook.chroot | 0 .../0410-update-apt-xapian-index.hook.chroot | 0 .../0420-update-glx-alternative.hook.chroot | 0 .../0430-update-mlocate-database.hook.chroot | 0 ...0440-update-nvidia-alternative.hook.chroot | 0 .../0910-remove-apt-sources-lists | 0 26 files changed, 53 insertions(+), 40 deletions(-) rename share/hooks/{live => normal}/0020-create-mtab-symlink.hook.chroot (100%) rename share/hooks/{live => normal}/0030-enable-cryptsetup.hook.chroot (100%) rename share/hooks/{live => normal}/0040-create-locales-files.hook.chroot (100%) rename share/hooks/{live => normal}/0100-remove-adjtime-configuration.hook.chroot (100%) rename share/hooks/{live => normal}/0110-remove-backup-files.hook.chroot (100%) rename share/hooks/{live => normal}/0120-remove-dbus-machine-id.hook.chroot (100%) rename share/hooks/{live => normal}/0130-remove-gnome-icon-cache.hook.chroot (100%) rename share/hooks/{live => normal}/0140-remove-log-files.hook.chroot (100%) rename share/hooks/{live => normal}/0150-remove-mdadm-configuration.hook.chroot (100%) rename share/hooks/{live => normal}/0160-remove-openssh-server-host-keys.hook.chroot (100%) rename share/hooks/{live => normal}/0170-remove-python-py.hook.chroot (100%) rename share/hooks/{live => normal}/0180-remove-systemd-machine-id.hook.chroot (100%) rename share/hooks/{live => normal}/0190-remove-temporary-files.hook.chroot (100%) rename share/hooks/{live => normal}/0195-remove-ssl-cert-snakeoil.hook.chroot (100%) rename share/hooks/{live => normal}/0200-remove-udev-persistent-cd-rules.hook.chroot (100%) rename share/hooks/{live => normal}/0300-remove-udev-persistent-net-rules.hook.chroot (100%) rename share/hooks/{live => normal}/0400-update-apt-file-cache.hook.chroot (100%) rename share/hooks/{live => normal}/0410-update-apt-xapian-index.hook.chroot (100%) rename share/hooks/{live => normal}/0420-update-glx-alternative.hook.chroot (100%) rename share/hooks/{live => normal}/0430-update-mlocate-database.hook.chroot (100%) rename share/hooks/{live => normal}/0440-update-nvidia-alternative.hook.chroot (100%) rename share/hooks/{live => normal}/0910-remove-apt-sources-lists (100%) diff --git a/scripts/build/binary_hooks b/scripts/build/binary_hooks index bdad671cc..b40139797 100755 --- a/scripts/build/binary_hooks +++ b/scripts/build/binary_hooks @@ -58,21 +58,22 @@ do done ## Processing local hooks +for HOOK in config/hooks/normal/*.binary config/hooks/live/*.binary +do + if [ ! -e "${HOOK}" ] + then + continue + fi -if Find_files config/hooks/live/*.binary -then - for HOOK in config/hooks/live/*.binary - do - # Making hook executable - if [ ! -x "${HOOK}" ] - then - chmod +x "${HOOK}" - fi + # Making hook executable + if [ ! -x "${HOOK}" ] + then + chmod +x "${HOOK}" + fi - # Executing hook - ./"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;} - done + # Executing hook + ./"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;} +done - # Creating stage file - Create_stagefile .build/binary_hooks -fi +# Creating stage file +Create_stagefile .build/binary_hooks diff --git a/scripts/build/chroot_hooks b/scripts/build/chroot_hooks index e25f3b7fd..26ffdd701 100755 --- a/scripts/build/chroot_hooks +++ b/scripts/build/chroot_hooks @@ -78,28 +78,32 @@ then fi ## Processing local hooks - -if Find_files config/hooks/live/*.chroot +if ls config/hooks/*.chroot > /dev/null 2>&1 then # Restoring cache Restore_cache cache/packages.chroot - for _HOOK in config/hooks/live/*.chroot + for HOOK in config/hooks/normal/*.binary config/hooks/live/*.binary do + if [ ! -e "${HOOK}" ] + then + continue + fi + # Copying hook - cp "${_HOOK}" chroot/root + cp "${HOOK}" chroot/root # Making hook executable - if [ ! -x chroot/root/"$(basename ${_HOOK})" ] + if [ ! -x chroot/root/"$(basename ${HOOK})" ] then - chmod +x chroot/root/"$(basename ${_HOOK})" + chmod +x chroot/root/"$(basename ${HOOK})" fi # Executing hook - Chroot chroot "/root/$(basename ${_HOOK})" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;} + Chroot chroot "/root/$(basename ${HOOK})" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;} # Removing hook - rm -f chroot/root/"$(basename ${_HOOK})" + rm -f chroot/root/"$(basename ${HOOK})" done # Saving cache @@ -112,4 +116,3 @@ fi # Remove bind mount of build config inside chroot. umount chroot/live-build/config rmdir chroot/live-build/config - diff --git a/scripts/build/config b/scripts/build/config index 8e2109594..e6dcd4341 100755 --- a/scripts/build/config +++ b/scripts/build/config @@ -1312,11 +1312,19 @@ then rmdir --ignore-fail-on-non-empty local > /dev/null 2>&1 || true fi -mkdir -p config/hooks/live +mkdir -p config/hooks/normal config/hooks/live mkdir -p config/includes config/includes.bootstrap config/includes.chroot config/includes.binary config/includes.source Echo_message "Symlinking hooks..." +for _HOOK in "${LIVE_BUILD}"/share/hooks/normal/*.hook* /usr/share/normal/build/hooks/normal/*.hook* +do + if [ -e "${_HOOK}" ] && [ ! -e "config/hooks/normal/$(basename ${_HOOK})" ] + then + ln -s "${_HOOK}" "config/hooks/normal/$(basename ${_HOOK})" + fi +done + for _HOOK in "${LIVE_BUILD}"/share/hooks/live/*.hook* /usr/share/live/build/hooks/live/*.hook* do if [ -e "${_HOOK}" ] && [ ! -e "config/hooks/live/$(basename ${_HOOK})" ] diff --git a/scripts/build/source_hooks b/scripts/build/source_hooks index 6f3e08dcd..d3059de98 100755 --- a/scripts/build/source_hooks +++ b/scripts/build/source_hooks @@ -58,21 +58,22 @@ do done ## Processing local hooks +for HOOK in config/hooks/normal/*.source config/hooks/live/*.source +do + if [ ! -e "${HOOK}" ] + then + continue + fi -if Find_files config/hooks/live/*.source -then - for HOOK in config/hooks/live/*.source - do - # Making hook executable - if [ ! -x "${HOOK}" ] - then - chmod +x "${HOOK}" - fi + # Making hook executable + if [ ! -x "${HOOK}" ] + then + chmod +x "${HOOK}" + fi - # Executing hook - ./"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;} - done + # Executing hook + ./"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;} +done - # Creating stage file - Create_stagefile .build/source_hooks -fi +# Creating stage file +Create_stagefile .build/source_hooks diff --git a/share/hooks/live/0020-create-mtab-symlink.hook.chroot b/share/hooks/normal/0020-create-mtab-symlink.hook.chroot similarity index 100% rename from share/hooks/live/0020-create-mtab-symlink.hook.chroot rename to share/hooks/normal/0020-create-mtab-symlink.hook.chroot diff --git a/share/hooks/live/0030-enable-cryptsetup.hook.chroot b/share/hooks/normal/0030-enable-cryptsetup.hook.chroot similarity index 100% rename from share/hooks/live/0030-enable-cryptsetup.hook.chroot rename to share/hooks/normal/0030-enable-cryptsetup.hook.chroot diff --git a/share/hooks/live/0040-create-locales-files.hook.chroot b/share/hooks/normal/0040-create-locales-files.hook.chroot similarity index 100% rename from share/hooks/live/0040-create-locales-files.hook.chroot rename to share/hooks/normal/0040-create-locales-files.hook.chroot diff --git a/share/hooks/live/0100-remove-adjtime-configuration.hook.chroot b/share/hooks/normal/0100-remove-adjtime-configuration.hook.chroot similarity index 100% rename from share/hooks/live/0100-remove-adjtime-configuration.hook.chroot rename to share/hooks/normal/0100-remove-adjtime-configuration.hook.chroot diff --git a/share/hooks/live/0110-remove-backup-files.hook.chroot b/share/hooks/normal/0110-remove-backup-files.hook.chroot similarity index 100% rename from share/hooks/live/0110-remove-backup-files.hook.chroot rename to share/hooks/normal/0110-remove-backup-files.hook.chroot diff --git a/share/hooks/live/0120-remove-dbus-machine-id.hook.chroot b/share/hooks/normal/0120-remove-dbus-machine-id.hook.chroot similarity index 100% rename from share/hooks/live/0120-remove-dbus-machine-id.hook.chroot rename to share/hooks/normal/0120-remove-dbus-machine-id.hook.chroot diff --git a/share/hooks/live/0130-remove-gnome-icon-cache.hook.chroot b/share/hooks/normal/0130-remove-gnome-icon-cache.hook.chroot similarity index 100% rename from share/hooks/live/0130-remove-gnome-icon-cache.hook.chroot rename to share/hooks/normal/0130-remove-gnome-icon-cache.hook.chroot diff --git a/share/hooks/live/0140-remove-log-files.hook.chroot b/share/hooks/normal/0140-remove-log-files.hook.chroot similarity index 100% rename from share/hooks/live/0140-remove-log-files.hook.chroot rename to share/hooks/normal/0140-remove-log-files.hook.chroot diff --git a/share/hooks/live/0150-remove-mdadm-configuration.hook.chroot b/share/hooks/normal/0150-remove-mdadm-configuration.hook.chroot similarity index 100% rename from share/hooks/live/0150-remove-mdadm-configuration.hook.chroot rename to share/hooks/normal/0150-remove-mdadm-configuration.hook.chroot diff --git a/share/hooks/live/0160-remove-openssh-server-host-keys.hook.chroot b/share/hooks/normal/0160-remove-openssh-server-host-keys.hook.chroot similarity index 100% rename from share/hooks/live/0160-remove-openssh-server-host-keys.hook.chroot rename to share/hooks/normal/0160-remove-openssh-server-host-keys.hook.chroot diff --git a/share/hooks/live/0170-remove-python-py.hook.chroot b/share/hooks/normal/0170-remove-python-py.hook.chroot similarity index 100% rename from share/hooks/live/0170-remove-python-py.hook.chroot rename to share/hooks/normal/0170-remove-python-py.hook.chroot diff --git a/share/hooks/live/0180-remove-systemd-machine-id.hook.chroot b/share/hooks/normal/0180-remove-systemd-machine-id.hook.chroot similarity index 100% rename from share/hooks/live/0180-remove-systemd-machine-id.hook.chroot rename to share/hooks/normal/0180-remove-systemd-machine-id.hook.chroot diff --git a/share/hooks/live/0190-remove-temporary-files.hook.chroot b/share/hooks/normal/0190-remove-temporary-files.hook.chroot similarity index 100% rename from share/hooks/live/0190-remove-temporary-files.hook.chroot rename to share/hooks/normal/0190-remove-temporary-files.hook.chroot diff --git a/share/hooks/live/0195-remove-ssl-cert-snakeoil.hook.chroot b/share/hooks/normal/0195-remove-ssl-cert-snakeoil.hook.chroot similarity index 100% rename from share/hooks/live/0195-remove-ssl-cert-snakeoil.hook.chroot rename to share/hooks/normal/0195-remove-ssl-cert-snakeoil.hook.chroot diff --git a/share/hooks/live/0200-remove-udev-persistent-cd-rules.hook.chroot b/share/hooks/normal/0200-remove-udev-persistent-cd-rules.hook.chroot similarity index 100% rename from share/hooks/live/0200-remove-udev-persistent-cd-rules.hook.chroot rename to share/hooks/normal/0200-remove-udev-persistent-cd-rules.hook.chroot diff --git a/share/hooks/live/0300-remove-udev-persistent-net-rules.hook.chroot b/share/hooks/normal/0300-remove-udev-persistent-net-rules.hook.chroot similarity index 100% rename from share/hooks/live/0300-remove-udev-persistent-net-rules.hook.chroot rename to share/hooks/normal/0300-remove-udev-persistent-net-rules.hook.chroot diff --git a/share/hooks/live/0400-update-apt-file-cache.hook.chroot b/share/hooks/normal/0400-update-apt-file-cache.hook.chroot similarity index 100% rename from share/hooks/live/0400-update-apt-file-cache.hook.chroot rename to share/hooks/normal/0400-update-apt-file-cache.hook.chroot diff --git a/share/hooks/live/0410-update-apt-xapian-index.hook.chroot b/share/hooks/normal/0410-update-apt-xapian-index.hook.chroot similarity index 100% rename from share/hooks/live/0410-update-apt-xapian-index.hook.chroot rename to share/hooks/normal/0410-update-apt-xapian-index.hook.chroot diff --git a/share/hooks/live/0420-update-glx-alternative.hook.chroot b/share/hooks/normal/0420-update-glx-alternative.hook.chroot similarity index 100% rename from share/hooks/live/0420-update-glx-alternative.hook.chroot rename to share/hooks/normal/0420-update-glx-alternative.hook.chroot diff --git a/share/hooks/live/0430-update-mlocate-database.hook.chroot b/share/hooks/normal/0430-update-mlocate-database.hook.chroot similarity index 100% rename from share/hooks/live/0430-update-mlocate-database.hook.chroot rename to share/hooks/normal/0430-update-mlocate-database.hook.chroot diff --git a/share/hooks/live/0440-update-nvidia-alternative.hook.chroot b/share/hooks/normal/0440-update-nvidia-alternative.hook.chroot similarity index 100% rename from share/hooks/live/0440-update-nvidia-alternative.hook.chroot rename to share/hooks/normal/0440-update-nvidia-alternative.hook.chroot diff --git a/share/hooks/live/0910-remove-apt-sources-lists b/share/hooks/normal/0910-remove-apt-sources-lists similarity index 100% rename from share/hooks/live/0910-remove-apt-sources-lists rename to share/hooks/normal/0910-remove-apt-sources-lists