From e77f752fe98e8458797e413c4373d5dee3c3c93f Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 16:45:16 +0100 Subject: rename helper scripts to something more clear --- build | 41 -------------------------- buildiso | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ buildpkg | 41 ++++++++++++++++++++++++++ devmode | 26 ----------------- devmodeset | 26 +++++++++++++++++ iso | 87 ------------------------------------------------------- libvasile-kogaion | 2 ++ modereset | 16 ++++++++++ resetmode | 16 ---------- usermode | 31 -------------------- usermodeset | 31 ++++++++++++++++++++ vasile-kogaion | 24 +++++++-------- 12 files changed, 215 insertions(+), 213 deletions(-) delete mode 100755 build create mode 100755 buildiso create mode 100755 buildpkg delete mode 100755 devmode create mode 100755 devmodeset delete mode 100755 iso create mode 100755 modereset delete mode 100755 resetmode delete mode 100755 usermode create mode 100755 usermodeset diff --git a/build b/build deleted file mode 100755 index 3121bf4..0000000 --- a/build +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -# Vasile needs root privileges and a proper kernel to run - -kernelconfig -checkroot - -chrootprepare () { - # check our environment for sanity - # if safe, trigger start && break the loop to build packages - # else trigger stop && cleanup && check again - while : true ; do - if [[ ! -d "$rodir" && ! -d "$rwdir" && ! -d "$workdir" && ! -d "$overlaydir" ]] ; then - for i in "$rodir" "$rwdir" "$workdir" "$overlaydir" ; do - mkdir "$i" - done - chrootstart - break - elif [[ -d "$rodir" && -d "$rwdir" && -d "$workdir" && -d "$overlaydir" ]] ; then - chrootstop - for i in "$rodir" "$rwdir" "$workdir" "$overlaydir" ; do - rm -rf "$i" - done - continue - fi - done -} - -main () { - chrootchecksum - chrootprepare - chrootoverlays - chrootbuildsystem - chrootdevtree - chrootbuild - chrootx64 - chrootstop -} - -main -exit 0 diff --git a/buildiso b/buildiso new file mode 100755 index 0000000..86c20b3 --- /dev/null +++ b/buildiso @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +# Vasile needs root privileges and a proper kernel to run + +kernelconfig +checkroot + +prepareiso () { + # we really need this folder as quick as possible + mkdir -p "$isosyncdir" + # create an empty 20GB ext4 fs were our rootfs will stay + dd if=/dev/zero of=""$isosyncdir".img" bs=50M count=400 + mkfs.ext4 ""$isosyncdir".img" + # create live iso layout + mkdir -p "$isostagingdir" + mkdir -p "$isobootdir" + mkdir -p "$isoefibootdir" + mkdir -p "$isoliveosdir" + mkdir -p "$isosupersquashdir" + mkdir -p "$isolivesqfsdir" + # mount && copy core stage 4 image + mount -t squashfs "$chrootx64" "$isostagingdir" + mount -t ext4 ""$isosyncdir".img" "$isosyncdir" + rsync -aHAXr --progress "$isostagingdir/" "$isosyncdir/" + # copy kernel into cdroot + cp -avx ""$isosyncdir"/boot/"$isokernelname"" ""$isorootdir"/boot/vmlinuz" + # generate live initramfs + isostart + isoramfs + isostop + # generate system initramfs + isostart + systemramfs + isostop + # copy live initramfs into cdroot + mv ""$isosyncdir"/boot/"$isodracutrd"" ""$isorootdir"/boot/initrd" + # generate live efi image + isostart + isoefiimg + isostop + # copy efi image into cdroot + mv ""$isosyncdir"/root/bootx64.efi" "$isoefibootdir" + chmod 755 ""$isoefibootdir"/bootx64.efi" + # configure portage && give up control for package / desktop environment installation + isostart + isooverlays + isobuildsystem + isousertree + isochroot + isostop + # unmount rootfs before compression + umount -l "$isosyncdir" > /dev/null 2>&1 + # move rootfs in place + mv ""$isosyncdir".img" "$isolivesqfsdir" + # squash rootfs with best compression + mksquashfs "$isosupersquashdir" ""$isorootdir"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100% + # move squashed rootfs in place + mv ""$isorootdir/"squashfs.img" "$isoliveosdir" +} + +bootcoreiso () { + # configure live bootloader + git clone https://gitlab.com/"$releasename"/boot-core.git "$bootcorepath" + cp -avx "$bootcorefiles" "$isorootdir" +} + +cleanupiso () { + umount "$isostagingdir" + rm -rf "$isosyncdir" + rm -rf "$isostagingdir" + rm -rf "$isosupersquashdir" + rm -rf "$bootcorepath" +} + +makeiso () { + grub2-mkrescue -o ""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch".iso" "$isorootdir" +} + +main () { + chrootchecksum + prepareiso + bootcoreiso + cleanupiso + makeiso +} + +main diff --git a/buildpkg b/buildpkg new file mode 100755 index 0000000..3121bf4 --- /dev/null +++ b/buildpkg @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# Vasile needs root privileges and a proper kernel to run + +kernelconfig +checkroot + +chrootprepare () { + # check our environment for sanity + # if safe, trigger start && break the loop to build packages + # else trigger stop && cleanup && check again + while : true ; do + if [[ ! -d "$rodir" && ! -d "$rwdir" && ! -d "$workdir" && ! -d "$overlaydir" ]] ; then + for i in "$rodir" "$rwdir" "$workdir" "$overlaydir" ; do + mkdir "$i" + done + chrootstart + break + elif [[ -d "$rodir" && -d "$rwdir" && -d "$workdir" && -d "$overlaydir" ]] ; then + chrootstop + for i in "$rodir" "$rwdir" "$workdir" "$overlaydir" ; do + rm -rf "$i" + done + continue + fi + done +} + +main () { + chrootchecksum + chrootprepare + chrootoverlays + chrootbuildsystem + chrootdevtree + chrootbuild + chrootx64 + chrootstop +} + +main +exit 0 diff --git a/devmode b/devmode deleted file mode 100755 index 3ebffa0..0000000 --- a/devmode +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -fetch_devmode_portage_tree() { - if [[ ! -d /usr/portage/.git ]] ; then - cd /usr/portage && git init > /dev/null 2>&1 - git remote add origin git://anongit.gentoo.org/repo/gentoo.git - git pull --depth=1 origin master - git branch -u origin/master master - rm -rf /usr/portage/profiles/updates - fi -} - -set_devmode_portage_tree() { - ln -sf /opt/kogaion-build/conf/intel/portage /etc/portage - ln -sf /etc/portage/make.conf.amd64-devel /etc/portage/make.conf - eselect profile set 1 - env-update - . /etc/profile -} - -main() { - fetch_devmode_portage_tree - set_devmode_portage_tree -} - -main diff --git a/devmodeset b/devmodeset new file mode 100755 index 0000000..3ebffa0 --- /dev/null +++ b/devmodeset @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +fetch_devmode_portage_tree() { + if [[ ! -d /usr/portage/.git ]] ; then + cd /usr/portage && git init > /dev/null 2>&1 + git remote add origin git://anongit.gentoo.org/repo/gentoo.git + git pull --depth=1 origin master + git branch -u origin/master master + rm -rf /usr/portage/profiles/updates + fi +} + +set_devmode_portage_tree() { + ln -sf /opt/kogaion-build/conf/intel/portage /etc/portage + ln -sf /etc/portage/make.conf.amd64-devel /etc/portage/make.conf + eselect profile set 1 + env-update + . /etc/profile +} + +main() { + fetch_devmode_portage_tree + set_devmode_portage_tree +} + +main diff --git a/iso b/iso deleted file mode 100755 index 86c20b3..0000000 --- a/iso +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env bash - -# Vasile needs root privileges and a proper kernel to run - -kernelconfig -checkroot - -prepareiso () { - # we really need this folder as quick as possible - mkdir -p "$isosyncdir" - # create an empty 20GB ext4 fs were our rootfs will stay - dd if=/dev/zero of=""$isosyncdir".img" bs=50M count=400 - mkfs.ext4 ""$isosyncdir".img" - # create live iso layout - mkdir -p "$isostagingdir" - mkdir -p "$isobootdir" - mkdir -p "$isoefibootdir" - mkdir -p "$isoliveosdir" - mkdir -p "$isosupersquashdir" - mkdir -p "$isolivesqfsdir" - # mount && copy core stage 4 image - mount -t squashfs "$chrootx64" "$isostagingdir" - mount -t ext4 ""$isosyncdir".img" "$isosyncdir" - rsync -aHAXr --progress "$isostagingdir/" "$isosyncdir/" - # copy kernel into cdroot - cp -avx ""$isosyncdir"/boot/"$isokernelname"" ""$isorootdir"/boot/vmlinuz" - # generate live initramfs - isostart - isoramfs - isostop - # generate system initramfs - isostart - systemramfs - isostop - # copy live initramfs into cdroot - mv ""$isosyncdir"/boot/"$isodracutrd"" ""$isorootdir"/boot/initrd" - # generate live efi image - isostart - isoefiimg - isostop - # copy efi image into cdroot - mv ""$isosyncdir"/root/bootx64.efi" "$isoefibootdir" - chmod 755 ""$isoefibootdir"/bootx64.efi" - # configure portage && give up control for package / desktop environment installation - isostart - isooverlays - isobuildsystem - isousertree - isochroot - isostop - # unmount rootfs before compression - umount -l "$isosyncdir" > /dev/null 2>&1 - # move rootfs in place - mv ""$isosyncdir".img" "$isolivesqfsdir" - # squash rootfs with best compression - mksquashfs "$isosupersquashdir" ""$isorootdir"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100% - # move squashed rootfs in place - mv ""$isorootdir/"squashfs.img" "$isoliveosdir" -} - -bootcoreiso () { - # configure live bootloader - git clone https://gitlab.com/"$releasename"/boot-core.git "$bootcorepath" - cp -avx "$bootcorefiles" "$isorootdir" -} - -cleanupiso () { - umount "$isostagingdir" - rm -rf "$isosyncdir" - rm -rf "$isostagingdir" - rm -rf "$isosupersquashdir" - rm -rf "$bootcorepath" -} - -makeiso () { - grub2-mkrescue -o ""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch".iso" "$isorootdir" -} - -main () { - chrootchecksum - prepareiso - bootcoreiso - cleanupiso - makeiso -} - -main diff --git a/libvasile-kogaion b/libvasile-kogaion index 59baf9c..d187456 100755 --- a/libvasile-kogaion +++ b/libvasile-kogaion @@ -79,6 +79,7 @@ chrootstart () { } chrootdevtree () { + echo "" echo "injecting full portage tree into build environment" echo "" sleep 1 @@ -147,6 +148,7 @@ isostop () { } isousertree () { + echo "" echo "injecting minimal portage tree into environment (user mode)" echo "" sleep 1 diff --git a/modereset b/modereset new file mode 100755 index 0000000..6fad670 --- /dev/null +++ b/modereset @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +reset_current_mode() { + if [ -d /usr/portage/.git ] ; then + rm -rf /usr/portage/* + rm -rf /usr/portage/.git* + rm /etc/portage/make.conf + rm /etc/portage/make.profile + rm /etc/portage + fi +} + +main () { + reset_current_mode +} +main diff --git a/resetmode b/resetmode deleted file mode 100755 index 6fad670..0000000 --- a/resetmode +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -reset_current_mode() { - if [ -d /usr/portage/.git ] ; then - rm -rf /usr/portage/* - rm -rf /usr/portage/.git* - rm /etc/portage/make.conf - rm /etc/portage/make.profile - rm /etc/portage - fi -} - -main () { - reset_current_mode -} -main diff --git a/usermode b/usermode deleted file mode 100755 index 6a8e925..0000000 --- a/usermode +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -fetch_usermode_portage_tree() { - if [[ ! -d /usr/portage/.git ]] ; then - cd /usr/portage && git init > /dev/null 2>&1 - git remote add origin git://anongit.gentoo.org/repo/gentoo.git - git config core.sparsecheckout true - echo "profiles/*" >> .git/info/sparse-checkout - echo "metadata/*" >> .git/info/sparse-checkout - echo "eclass/*" >> .git/info/sparse-checkout - echo ".gitignore" >> .git/info/sparse-checkout - git pull --depth=1 origin master - git branch -u origin/master master - rm -rf /usr/portage/profiles/updates - fi -} - -set_usermode_portage_tree() { - ln -sf /opt/kogaion-build/conf/intel/portage /etc/portage - ln -sf /etc/portage/make.conf.amd64-user /etc/portage/make.conf - eselect profile set 1 - env-update - . /etc/profile -} - -main() { - fetch_usermode_portage_tree - set_usermode_portage_tree -} - -main diff --git a/usermodeset b/usermodeset new file mode 100755 index 0000000..6a8e925 --- /dev/null +++ b/usermodeset @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +fetch_usermode_portage_tree() { + if [[ ! -d /usr/portage/.git ]] ; then + cd /usr/portage && git init > /dev/null 2>&1 + git remote add origin git://anongit.gentoo.org/repo/gentoo.git + git config core.sparsecheckout true + echo "profiles/*" >> .git/info/sparse-checkout + echo "metadata/*" >> .git/info/sparse-checkout + echo "eclass/*" >> .git/info/sparse-checkout + echo ".gitignore" >> .git/info/sparse-checkout + git pull --depth=1 origin master + git branch -u origin/master master + rm -rf /usr/portage/profiles/updates + fi +} + +set_usermode_portage_tree() { + ln -sf /opt/kogaion-build/conf/intel/portage /etc/portage + ln -sf /etc/portage/make.conf.amd64-user /etc/portage/make.conf + eselect profile set 1 + env-update + . /etc/profile +} + +main() { + fetch_usermode_portage_tree + set_usermode_portage_tree +} + +main diff --git a/vasile-kogaion b/vasile-kogaion index 316b80c..0ba009e 100755 --- a/vasile-kogaion +++ b/vasile-kogaion @@ -22,7 +22,7 @@ export local overlaydir="overlaydir" export local chrootuser="root" export local chroottarget="${@:2}" export local chrootbuildtarget="emerge -kav "$chroottarget"" -export local chrootdevtree="/usr/share/vasile-kogaion/devmode" +export local chrootdevtree="/usr/share/vasile-kogaion/devmodeset" export local chrootmainoverlay="layman -f -a "$releasename"-"$releasetarget" -o https://gitlab.com/"$releasename"/"$releasename"-"$releasetarget"/raw/master/overlay.xml" export local chrootbuildgit="cd /opt && git clone https://gitlab.com/"$releasename"/"$releasename"-build.git" @@ -33,7 +33,7 @@ export local bootcorefiles="/tmp/bootcore/cdroot/boot" export local isouser="root" export local isotarget="${@:2}" export local isoinstalltarget="emerge -Kav "$isotarget"" -export local isousertree="/usr/share/vasile-kogaion/usermode" +export local isousertree="/usr/share/vasile-kogaion/usermodeset" export local isomainoverlay="layman -f -a "$releasename"-"$releasetarget" -o https://gitlab.com/"$releasename"/"$releasename"-"$releasetarget"/raw/master/overlay.xml" export local isobuildgit="cd /opt && git clone https://gitlab.com/"$releasename"/"$releasename"-build.git" @@ -56,24 +56,24 @@ export local dracutcmd="dracut -N -o systemd -o systemd-initrd -o systemd-networ source /usr/lib/vasile-kogaion/libvasile-kogaion case $1 in - --build) source /usr/share/vasile-kogaion/build + --build) source /usr/share/vasile-kogaion/buildpkg ;; - --iso) source /usr/share/vasile-kogaion/iso + --iso) source /usr/share/vasile-kogaion/buildiso ;; - --usermode) source /usr/share/vasile-kogaion/resetmode - source /usr/share/vasile-kogaion/usermode + --usermode) source /usr/share/vasile-kogaion/modereset + source /usr/share/vasile-kogaion/usermodeset ;; - --devmode) source /usr/share/vasile-kogaion/resetmode - source /usr/share/vasile-kogaion/devmode + --devmode) source /usr/share/vasile-kogaion/modereset + source /usr/share/vasile-kogaion/devmodeset ;; --help) echo -e "" echo -e "Usage: vasile-kogaion [options]" echo -e "" echo -e "Options:" - echo -e "--build : build package/target in a clean squashed core" - echo -e "--iso : build iso based on clean squashed core + targets" - echo -e "--usermode : switch INSTALLED Kogaion system to usermode (use binary packages from repositories)" - echo -e "--devmode : switch INSTALLED Kogaion system to devmode (use source packages from portage tree )" + echo -e "--buildpkg : build package/target in a clean squashed core" + echo -e "--buildiso : build iso based on clean squashed core + targets" + echo -e "--usermodeset : switch INSTALLED Kogaion system to usermode (use binary packages from repositories)" + echo -e "--devmodeset : switch INSTALLED Kogaion system to devmode (use source packages from portage tree )" echo -e "--help : display this help and exit" echo -e "" ;; -- cgit v1.2.3