From 69c168189bb006835794755fd026f83c723106c7 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 12:42:37 +0100 Subject: drop x86 on kogaion --- build32 | 40 --------------- iso32 | 78 ----------------------------- libvasile | 169 +++++--------------------------------------------------------- vasile | 74 ++++----------------------- 4 files changed, 21 insertions(+), 340 deletions(-) delete mode 100755 build32 delete mode 100755 iso32 diff --git a/build32 b/build32 deleted file mode 100755 index 56a391b..0000000 --- a/build32 +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -# Vasile needs root privileges and a proper kernel to run - -checkroot -kernelconfig - -chrootpreparex86 () { - # 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 - chrootstartx86 - 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 () { - chrootchecksumx86 - chrootpreparex86 - chrootoverlaysx86 - chrootbuildsystemx86 - chrootbuildx86 - chrootx86 - chrootstop -} - -main -exit 0 diff --git a/iso32 b/iso32 deleted file mode 100755 index f8e132b..0000000 --- a/iso32 +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env bash - -# Vasile needs root privileges and a proper kernel to run - -kernelconfig -checkroot - -prepareisox86 () { - # we really need this folder as quick as possible - mkdir -p "$isosyncdirx86" - # create an empty 20GB ext4 fs were our rootfs will stay - dd if=/dev/zero of=""$isosyncdirx86".img" bs=50M count=400 - mkfs.ext4 ""$isosyncdirx86".img" - # create live iso layout - mkdir -p "$isostagingdirx86" - mkdir -p "$isobootdirx86" - mkdir -p "$isoliveosdirx86" - mkdir -p "$isosupersquashdirx86" - mkdir -p "$isolivesqfsdirx86" - # mount && copy core stage 4 image - mount -t squashfs "$chrootx86" "$isostagingdirx86" - mount -t ext4 ""$isosyncdirx86".img" "$isosyncdirx86" - rsync -aHAXr --progress "$isostagingdirx86/" "$isosyncdirx86/" - # copy kernel into cdroot - cp -avx ""$isosyncdirx86"/boot/"$isokernelnamex86"" ""$isorootdirx86"/boot/vmlinuz" - # generate live initramfs - isostartx86 - isoramfsx86 - isostopx86 - # generate system initramfs - isostartx86 - systemramfsx86 - isostopx86 - # copy live initramfs - mv ""$isosyncdirx86"/boot/"$isodracutrd"" ""$isorootdirx86"/boot/initrd" - # configure portage && give up control for package / desktop environment installation - isostartx86 - isooverlaysx86 - isobuildsystemx86 - isochrootx86 - isostopx86 - # umount rootfs before compression - umount -l "$isosyncdirx86" > /dev/null 2>&1 - # move rootfs in place - mv ""$isosyncdirx86".img" "$isolivesqfsdirx86" - # squash rootfs with best compression - mksquashfs "$isosupersquashdirx86" ""$isorootdirx86"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100% - # move squashed rootfs in place - mv ""$isorootdirx86"/squashfs.img" "$isoliveosdirx86" -} - -bootcoreisox86 () { - # configure live bootloader - git clone https://gitlab.com/"$releasename"/boot-core.git "$bootcorepath" - cp -avx "$bootcorefiles" "$isorootdirx86" -} - -cleanupisox86 () { - umount "$isostagingdirx86" - rm -rf "$isosyncdirx86" - rm -rf "$isostagingdirx86" - rm -rf "$bootcorepath" - rm -rf "$isosupersquashdirx86" -} - -makeisox86 () { - grub2-mkrescue -o ""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx86".iso" "$isorootdirx86" -} - -main () { - chrootchecksumx86 - prepareisox86 - bootcoreisox86 - cleanupisox86 - makeisox86 -} - -main diff --git a/libvasile b/libvasile index 3259c2d..11c3af5 100755 --- a/libvasile +++ b/libvasile @@ -1,4 +1,4 @@ -# generic arch independent functions (used for both build && iso creation) +# generic functions (used for both build && iso creation) kernelconfig () { if [[ $(zgrep 'CONFIG_OVERLAYFS_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then @@ -25,51 +25,28 @@ checkroot () { fi } -# generic x64 functions (used for both build && iso creation) - chrootchecksumx64 () { while : true ; do if [[ -f "$chrootx64" && -f "$chrootx64md5" ]] ; then - echo "good, x64 squashed chroot && checksum file found ... verifying integrity" + echo "good, squashed chroot && checksum file found ... verifying integrity" echo "" if [[ "$(md5sum -c "$chrootx64md5")" ]] ; then - echo "good, x64 squashed chroot checksum passed ... starting engines" + echo "good, squashed chroot checksum passed ... starting engines" echo "" sleep 1 break else - echo "ooops, x64 squashed chroot checksum failed ... aborting" + echo "ooops, squashed chroot checksum failed ... aborting" exit 1 fi else - echo "ooops, x64 squashed chroot or checksum file not found ... aborting" + echo "ooops, squashed chroot or checksum file not found ... aborting" exit 1 fi done } -chrootchecksumx86 () { - while : true ; do - if [[ -f "$chrootx86" && -f "$chrootx86md5" ]] ; then - echo "good, x86 squashed chroot && checksum file found ... verifying integrity" - echo "" - if [[ "$(md5sum -c "$chrootx86md5")" ]] ; then - echo "good, x86 squashed chroot checksum found ... starting engines" - echo "" - sleep 1 - break - else - echo "ooops, x86 squashed chroot checksum failed ... aborting" - exit 1 - fi - else - echo "ooops, x86 squashed chroot or checksum file not found ... aborting" - exit 1 - fi - done -} - -# arch independent build functions +# build functions chrootstop () { umount -l "$overlaydir"/proc > /dev/null 2>&1 @@ -84,8 +61,6 @@ chrootstop () { umount -l "$rodir" > /dev/null 2>&1 } -# x64 specific build functions - chrootstartx64 () { mount -t squashfs "$chrootx64" "$rodir" if [[ "$(uname -r | cut -d . -f1,2)" = "3.14" ]] ; then @@ -104,19 +79,19 @@ chrootstartx64 () { } chroottreex64 () { - echo "injecting full portage tree into x64 environment" + echo "injecting full portage tree into build environment" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chroottree" } chrootoverlaysx64 () { - echo "injecting "$releasename" "$releasetarget" overlay into x64 environment" + echo "injecting "$releasename" "$releasetarget" overlay into build environment" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootmainoverlay" } chrootbuildsystemx64 () { - echo "injecting "$releasename" x64 buildsystem && setting up portage" + echo "injecting "$releasename" buildsystem && setting up portage" echo "" sleep 1 for cmd in "$chrootbuildgit" "$chrootportageconfig" "$chrootmakeconfx64" "$chrootprofile" "$chrootenvupdate" ; do @@ -126,7 +101,7 @@ chrootbuildsystemx64 () { chrootbuildx64 () { echo "" - echo "x64 Environment is up && running ... building targets" + echo "Environment is up && running ... building targets" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildtarget" } @@ -150,73 +125,7 @@ chrootx64 () { chroot "$overlaydir" su - "$chrootuser" } -# x86 specific build functions - -chrootstartx86 () { - mount -t squashfs "$chrootx86" "$rodir" - if [[ "$(uname -r | cut -d . -f1,2)" = "3.14" ]] ; then - mount -t overlayfs -o lowerdir="$rodir",upperdir="$rwdir" overlayfs "$overlaydir" - else # kernel version equal or above 3.18 - mount -t overlay -o lowerdir="$rodir",upperdir="$rwdir",workdir="$workdir" overlay "$overlaydir" - fi - mount -o bind packages "$overlaydir"/usr/portage/packages - mount -o bind distfiles "$overlaydir"/usr/portage/distfiles - mount -t proc proc "$overlaydir"/proc - mount -t sysfs sysfs "$overlaydir"/sys - mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$overlaydir"/dev - mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$overlaydir"/dev/pts - mount -t tmpfs -o nosuid,nodev none "$overlaydir"/dev/shm - mount -t tmpfs -o nosuid,nodev,noexec none "$overlaydir"/tmp -} - -chrottreex86 () { - echo "injecting full portage tree into x86 environment" - sleep 1 - linux32 chroot "$overlaydir" su - "$chrootuser" -c "$chroottree" -} - -chrootoverlaysx86 () { - echo "injecting "$releasename" "$releasetarget" overlay into x86 environment" - sleep 1 - linux32 chroot "$overlaydir" su - "$chrootuser" -c "$chrootmainoverlay" -} - -chrootbuildsystemx86 () { - echo "injecting "$releasename" x86 buildsystem && setting up portage" - echo "" - sleep 1 - for cmd in "$chrootbuildgit" "$chrootportageconfig" "$chrootmakeconfx86" "$chrootprofile" "$chrootenvupdate" ; do - linux32 chroot "$overlaydir" su - "$chrootuser" -c "$cmd" - done -} - -chrootbuildx86 () { - echo "" - echo "x86 environment is up && running ... building targets" - sleep 1 - chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildtarget" -} - -chrootx86 () { - echo -e "" - echo -e "#################################################################" - echo -e "# ENTERING CHROOT ENV FOR YOU TO PUSH BUILT PACKAGES #" - echo -e "# OR TO FIX EVENTUAL BUILD ERRORS #" - echo -e "#################################################################" - echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" - echo -e "#################################################################" - echo -e "# NEXT RUN OF THIS SCRIPT WILL DESTROY ALL YOUR WORK #" - echo -e "# DO NOT EXIT CHROOT UNTIL ALL PACKAGES ARE PUSHED TO REPOS #" - echo -e "# OR, IN CASE OF BUILD FAILURES, UNTIL ALL FIXES ARE COMMITED #" - echo -e "#################################################################" - echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" - echo -e "#################################################################" - echo -e "" - echo -e "" - linux32 chroot "$overlaydir" su - "$chrootuser" -} - -# x64 specific iso functions +# iso functions isostartx64 () { mount -o bind packages "$isosyncdirx64"/usr/portage/packages @@ -245,7 +154,7 @@ isooverlaysx64 () { } isobuildsystemx64 () { - echo "injecting "$releasename" x64 buildsystem && setting up portage" + echo "injecting "$releasename" buildsystem && setting up portage" echo "" sleep 1 for cmd in "$isobuildgit" "$isoportageconfig" "$isomakeconfx64" "$isoprofile" "$isoenvupdate" ; do @@ -273,57 +182,3 @@ isochrootx64 () { echo -e "" chroot "$isosyncdirx64" su - "$isouser" } - -# x86 specific iso functions - -isostartx86 () { - mount -o bind packages "$isosyncdirx86"/usr/portage/packages - mount -t proc proc "$isosyncdirx86"/proc - mount -t sysfs sysfs "$isosyncdirx86"/sys - mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$isosyncdirx86"/dev - mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$isosyncdirx86"/dev/pts - mount -t tmpfs -o nosuid,nodev none "$isosyncdirx86"/dev/shm - mount -t tmpfs -o nosuid,nodev,noexec none "$isosyncdirx86"/tmp -} - -isostopx86 () { - umount -l "$isosyncdirx86"/proc > /dev/null 2>&1 - umount -l "$isosyncdirx86"/sys > /dev/null 2>&1 - umount -l "$isosyncdirx86"/dev/pts > /dev/null 2>&1 - umount -l "$isosyncdirx86"/dev/shm > /dev/null 2>&1 - umount -l "$isosyncdirx86"/dev > /dev/null 2>&1 - umount -l "$isosyncdirx86"/tmp > /dev/null 2>&1 - umount -l "$isosyncdirx86"/usr/portage/packages > /dev/null 2>&1 -} - -isooverlaysx86 () { - echo "injecting "$releasename" "$releasetarget" overlay into x86 environment" - sleep 1 - linux32 chroot "$isosyncdirx86" su - "$isouser" -c "$isomainoverlay" -} - -isobuildsystemx86 () { - echo "injecting "$releasename" x86 buildsystem && setting up portage" - echo "" - sleep 1 - for cmd in "$isobuildgit" "$isoportageconfig" "$isomakeconfx86" "$isoprofile" "$isoenvupdate" ; do - linux32 chroot "$isosyncdirx86" su - "$isouser" -c "$cmd" - done -} - -isoramfsx86 () { - linux32 chroot "$isosyncdirx86" su - "$isouser" -c "$isodracutcmd" -} - -systemramfsx86 () { - linux32 chroot "$isosyncdirx86" su - "$isouser" -c "dracutcmdx86" -} - -isochrootx86 () { - echo -e "" - echo -e "DROPPING YOU TO A ROOT SHELL INTO ISO ENVIRONMENT" - echo -e "INSTALL APPS & TARGETS & DES YOU WANT INSIDE ISO" - echo -e "EXIT WHEN YOU'RE DONE AND I'LL CREATE THE IMAGE" - echo -e "" - linux32 chroot "$isosyncdirx86" su - "$isouser" -} diff --git a/vasile b/vasile index d99f4f9..f0190a4 100755 --- a/vasile +++ b/vasile @@ -6,35 +6,14 @@ # generic variables -echo -e "" -echo -e "Choose the system core you want me to use" -echo -e "" -OPTIONS="Kogaion Argent" -select systemcore in $OPTIONS; do - if [[ "$systemcore" = "Kogaion" ]] ; then - echo -e "" - echo -e "Adjusting variables for Kogaion Desktop 3" - export local releasename="kogaion" - export local releasetarget="desktop" - export local releaseversion="3" - export local kernelver="3.14.50-"$releasename"" - break - elif [[ "$systemcore" = "Argent" ]] ; then - echo -e "" - echo -e "Adjusting variables for Argent Server 2" - export local releasename="argent" - export local releasetarget="server" - export local releaseversion="2" - export local kernelver="3.14.51-"$releasename"" - break - else - echo -e "" - echo -e "Wrong choice, bye bye" - exit 1 - fi -done +export local releasename="kogaion" +export local releasetarget="desktop" +export local releaseversion="3" +export local kernelver="3.14.50-"$releasename"" +export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" +export local chrootx64md5=""$chrootx64".md5" -# arch independent build variables +# build variables export local rodir="rodir" export local rwdir="rwdir" @@ -47,10 +26,11 @@ export local chroottree="/usr/share/vasile/devmod" 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" export local chrootportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" +export local chrootmakeconfx64="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-devel /etc/portage/make.conf" export local chrootenvupdate="/usr/sbin/env-update && . /etc/profile" export local chrootprofile="eselect profile set 1" -# arch independent iso variables +# iso variables export local bootcorepath="/tmp/bootcore" export local bootcorefiles="/tmp/bootcore/cdroot/boot" @@ -65,21 +45,6 @@ export local isoprofile="eselect profile set 1" export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver"" export local isodracutrd="initramfs-"$kernelver".img" export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" - -# x64 specific build variables - -export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" -export local chrootx64md5=""$chrootx64".md5" -export local chrootmakeconfx64="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-devel /etc/portage/make.conf" - -# x86 specific build variables - -export local chrootx86=""$releasename"_"$releaseversion"_core_x86.squashfs" -export local chrootx86md5=""$chrootx86".md5" -export local chrootmakeconfx86="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.x86-devel /etc/portage/make.conf" - -# x64 specific iso variables - export local isomainarchx64="x86_64" export local isomakeconfx64="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-user /etc/portage/make.conf" export local isorootdirx64=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx64"" @@ -94,40 +59,19 @@ export local isoefibootdirx64=""$isorootdirx64"/efi/boot" export local dracutrdx64="initramfs-genkernel-"$isomainarchx64"-"$kernelver"" export local dracutcmdx64="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrdx64""" -# x86 specific iso variables - -export local isomainarchx86="x86" -export local isomakeconfx86="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.x86-user /etc/portage/make.conf" -export local isorootdirx86=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx86"" -export local isokernelnamex86="kernel-genkernel-"$isomainarchx86"-"$kernelver"" -export local isostagingdirx86="/tmp/"$isorootdirx86"" -export local isosupersquashdirx86=""$isorootdirx86"/CDroot" -export local isolivesqfsdirx86=""$isosupersquashdirx86"/LiveOS" -export local isoliveosdirx86=""$isorootdirx86"/LiveOS" -export local isosyncdirx86=""$isorootdirx86"/rootfs" -export local isobootdirx86=""$isorootdirx86"/boot/grub" -export local dracutrdx86="initramfs-genkernel-"$isomainarchx86"-"$kernelver"" -export local dracutcmdx86="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrdx86""" - source /usr/lib/vasile/libvasile case $1 in --build64) source /usr/share/vasile/build64 ;; - --build32) source /usr/share/vasile/build32 - ;; --iso64) source /usr/share/vasile/iso64 ;; - --iso32) source /usr/share/vasile/iso32 - ;; --help) echo -e "" echo -e "Usage: vasile [options]" echo -e "" echo -e "Options:" echo -e "--build64 : build package/target in a clean x64 squashed core" - echo -e "--build32 : build package/target in a clean x86 squashed core" echo -e "--iso64 : build x64 iso based on clean squashed core + targets" - echo -e "--iso32 : build x86 iso based on clean squashed core + targets" echo -e "--help : display this help and exit" echo -e "" ;; -- cgit v1.2.3 From 90c33e09c1e1868b80f3594475e90c1ea765c99e Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 12:45:15 +0100 Subject: adjust devmod helper script --- devmod | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/devmod b/devmod index b44f15c..7bd644e 100755 --- a/devmod +++ b/devmod @@ -1,10 +1,13 @@ #!/usr/bin/env bash fetch_portage_tree() { - cd /usr/portage && git init - git remote add origin git://anongit.gentoo.org/repo/gentoo.git - git pull --depth=1 origin master - git branch -u origin/master master + 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 > /dev/null 2>&1 + git branch -u origin/master master > /dev/null 2>&1 + rm -rf /usr/portage/profiles/updates > /dev/null 2>&1 + fi } main() { -- cgit v1.2.3 From d4d566b85fb34ca4f57fee06c5f4b52bb675d687 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 12:48:50 +0100 Subject: allow argent version of vasile to be installed side by side --- build | 40 ++++++++++++++++++++++++++++++ build64 | 40 ------------------------------ iso | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ iso64 | 86 ----------------------------------------------------------------- vasile | 8 +++--- 5 files changed, 130 insertions(+), 130 deletions(-) create mode 100755 build delete mode 100755 build64 create mode 100755 iso delete mode 100755 iso64 diff --git a/build b/build new file mode 100755 index 0000000..c4c507f --- /dev/null +++ b/build @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# Vasile needs root privileges and a proper kernel to run + +kernelconfig +checkroot + +chrootpreparex64 () { + # 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 + chrootstartx64 + 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 () { + chrootchecksumx64 + chrootpreparex64 + chrootoverlaysx64 + chrootbuildsystemx64 + chrootbuildx64 + chrootx64 + chrootstop +} + +main +exit 0 diff --git a/build64 b/build64 deleted file mode 100755 index c4c507f..0000000 --- a/build64 +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -# Vasile needs root privileges and a proper kernel to run - -kernelconfig -checkroot - -chrootpreparex64 () { - # 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 - chrootstartx64 - 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 () { - chrootchecksumx64 - chrootpreparex64 - chrootoverlaysx64 - chrootbuildsystemx64 - chrootbuildx64 - chrootx64 - chrootstop -} - -main -exit 0 diff --git a/iso b/iso new file mode 100755 index 0000000..462c67b --- /dev/null +++ b/iso @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +# Vasile needs root privileges and a proper kernel to run + +kernelconfig +checkroot + +prepareisox64 () { + # we really need this folder as quick as possible + mkdir -p "$isosyncdirx64" + # create an empty 20GB ext4 fs were our rootfs will stay + dd if=/dev/zero of=""$isosyncdirx64".img" bs=50M count=400 + mkfs.ext4 ""$isosyncdirx64".img" + # create live iso layout + mkdir -p "$isostagingdirx64" + mkdir -p "$isobootdirx64" + mkdir -p "$isoefibootdirx64" + mkdir -p "$isoliveosdirx64" + mkdir -p "$isosupersquashdirx64" + mkdir -p "$isolivesqfsdirx64" + # mount && copy core stage 4 image + mount -t squashfs "$chrootx64" "$isostagingdirx64" + mount -t ext4 ""$isosyncdirx64".img" "$isosyncdirx64" + rsync -aHAXr --progress "$isostagingdirx64/" "$isosyncdirx64/" + # copy kernel into cdroot + cp -avx ""$isosyncdirx64"/boot/"$isokernelnamex64"" ""$isorootdirx64"/boot/vmlinuz" + # generate live initramfs + isostartx64 + isoramfsx64 + isostopx64 + # generate system initramfs + isostartx64 + systemramfsx64 + isostopx64 + # copy live initramfs into cdroot + mv ""$isosyncdirx64"/boot/"$isodracutrd"" ""$isorootdirx64"/boot/initrd" + # generate live efi image + isostartx64 + isoefiimgx64 + isostopx64 + # copy efi image into cdroot + mv ""$isosyncdirx64"/root/bootx64.efi" "$isoefibootdirx64" + chmod 755 ""$isoefibootdirx64"/bootx64.efi" + # configure portage && give up control for package / desktop environment installation + isostartx64 + isooverlaysx64 + isobuildsystemx64 + isochrootx64 + isostopx64 + # unmount rootfs before compression + umount -l "$isosyncdirx64" > /dev/null 2>&1 + # move rootfs in place + mv ""$isosyncdirx64".img" "$isolivesqfsdirx64" + # squash rootfs with best compression + mksquashfs "$isosupersquashdirx64" ""$isorootdirx64"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100% + # move squashed rootfs in place + mv ""$isorootdirx64/"squashfs.img" "$isoliveosdirx64" +} + +bootcoreisox64 () { + # configure live bootloader + git clone https://gitlab.com/"$releasename"/boot-core.git "$bootcorepath" + cp -avx "$bootcorefiles" "$isorootdirx64" +} + +cleanupisox64 () { + umount "$isostagingdirx64" + rm -rf "$isosyncdirx64" + rm -rf "$isostagingdirx64" + rm -rf "$isosupersquashdirx64" + rm -rf "$bootcorepath" +} + +makeisox64 () { + grub2-mkrescue -o ""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx64".iso" "$isorootdirx64" +} + +main () { + chrootchecksumx64 + prepareisox64 + bootcoreisox64 + cleanupisox64 + makeisox64 +} + +main diff --git a/iso64 b/iso64 deleted file mode 100755 index 462c67b..0000000 --- a/iso64 +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env bash - -# Vasile needs root privileges and a proper kernel to run - -kernelconfig -checkroot - -prepareisox64 () { - # we really need this folder as quick as possible - mkdir -p "$isosyncdirx64" - # create an empty 20GB ext4 fs were our rootfs will stay - dd if=/dev/zero of=""$isosyncdirx64".img" bs=50M count=400 - mkfs.ext4 ""$isosyncdirx64".img" - # create live iso layout - mkdir -p "$isostagingdirx64" - mkdir -p "$isobootdirx64" - mkdir -p "$isoefibootdirx64" - mkdir -p "$isoliveosdirx64" - mkdir -p "$isosupersquashdirx64" - mkdir -p "$isolivesqfsdirx64" - # mount && copy core stage 4 image - mount -t squashfs "$chrootx64" "$isostagingdirx64" - mount -t ext4 ""$isosyncdirx64".img" "$isosyncdirx64" - rsync -aHAXr --progress "$isostagingdirx64/" "$isosyncdirx64/" - # copy kernel into cdroot - cp -avx ""$isosyncdirx64"/boot/"$isokernelnamex64"" ""$isorootdirx64"/boot/vmlinuz" - # generate live initramfs - isostartx64 - isoramfsx64 - isostopx64 - # generate system initramfs - isostartx64 - systemramfsx64 - isostopx64 - # copy live initramfs into cdroot - mv ""$isosyncdirx64"/boot/"$isodracutrd"" ""$isorootdirx64"/boot/initrd" - # generate live efi image - isostartx64 - isoefiimgx64 - isostopx64 - # copy efi image into cdroot - mv ""$isosyncdirx64"/root/bootx64.efi" "$isoefibootdirx64" - chmod 755 ""$isoefibootdirx64"/bootx64.efi" - # configure portage && give up control for package / desktop environment installation - isostartx64 - isooverlaysx64 - isobuildsystemx64 - isochrootx64 - isostopx64 - # unmount rootfs before compression - umount -l "$isosyncdirx64" > /dev/null 2>&1 - # move rootfs in place - mv ""$isosyncdirx64".img" "$isolivesqfsdirx64" - # squash rootfs with best compression - mksquashfs "$isosupersquashdirx64" ""$isorootdirx64"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100% - # move squashed rootfs in place - mv ""$isorootdirx64/"squashfs.img" "$isoliveosdirx64" -} - -bootcoreisox64 () { - # configure live bootloader - git clone https://gitlab.com/"$releasename"/boot-core.git "$bootcorepath" - cp -avx "$bootcorefiles" "$isorootdirx64" -} - -cleanupisox64 () { - umount "$isostagingdirx64" - rm -rf "$isosyncdirx64" - rm -rf "$isostagingdirx64" - rm -rf "$isosupersquashdirx64" - rm -rf "$bootcorepath" -} - -makeisox64 () { - grub2-mkrescue -o ""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx64".iso" "$isorootdirx64" -} - -main () { - chrootchecksumx64 - prepareisox64 - bootcoreisox64 - cleanupisox64 - makeisox64 -} - -main diff --git a/vasile b/vasile index f0190a4..39cc017 100755 --- a/vasile +++ b/vasile @@ -59,15 +59,15 @@ export local isoefibootdirx64=""$isorootdirx64"/efi/boot" export local dracutrdx64="initramfs-genkernel-"$isomainarchx64"-"$kernelver"" export local dracutcmdx64="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrdx64""" -source /usr/lib/vasile/libvasile +source /usr/lib/vasile-kogaion/libvasile case $1 in - --build64) source /usr/share/vasile/build64 + --build) source /usr/share/vasile-kogaion/build ;; - --iso64) source /usr/share/vasile/iso64 + --iso) source /usr/share/vasile-kogaion/iso ;; --help) echo -e "" - echo -e "Usage: vasile [options]" + echo -e "Usage: vasile-kogaion [options]" echo -e "" echo -e "Options:" echo -e "--build64 : build package/target in a clean x64 squashed core" -- cgit v1.2.3 From cf842e4d5818db14b563eb5b580e138d6fbb46c4 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 12:54:46 +0100 Subject: change exec name and libname to allow argent to coexist --- libvasile | 184 ------------------------------------------------------ libvasile-kogaion | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ vasile | 82 ------------------------ vasile-kogaion | 82 ++++++++++++++++++++++++ 4 files changed, 266 insertions(+), 266 deletions(-) delete mode 100755 libvasile create mode 100755 libvasile-kogaion delete mode 100755 vasile create mode 100755 vasile-kogaion diff --git a/libvasile b/libvasile deleted file mode 100755 index 11c3af5..0000000 --- a/libvasile +++ /dev/null @@ -1,184 +0,0 @@ -# generic functions (used for both build && iso creation) - -kernelconfig () { - if [[ $(zgrep 'CONFIG_OVERLAYFS_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then - # if you use 3.18 LTS or newer kernels, change CONFIG_OVERLAYFS_FS to CONFIG_OVERLAY_FS - echo "" - echo "Kernel configuration seems OK, moving on" - echo "" - sleep 1 - else - echo "" - echo "Vasile needs OVERLAYFS && SQUASHFS && LOOP DEVICES to work" - echo "Please rebuild the kernel with those activated to use it" - echo "" - exit 1 - fi -} - -checkroot () { - if [[ "$(whoami)" != root ]] ; then - echo "" - echo "You're not root?...No cookies for you, go away !!!" - echo "" - exit 1 - fi -} - -chrootchecksumx64 () { - while : true ; do - if [[ -f "$chrootx64" && -f "$chrootx64md5" ]] ; then - echo "good, squashed chroot && checksum file found ... verifying integrity" - echo "" - if [[ "$(md5sum -c "$chrootx64md5")" ]] ; then - echo "good, squashed chroot checksum passed ... starting engines" - echo "" - sleep 1 - break - else - echo "ooops, squashed chroot checksum failed ... aborting" - exit 1 - fi - else - echo "ooops, squashed chroot or checksum file not found ... aborting" - exit 1 - fi - done -} - -# build functions - -chrootstop () { - umount -l "$overlaydir"/proc > /dev/null 2>&1 - umount -l "$overlaydir"/sys > /dev/null 2>&1 - umount -l "$overlaydir"/dev/pts > /dev/null 2>&1 - umount -l "$overlaydir"/dev/shm > /dev/null 2>&1 - umount -l "$overlaydir"/dev > /dev/null 2>&1 - umount -l "$overlaydir"/tmp > /dev/null 2>&1 - umount -l "$overlaydir"/usr/portage/packages > /dev/null 2>&1 - umount -l "$overlaydir"/usr/portage/distfiles > /dev/null 2>&1 - umount -l "$overlaydir" > /dev/null 2>&1 - umount -l "$rodir" > /dev/null 2>&1 -} - -chrootstartx64 () { - mount -t squashfs "$chrootx64" "$rodir" - if [[ "$(uname -r | cut -d . -f1,2)" = "3.14" ]] ; then - mount -t overlayfs -o lowerdir="$rodir",upperdir="$rwdir" overlayfs "$overlaydir" - else # kernel version equal or above 3.18 - mount -t overlay -o lowerdir="$rodir",upperdir="$rwdir",workdir="$workdir" overlay "$overlaydir" - fi - mount -o bind packages "$overlaydir"/usr/portage/packages - mount -o bind distfiles "$overlaydir"/usr/portage/distfiles - mount -t proc proc "$overlaydir"/proc - mount -t sysfs sysfs "$overlaydir"/sys - mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$overlaydir"/dev - mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$overlaydir"/dev/pts - mount -t tmpfs -o nosuid,nodev none "$overlaydir"/dev/shm - mount -t tmpfs -o nosuid,nodev,noexec none "$overlaydir"/tmp -} - -chroottreex64 () { - echo "injecting full portage tree into build environment" - sleep 1 - chroot "$overlaydir" su - "$chrootuser" -c "$chroottree" -} - -chrootoverlaysx64 () { - echo "injecting "$releasename" "$releasetarget" overlay into build environment" - sleep 1 - chroot "$overlaydir" su - "$chrootuser" -c "$chrootmainoverlay" -} - -chrootbuildsystemx64 () { - echo "injecting "$releasename" buildsystem && setting up portage" - echo "" - sleep 1 - for cmd in "$chrootbuildgit" "$chrootportageconfig" "$chrootmakeconfx64" "$chrootprofile" "$chrootenvupdate" ; do - chroot "$overlaydir" su - "$chrootuser" -c "$cmd" - done -} - -chrootbuildx64 () { - echo "" - echo "Environment is up && running ... building targets" - sleep 1 - chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildtarget" -} - -chrootx64 () { - echo -e "" - echo -e "#################################################################" - echo -e "# ENTERING CHROOT ENV FOR YOU TO PUSH BUILT PACKAGES #" - echo -e "# OR TO FIX EVENTUAL BUILD ERRORS #" - echo -e "#################################################################" - echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" - echo -e "#################################################################" - echo -e "# NEXT RUN OF THIS SCRIPT WILL DESTROY ALL YOUR WORK #" - echo -e "# DO NOT EXIT CHROOT UNTIL ALL PACKAGES ARE PUSHED TO REPOS #" - echo -e "# OR, IN CASE OF BUILD FAILURES, UNTIL ALL FIXES ARE COMMITED #" - echo -e "#################################################################" - echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" - echo -e "#################################################################" - echo -e "" - echo -e "" - chroot "$overlaydir" su - "$chrootuser" -} - -# iso functions - -isostartx64 () { - mount -o bind packages "$isosyncdirx64"/usr/portage/packages - mount -t proc proc "$isosyncdirx64"/proc - mount -t sysfs sysfs "$isosyncdirx64"/sys - mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$isosyncdirx64"/dev - mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$isosyncdirx64"/dev/pts - mount -t tmpfs -o nosuid,nodev none "$isosyncdirx64"/dev/shm - mount -t tmpfs -o nosuid,nodev,noexec none "$isosyncdirx64"/tmp -} - -isostopx64 () { - umount -l "$isosyncdirx64"/proc > /dev/null 2>&1 - umount -l "$isosyncdirx64"/sys > /dev/null 2>&1 - umount -l "$isosyncdirx64"/dev/pts > /dev/null 2>&1 - umount -l "$isosyncdirx64"/dev/shm > /dev/null 2>&1 - umount -l "$isosyncdirx64"/dev > /dev/null 2>&1 - umount -l "$isosyncdirx64"/tmp > /dev/null 2>&1 - umount -l "$isosyncdirx64"/usr/portage/packages > /dev/null 2>&1 -} - -isooverlaysx64 () { - echo "injecting "$releasename" "$releasetarget" overlay into x64 environment" - sleep 1 - chroot "$isosyncdirx64" su - "$isouser" -c "$isomainoverlay" -} - -isobuildsystemx64 () { - echo "injecting "$releasename" buildsystem && setting up portage" - echo "" - sleep 1 - for cmd in "$isobuildgit" "$isoportageconfig" "$isomakeconfx64" "$isoprofile" "$isoenvupdate" ; do - chroot "$isosyncdirx64" su - "$isouser" -c "$cmd" - done -} - -isoramfsx64 () { - chroot "$isosyncdirx64" su - "$isouser" -c "$isodracutcmd" -} - -systemramfsx64 () { - chroot "$isosyncdirx64" su - "$isouser" -c "$dracutcmdx64" -} - -isoefiimgx64 () { - chroot "$isosyncdirx64" su - "$isouser" -c "$isoeficmd" -} - -isochrootx64 () { - echo -e "" - echo -e "DROPPING YOU TO A ROOT SHELL INTO ISO ENVIRONMENT" - echo -e "INSTALL APPS & TARGETS & DES YOU WANT INSIDE ISO" - echo -e "EXIT WHEN YOU'RE DONE AND I'LL CREATE THE IMAGE" - echo -e "" - chroot "$isosyncdirx64" su - "$isouser" -} diff --git a/libvasile-kogaion b/libvasile-kogaion new file mode 100755 index 0000000..11c3af5 --- /dev/null +++ b/libvasile-kogaion @@ -0,0 +1,184 @@ +# generic functions (used for both build && iso creation) + +kernelconfig () { + if [[ $(zgrep 'CONFIG_OVERLAYFS_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then + # if you use 3.18 LTS or newer kernels, change CONFIG_OVERLAYFS_FS to CONFIG_OVERLAY_FS + echo "" + echo "Kernel configuration seems OK, moving on" + echo "" + sleep 1 + else + echo "" + echo "Vasile needs OVERLAYFS && SQUASHFS && LOOP DEVICES to work" + echo "Please rebuild the kernel with those activated to use it" + echo "" + exit 1 + fi +} + +checkroot () { + if [[ "$(whoami)" != root ]] ; then + echo "" + echo "You're not root?...No cookies for you, go away !!!" + echo "" + exit 1 + fi +} + +chrootchecksumx64 () { + while : true ; do + if [[ -f "$chrootx64" && -f "$chrootx64md5" ]] ; then + echo "good, squashed chroot && checksum file found ... verifying integrity" + echo "" + if [[ "$(md5sum -c "$chrootx64md5")" ]] ; then + echo "good, squashed chroot checksum passed ... starting engines" + echo "" + sleep 1 + break + else + echo "ooops, squashed chroot checksum failed ... aborting" + exit 1 + fi + else + echo "ooops, squashed chroot or checksum file not found ... aborting" + exit 1 + fi + done +} + +# build functions + +chrootstop () { + umount -l "$overlaydir"/proc > /dev/null 2>&1 + umount -l "$overlaydir"/sys > /dev/null 2>&1 + umount -l "$overlaydir"/dev/pts > /dev/null 2>&1 + umount -l "$overlaydir"/dev/shm > /dev/null 2>&1 + umount -l "$overlaydir"/dev > /dev/null 2>&1 + umount -l "$overlaydir"/tmp > /dev/null 2>&1 + umount -l "$overlaydir"/usr/portage/packages > /dev/null 2>&1 + umount -l "$overlaydir"/usr/portage/distfiles > /dev/null 2>&1 + umount -l "$overlaydir" > /dev/null 2>&1 + umount -l "$rodir" > /dev/null 2>&1 +} + +chrootstartx64 () { + mount -t squashfs "$chrootx64" "$rodir" + if [[ "$(uname -r | cut -d . -f1,2)" = "3.14" ]] ; then + mount -t overlayfs -o lowerdir="$rodir",upperdir="$rwdir" overlayfs "$overlaydir" + else # kernel version equal or above 3.18 + mount -t overlay -o lowerdir="$rodir",upperdir="$rwdir",workdir="$workdir" overlay "$overlaydir" + fi + mount -o bind packages "$overlaydir"/usr/portage/packages + mount -o bind distfiles "$overlaydir"/usr/portage/distfiles + mount -t proc proc "$overlaydir"/proc + mount -t sysfs sysfs "$overlaydir"/sys + mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$overlaydir"/dev + mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$overlaydir"/dev/pts + mount -t tmpfs -o nosuid,nodev none "$overlaydir"/dev/shm + mount -t tmpfs -o nosuid,nodev,noexec none "$overlaydir"/tmp +} + +chroottreex64 () { + echo "injecting full portage tree into build environment" + sleep 1 + chroot "$overlaydir" su - "$chrootuser" -c "$chroottree" +} + +chrootoverlaysx64 () { + echo "injecting "$releasename" "$releasetarget" overlay into build environment" + sleep 1 + chroot "$overlaydir" su - "$chrootuser" -c "$chrootmainoverlay" +} + +chrootbuildsystemx64 () { + echo "injecting "$releasename" buildsystem && setting up portage" + echo "" + sleep 1 + for cmd in "$chrootbuildgit" "$chrootportageconfig" "$chrootmakeconfx64" "$chrootprofile" "$chrootenvupdate" ; do + chroot "$overlaydir" su - "$chrootuser" -c "$cmd" + done +} + +chrootbuildx64 () { + echo "" + echo "Environment is up && running ... building targets" + sleep 1 + chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildtarget" +} + +chrootx64 () { + echo -e "" + echo -e "#################################################################" + echo -e "# ENTERING CHROOT ENV FOR YOU TO PUSH BUILT PACKAGES #" + echo -e "# OR TO FIX EVENTUAL BUILD ERRORS #" + echo -e "#################################################################" + echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" + echo -e "#################################################################" + echo -e "# NEXT RUN OF THIS SCRIPT WILL DESTROY ALL YOUR WORK #" + echo -e "# DO NOT EXIT CHROOT UNTIL ALL PACKAGES ARE PUSHED TO REPOS #" + echo -e "# OR, IN CASE OF BUILD FAILURES, UNTIL ALL FIXES ARE COMMITED #" + echo -e "#################################################################" + echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" + echo -e "#################################################################" + echo -e "" + echo -e "" + chroot "$overlaydir" su - "$chrootuser" +} + +# iso functions + +isostartx64 () { + mount -o bind packages "$isosyncdirx64"/usr/portage/packages + mount -t proc proc "$isosyncdirx64"/proc + mount -t sysfs sysfs "$isosyncdirx64"/sys + mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$isosyncdirx64"/dev + mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$isosyncdirx64"/dev/pts + mount -t tmpfs -o nosuid,nodev none "$isosyncdirx64"/dev/shm + mount -t tmpfs -o nosuid,nodev,noexec none "$isosyncdirx64"/tmp +} + +isostopx64 () { + umount -l "$isosyncdirx64"/proc > /dev/null 2>&1 + umount -l "$isosyncdirx64"/sys > /dev/null 2>&1 + umount -l "$isosyncdirx64"/dev/pts > /dev/null 2>&1 + umount -l "$isosyncdirx64"/dev/shm > /dev/null 2>&1 + umount -l "$isosyncdirx64"/dev > /dev/null 2>&1 + umount -l "$isosyncdirx64"/tmp > /dev/null 2>&1 + umount -l "$isosyncdirx64"/usr/portage/packages > /dev/null 2>&1 +} + +isooverlaysx64 () { + echo "injecting "$releasename" "$releasetarget" overlay into x64 environment" + sleep 1 + chroot "$isosyncdirx64" su - "$isouser" -c "$isomainoverlay" +} + +isobuildsystemx64 () { + echo "injecting "$releasename" buildsystem && setting up portage" + echo "" + sleep 1 + for cmd in "$isobuildgit" "$isoportageconfig" "$isomakeconfx64" "$isoprofile" "$isoenvupdate" ; do + chroot "$isosyncdirx64" su - "$isouser" -c "$cmd" + done +} + +isoramfsx64 () { + chroot "$isosyncdirx64" su - "$isouser" -c "$isodracutcmd" +} + +systemramfsx64 () { + chroot "$isosyncdirx64" su - "$isouser" -c "$dracutcmdx64" +} + +isoefiimgx64 () { + chroot "$isosyncdirx64" su - "$isouser" -c "$isoeficmd" +} + +isochrootx64 () { + echo -e "" + echo -e "DROPPING YOU TO A ROOT SHELL INTO ISO ENVIRONMENT" + echo -e "INSTALL APPS & TARGETS & DES YOU WANT INSIDE ISO" + echo -e "EXIT WHEN YOU'RE DONE AND I'LL CREATE THE IMAGE" + echo -e "" + chroot "$isosyncdirx64" su - "$isouser" +} diff --git a/vasile b/vasile deleted file mode 100755 index 39cc017..0000000 --- a/vasile +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash -# Say Hello to Vasile, a modular script to build Kogaion/Argent Linux packages && ISO images using a clean squashfs + overlayfs chroot -# Main author : Ghiunhan Mamut (aka V3n3RiX) @ RogentOS Development Group -# Dependencies : kernel built with squashfs + overlayfs + loopback support && sys-fs/grub:2 && sys-fs/squashfs-tools && dev-libs/libisoburn && sys-fs/mtools -# - -# generic variables - -export local releasename="kogaion" -export local releasetarget="desktop" -export local releaseversion="3" -export local kernelver="3.14.50-"$releasename"" -export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" -export local chrootx64md5=""$chrootx64".md5" - -# build variables - -export local rodir="rodir" -export local rwdir="rwdir" -export local workdir="workdir" # only needed for overlayfs on kernel greather than 3.18 -export local overlaydir="overlaydir" -export local chrootuser="root" -export local chroottarget="${@:2}" -export local chrootbuildtarget="emerge -kav "$chroottarget"" -export local chroottree="/usr/share/vasile/devmod" -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" -export local chrootportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" -export local chrootmakeconfx64="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-devel /etc/portage/make.conf" -export local chrootenvupdate="/usr/sbin/env-update && . /etc/profile" -export local chrootprofile="eselect profile set 1" - -# iso variables - -export local bootcorepath="/tmp/bootcore" -export local bootcorefiles="/tmp/bootcore/cdroot/boot" -export local isouser="root" -export local isotarget="${@:2}" -export local isoinstalltarget="emerge -Kav "$isotarget"" -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" -export local isoportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" -export local isoenvupdate="/usr/sbin/env-update && . /etc/profile" -export local isoprofile="eselect profile set 1" -export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver"" -export local isodracutrd="initramfs-"$kernelver".img" -export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" -export local isomainarchx64="x86_64" -export local isomakeconfx64="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-user /etc/portage/make.conf" -export local isorootdirx64=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx64"" -export local isokernelnamex64="kernel-genkernel-"$isomainarchx64"-"$kernelver"" -export local isostagingdirx64="/tmp/"$isorootdirx64"" -export local isosupersquashdirx64=""$isorootdirx64"/CDroot" -export local isolivesqfsdirx64=""$isosupersquashdirx64"/LiveOS" -export local isoliveosdirx64=""$isorootdirx64"/LiveOS" -export local isosyncdirx64=""$isorootdirx64"/rootfs" -export local isobootdirx64=""$isorootdirx64"/boot/grub" -export local isoefibootdirx64=""$isorootdirx64"/efi/boot" -export local dracutrdx64="initramfs-genkernel-"$isomainarchx64"-"$kernelver"" -export local dracutcmdx64="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrdx64""" - -source /usr/lib/vasile-kogaion/libvasile - -case $1 in - --build) source /usr/share/vasile-kogaion/build - ;; - --iso) source /usr/share/vasile-kogaion/iso - ;; - --help) echo -e "" - echo -e "Usage: vasile-kogaion [options]" - echo -e "" - echo -e "Options:" - echo -e "--build64 : build package/target in a clean x64 squashed core" - echo -e "--iso64 : build x64 iso based on clean squashed core + targets" - echo -e "--help : display this help and exit" - echo -e "" - ;; - *) echo -e "error: no operation specified, use --help for help" - ;; -esac - -exit 0 diff --git a/vasile-kogaion b/vasile-kogaion new file mode 100755 index 0000000..5fb0ed5 --- /dev/null +++ b/vasile-kogaion @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +# Say Hello to Vasile, a modular script to build Kogaion/Argent Linux packages && ISO images using a clean squashfs + overlayfs chroot +# Main author : Ghiunhan Mamut (aka V3n3RiX) @ RogentOS Development Group +# Dependencies : kernel built with squashfs + overlayfs + loopback support && sys-fs/grub:2 && sys-fs/squashfs-tools && dev-libs/libisoburn && sys-fs/mtools +# + +# generic variables + +export local releasename="kogaion" +export local releasetarget="desktop" +export local releaseversion="3" +export local kernelver="3.14.50-"$releasename"" +export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" +export local chrootx64md5=""$chrootx64".md5" + +# build variables + +export local rodir="rodir" +export local rwdir="rwdir" +export local workdir="workdir" # only needed for overlayfs on kernel greather than 3.18 +export local overlaydir="overlaydir" +export local chrootuser="root" +export local chroottarget="${@:2}" +export local chrootbuildtarget="emerge -kav "$chroottarget"" +export local chroottree="/usr/share/vasile/devmod" +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" +export local chrootportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" +export local chrootmakeconfx64="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-devel /etc/portage/make.conf" +export local chrootenvupdate="/usr/sbin/env-update && . /etc/profile" +export local chrootprofile="eselect profile set 1" + +# iso variables + +export local bootcorepath="/tmp/bootcore" +export local bootcorefiles="/tmp/bootcore/cdroot/boot" +export local isouser="root" +export local isotarget="${@:2}" +export local isoinstalltarget="emerge -Kav "$isotarget"" +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" +export local isoportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" +export local isoenvupdate="/usr/sbin/env-update && . /etc/profile" +export local isoprofile="eselect profile set 1" +export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver"" +export local isodracutrd="initramfs-"$kernelver".img" +export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" +export local isomainarchx64="x86_64" +export local isomakeconfx64="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-user /etc/portage/make.conf" +export local isorootdirx64=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx64"" +export local isokernelnamex64="kernel-genkernel-"$isomainarchx64"-"$kernelver"" +export local isostagingdirx64="/tmp/"$isorootdirx64"" +export local isosupersquashdirx64=""$isorootdirx64"/CDroot" +export local isolivesqfsdirx64=""$isosupersquashdirx64"/LiveOS" +export local isoliveosdirx64=""$isorootdirx64"/LiveOS" +export local isosyncdirx64=""$isorootdirx64"/rootfs" +export local isobootdirx64=""$isorootdirx64"/boot/grub" +export local isoefibootdirx64=""$isorootdirx64"/efi/boot" +export local dracutrdx64="initramfs-genkernel-"$isomainarchx64"-"$kernelver"" +export local dracutcmdx64="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrdx64""" + +source /usr/lib/vasile-kogaion/libvasile-kogaion + +case $1 in + --build) source /usr/share/vasile-kogaion/build + ;; + --iso) source /usr/share/vasile-kogaion/iso + ;; + --help) echo -e "" + echo -e "Usage: vasile-kogaion [options]" + echo -e "" + echo -e "Options:" + echo -e "--build64 : build package/target in a clean x64 squashed core" + echo -e "--iso64 : build x64 iso based on clean squashed core + targets" + echo -e "--help : display this help and exit" + echo -e "" + ;; + *) echo -e "error: no operation specified, use --help for help" + ;; +esac + +exit 0 -- cgit v1.2.3 From b3d29d3567a82b844c374d91f5b3118a0aeed083 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 13:05:32 +0100 Subject: enable injection of portage tree --- vasile-kogaion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vasile-kogaion b/vasile-kogaion index 5fb0ed5..9c6bf44 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 chroottree="/usr/share/vasile/devmod" +export local chroottree="/usr/share/vasile-kogaion/devmod" 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" export local chrootportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" -- cgit v1.2.3 From 11da21442de4d0723769545fb46a43d4144c2bff Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 13:09:33 +0100 Subject: plug the function into place --- build | 1 + 1 file changed, 1 insertion(+) diff --git a/build b/build index c4c507f..58a6b82 100755 --- a/build +++ b/build @@ -29,6 +29,7 @@ chrootpreparex64 () { main () { chrootchecksumx64 chrootpreparex64 + chroottreex64 chrootoverlaysx64 chrootbuildsystemx64 chrootbuildx64 -- cgit v1.2.3 From 22578e20843e90b00db3ef630e5cdeb39a076b9e Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 13:36:49 +0100 Subject: change function name and adjust to change --- build | 2 +- libvasile-kogaion | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build b/build index 58a6b82..5efb9b9 100755 --- a/build +++ b/build @@ -29,7 +29,7 @@ chrootpreparex64 () { main () { chrootchecksumx64 chrootpreparex64 - chroottreex64 + chrootdevtreex64 chrootoverlaysx64 chrootbuildsystemx64 chrootbuildx64 diff --git a/libvasile-kogaion b/libvasile-kogaion index 11c3af5..d075bc8 100755 --- a/libvasile-kogaion +++ b/libvasile-kogaion @@ -78,10 +78,10 @@ chrootstartx64 () { mount -t tmpfs -o nosuid,nodev,noexec none "$overlaydir"/tmp } -chroottreex64 () { +chrootdevtreex64 () { echo "injecting full portage tree into build environment" sleep 1 - chroot "$overlaydir" su - "$chrootuser" -c "$chroottree" + chroot "$overlaydir" su - "$chrootuser" -c "$chrootdevtree" } chrootoverlaysx64 () { -- cgit v1.2.3 From 74c6056ea7f2ddf5d6dbe7aab14942b528a5ae71 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 13:44:19 +0100 Subject: add user mode tree at iso creation time --- iso | 1 + libvasile-kogaion | 10 +++++++++- vasile-kogaion | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/iso b/iso index 462c67b..9f6ad94 100755 --- a/iso +++ b/iso @@ -43,6 +43,7 @@ prepareisox64 () { chmod 755 ""$isoefibootdirx64"/bootx64.efi" # configure portage && give up control for package / desktop environment installation isostartx64 + isousertreex64 isooverlaysx64 isobuildsystemx64 isochrootx64 diff --git a/libvasile-kogaion b/libvasile-kogaion index d075bc8..4e93941 100755 --- a/libvasile-kogaion +++ b/libvasile-kogaion @@ -80,6 +80,7 @@ chrootstartx64 () { chrootdevtreex64 () { echo "injecting full portage tree into build environment" + echo "" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootdevtree" } @@ -147,8 +148,15 @@ isostopx64 () { umount -l "$isosyncdirx64"/usr/portage/packages > /dev/null 2>&1 } +isousertreex64 () { + echo "injecting minimal portage tree into environment (user mode)" + echo "" + sleep 1 + chroot "$isosyncdirx64" su - "$isouser" -c "$isousertree" +} + isooverlaysx64 () { - echo "injecting "$releasename" "$releasetarget" overlay into x64 environment" + echo "injecting "$releasename" "$releasetarget" overlay into environment" sleep 1 chroot "$isosyncdirx64" su - "$isouser" -c "$isomainoverlay" } diff --git a/vasile-kogaion b/vasile-kogaion index 9c6bf44..d462293 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 chroottree="/usr/share/vasile-kogaion/devmod" +export local chrootdevtree="/usr/share/vasile-kogaion/devmod" 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" export local chrootportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" @@ -37,6 +37,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/usermod" 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" export local isoportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" -- cgit v1.2.3 From 6872961376183e04e77f4d1f1f73446c34bbd498 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 14:32:10 +0100 Subject: drop pretty much all arch references since we now use only one arch --- devmod | 17 ---------- devmode | 17 ++++++++++ iso | 100 +++++++++++++++++++++++++++--------------------------- libvasile-kogaion | 74 ++++++++++++++++++++-------------------- resetmode | 13 +++++++ usermod | 22 ------------ usermode | 22 ++++++++++++ vasile-kogaion | 36 ++++++++++---------- 8 files changed, 157 insertions(+), 144 deletions(-) delete mode 100755 devmod create mode 100755 devmode create mode 100755 resetmode delete mode 100755 usermod create mode 100755 usermode diff --git a/devmod b/devmod deleted file mode 100755 index 7bd644e..0000000 --- a/devmod +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -fetch_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 > /dev/null 2>&1 - git branch -u origin/master master > /dev/null 2>&1 - rm -rf /usr/portage/profiles/updates > /dev/null 2>&1 - fi -} - -main() { - fetch_portage_tree -} - -main diff --git a/devmode b/devmode new file mode 100755 index 0000000..9ee5742 --- /dev/null +++ b/devmode @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +fetch_devmod_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 +} + +main() { + fetch_devmod_portage_tree +} + +main diff --git a/iso b/iso index 9f6ad94..080ebc5 100755 --- a/iso +++ b/iso @@ -5,83 +5,83 @@ kernelconfig checkroot -prepareisox64 () { +prepareiso () { # we really need this folder as quick as possible - mkdir -p "$isosyncdirx64" + mkdir -p "$isosyncdir" # create an empty 20GB ext4 fs were our rootfs will stay - dd if=/dev/zero of=""$isosyncdirx64".img" bs=50M count=400 - mkfs.ext4 ""$isosyncdirx64".img" + dd if=/dev/zero of=""$isosyncdir".img" bs=50M count=400 + mkfs.ext4 ""$isosyncdir".img" # create live iso layout - mkdir -p "$isostagingdirx64" - mkdir -p "$isobootdirx64" - mkdir -p "$isoefibootdirx64" - mkdir -p "$isoliveosdirx64" - mkdir -p "$isosupersquashdirx64" - mkdir -p "$isolivesqfsdirx64" + 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" "$isostagingdirx64" - mount -t ext4 ""$isosyncdirx64".img" "$isosyncdirx64" - rsync -aHAXr --progress "$isostagingdirx64/" "$isosyncdirx64/" + mount -t squashfs "$chrootx64" "$isostagingdir" + mount -t ext4 ""$isosyncdir".img" "$isosyncdir" + rsync -aHAXr --progress "$isostagingdir/" "$isosyncdir/" # copy kernel into cdroot - cp -avx ""$isosyncdirx64"/boot/"$isokernelnamex64"" ""$isorootdirx64"/boot/vmlinuz" + cp -avx ""$isosyncdir"/boot/"$isokernelname"" ""$isorootdir"/boot/vmlinuz" # generate live initramfs - isostartx64 - isoramfsx64 - isostopx64 + isostart + isoramfs + isostop # generate system initramfs - isostartx64 - systemramfsx64 - isostopx64 + isostart + systemramfs + isostop # copy live initramfs into cdroot - mv ""$isosyncdirx64"/boot/"$isodracutrd"" ""$isorootdirx64"/boot/initrd" + mv ""$isosyncdir"/boot/"$isodracutrd"" ""$isorootdir"/boot/initrd" # generate live efi image - isostartx64 - isoefiimgx64 - isostopx64 + isostart + isoefiimg + isostop # copy efi image into cdroot - mv ""$isosyncdirx64"/root/bootx64.efi" "$isoefibootdirx64" - chmod 755 ""$isoefibootdirx64"/bootx64.efi" + mv ""$isosyncdir"/root/bootx64.efi" "$isoefibootdir" + chmod 755 ""$isoefibootdir"/bootx64.efi" # configure portage && give up control for package / desktop environment installation - isostartx64 - isousertreex64 - isooverlaysx64 - isobuildsystemx64 - isochrootx64 - isostopx64 + isostart + isousertree + isooverlays + isobuildsystem + isochroot + isostop # unmount rootfs before compression - umount -l "$isosyncdirx64" > /dev/null 2>&1 + umount -l "$isosyncdir" > /dev/null 2>&1 # move rootfs in place - mv ""$isosyncdirx64".img" "$isolivesqfsdirx64" + mv ""$isosyncdir".img" "$isolivesqfsdir" # squash rootfs with best compression - mksquashfs "$isosupersquashdirx64" ""$isorootdirx64"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100% + mksquashfs "$isosupersquashdir" ""$isorootdir"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100% # move squashed rootfs in place - mv ""$isorootdirx64/"squashfs.img" "$isoliveosdirx64" + mv ""$isorootdir/"squashfs.img" "$isoliveosdir" } -bootcoreisox64 () { +bootcoreiso () { # configure live bootloader git clone https://gitlab.com/"$releasename"/boot-core.git "$bootcorepath" - cp -avx "$bootcorefiles" "$isorootdirx64" + cp -avx "$bootcorefiles" "$isorootdir" } -cleanupisox64 () { - umount "$isostagingdirx64" - rm -rf "$isosyncdirx64" - rm -rf "$isostagingdirx64" - rm -rf "$isosupersquashdirx64" +cleanupiso () { + umount "$isostagingdir" + rm -rf "$isosyncdir" + rm -rf "$isostagingdir" + rm -rf "$isosupersquashdir" rm -rf "$bootcorepath" } -makeisox64 () { - grub2-mkrescue -o ""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx64".iso" "$isorootdirx64" +makeiso () { + grub2-mkrescue -o ""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch".iso" "$isorootdir" } main () { - chrootchecksumx64 - prepareisox64 - bootcoreisox64 - cleanupisox64 - makeisox64 + chrootchecksum + prepareiso + bootcoreiso + cleanupiso + makeiso } main diff --git a/libvasile-kogaion b/libvasile-kogaion index 4e93941..5fedb23 100755 --- a/libvasile-kogaion +++ b/libvasile-kogaion @@ -61,7 +61,7 @@ chrootstop () { umount -l "$rodir" > /dev/null 2>&1 } -chrootstartx64 () { +chrootstart () { mount -t squashfs "$chrootx64" "$rodir" if [[ "$(uname -r | cut -d . -f1,2)" = "3.14" ]] ; then mount -t overlayfs -o lowerdir="$rodir",upperdir="$rwdir" overlayfs "$overlaydir" @@ -78,29 +78,29 @@ chrootstartx64 () { mount -t tmpfs -o nosuid,nodev,noexec none "$overlaydir"/tmp } -chrootdevtreex64 () { +chrootdevtree () { echo "injecting full portage tree into build environment" echo "" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootdevtree" } -chrootoverlaysx64 () { +chrootoverlays () { echo "injecting "$releasename" "$releasetarget" overlay into build environment" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootmainoverlay" } -chrootbuildsystemx64 () { +chrootbuildsystem () { echo "injecting "$releasename" buildsystem && setting up portage" echo "" sleep 1 - for cmd in "$chrootbuildgit" "$chrootportageconfig" "$chrootmakeconfx64" "$chrootprofile" "$chrootenvupdate" ; do + for cmd in "$chrootbuildgit" "$chrootportageconfig" "$chrootmakeconf" "$chrootprofile" "$chrootenvupdate" ; do chroot "$overlaydir" su - "$chrootuser" -c "$cmd" done } -chrootbuildx64 () { +chrootbuild () { echo "" echo "Environment is up && running ... building targets" sleep 1 @@ -128,65 +128,65 @@ chrootx64 () { # iso functions -isostartx64 () { - mount -o bind packages "$isosyncdirx64"/usr/portage/packages - mount -t proc proc "$isosyncdirx64"/proc - mount -t sysfs sysfs "$isosyncdirx64"/sys - mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$isosyncdirx64"/dev - mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$isosyncdirx64"/dev/pts - mount -t tmpfs -o nosuid,nodev none "$isosyncdirx64"/dev/shm - mount -t tmpfs -o nosuid,nodev,noexec none "$isosyncdirx64"/tmp +isostart () { + mount -o bind packages "$isosyncdir"/usr/portage/packages + mount -t proc proc "$isosyncdir"/proc + mount -t sysfs sysfs "$isosyncdir"/sys + mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$isosyncdir"/dev + mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$isosyncdir"/dev/pts + mount -t tmpfs -o nosuid,nodev none "$isosyncdir"/dev/shm + mount -t tmpfs -o nosuid,nodev,noexec none "$isosyncdir"/tmp } -isostopx64 () { - umount -l "$isosyncdirx64"/proc > /dev/null 2>&1 - umount -l "$isosyncdirx64"/sys > /dev/null 2>&1 - umount -l "$isosyncdirx64"/dev/pts > /dev/null 2>&1 - umount -l "$isosyncdirx64"/dev/shm > /dev/null 2>&1 - umount -l "$isosyncdirx64"/dev > /dev/null 2>&1 - umount -l "$isosyncdirx64"/tmp > /dev/null 2>&1 - umount -l "$isosyncdirx64"/usr/portage/packages > /dev/null 2>&1 +isostop () { + umount -l "$isosyncdir"/proc > /dev/null 2>&1 + umount -l "$isosyncdir"/sys > /dev/null 2>&1 + umount -l "$isosyncdir"/dev/pts > /dev/null 2>&1 + umount -l "$isosyncdir"/dev/shm > /dev/null 2>&1 + umount -l "$isosyncdir"/dev > /dev/null 2>&1 + umount -l "$isosyncdir"/tmp > /dev/null 2>&1 + umount -l "$isosyncdir"/usr/portage/packages > /dev/null 2>&1 } -isousertreex64 () { +isousertree () { echo "injecting minimal portage tree into environment (user mode)" echo "" sleep 1 - chroot "$isosyncdirx64" su - "$isouser" -c "$isousertree" + chroot "$isosyncdir" su - "$isouser" -c "$isousertree" } -isooverlaysx64 () { +isooverlays () { echo "injecting "$releasename" "$releasetarget" overlay into environment" sleep 1 - chroot "$isosyncdirx64" su - "$isouser" -c "$isomainoverlay" + chroot "$isosyncdir" su - "$isouser" -c "$isomainoverlay" } -isobuildsystemx64 () { +isobuildsystem () { echo "injecting "$releasename" buildsystem && setting up portage" echo "" sleep 1 - for cmd in "$isobuildgit" "$isoportageconfig" "$isomakeconfx64" "$isoprofile" "$isoenvupdate" ; do - chroot "$isosyncdirx64" su - "$isouser" -c "$cmd" + for cmd in "$isobuildgit" "$isoportageconfig" "$isomakeconf" "$isoprofile" "$isoenvupdate" ; do + chroot "$isosyncdir" su - "$isouser" -c "$cmd" done } -isoramfsx64 () { - chroot "$isosyncdirx64" su - "$isouser" -c "$isodracutcmd" +isoramfs () { + chroot "$isosyncdir" su - "$isouser" -c "$isodracutcmd" } -systemramfsx64 () { - chroot "$isosyncdirx64" su - "$isouser" -c "$dracutcmdx64" +systemramfs () { + chroot "$isosyncdir" su - "$isouser" -c "$dracutcmd" } -isoefiimgx64 () { - chroot "$isosyncdirx64" su - "$isouser" -c "$isoeficmd" +isoefiimg () { + chroot "$isosyncdir" su - "$isouser" -c "$isoeficmd" } -isochrootx64 () { +isochroot () { echo -e "" echo -e "DROPPING YOU TO A ROOT SHELL INTO ISO ENVIRONMENT" echo -e "INSTALL APPS & TARGETS & DES YOU WANT INSIDE ISO" echo -e "EXIT WHEN YOU'RE DONE AND I'LL CREATE THE IMAGE" echo -e "" - chroot "$isosyncdirx64" su - "$isouser" + chroot "$isosyncdir" su - "$isouser" } diff --git a/resetmode b/resetmode new file mode 100755 index 0000000..f8ddc32 --- /dev/null +++ b/resetmode @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +reset_current_mode() { + if [ -d /usr/portage/.git ] ; then + rm -rf /usr/portage/* + rm -rf /usr/portage/.git* + fi +} + +main () { + reset_current_mode +} +main diff --git a/usermod b/usermod deleted file mode 100755 index a47193a..0000000 --- a/usermod +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -fetch_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 > /dev/null 2>&1 - git branch -u origin/master master > /dev/null 2>&1 - rm -rf /usr/portage/profiles/updates > /dev/null 2>&1 - fi -} - -main() { - fetch_portage_tree -} - -main diff --git a/usermode b/usermode new file mode 100755 index 0000000..39c7167 --- /dev/null +++ b/usermode @@ -0,0 +1,22 @@ +#!/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 +} + +main() { + fetch_usermod_portage_tree +} + +main diff --git a/vasile-kogaion b/vasile-kogaion index d462293..6256913 100755 --- a/vasile-kogaion +++ b/vasile-kogaion @@ -22,11 +22,11 @@ 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/devmod" +export local chrootdevtree="/usr/share/vasile-kogaion/devmode" 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" export local chrootportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" -export local chrootmakeconfx64="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-devel /etc/portage/make.conf" +export local chrootmakeconf="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-devel /etc/portage/make.conf" export local chrootenvupdate="/usr/sbin/env-update && . /etc/profile" export local chrootprofile="eselect profile set 1" @@ -37,7 +37,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/usermod" +export local isousertree="/usr/share/vasile-kogaion/usermode" 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" export local isoportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" @@ -46,19 +46,19 @@ export local isoprofile="eselect profile set 1" export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver"" export local isodracutrd="initramfs-"$kernelver".img" export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" -export local isomainarchx64="x86_64" -export local isomakeconfx64="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-user /etc/portage/make.conf" -export local isorootdirx64=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx64"" -export local isokernelnamex64="kernel-genkernel-"$isomainarchx64"-"$kernelver"" -export local isostagingdirx64="/tmp/"$isorootdirx64"" -export local isosupersquashdirx64=""$isorootdirx64"/CDroot" -export local isolivesqfsdirx64=""$isosupersquashdirx64"/LiveOS" -export local isoliveosdirx64=""$isorootdirx64"/LiveOS" -export local isosyncdirx64=""$isorootdirx64"/rootfs" -export local isobootdirx64=""$isorootdirx64"/boot/grub" -export local isoefibootdirx64=""$isorootdirx64"/efi/boot" -export local dracutrdx64="initramfs-genkernel-"$isomainarchx64"-"$kernelver"" -export local dracutcmdx64="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrdx64""" +export local isomainarch="x86_64" +export local isomakeconf="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-user /etc/portage/make.conf" +export local isorootdir=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx64"" +export local isokernelname="kernel-genkernel-"$isomainarch"-"$kernelver"" +export local isostagingdir="/tmp/"$isorootdir"" +export local isosupersquashdir=""$isorootdir"/CDroot" +export local isolivesqfsdir=""$isosupersquashdir"/LiveOS" +export local isoliveosdir=""$isorootdir"/LiveOS" +export local isosyncdir=""$isorootdir"/rootfs" +export local isobootdir=""$isorootdir"/boot/grub" +export local isoefibootdir=""$isorootdir"/efi/boot" +export local dracutrd="initramfs-genkernel-"$isomainarch"-"$kernelver"" +export local dracutcmd="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrd""" source /usr/lib/vasile-kogaion/libvasile-kogaion @@ -71,8 +71,8 @@ case $1 in echo -e "Usage: vasile-kogaion [options]" echo -e "" echo -e "Options:" - echo -e "--build64 : build package/target in a clean x64 squashed core" - echo -e "--iso64 : build x64 iso based on clean squashed core + targets" + echo -e "--build : build package/target in a clean squashed core" + echo -e "--iso : build iso based on clean squashed core + targets" echo -e "--help : display this help and exit" echo -e "" ;; -- cgit v1.2.3 From db0f02e0fcd5620c752a900be8f5b46f4afbca75 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 15:18:28 +0100 Subject: sure we did :) --- build | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/build b/build index 5efb9b9..cce336b 100755 --- a/build +++ b/build @@ -5,7 +5,7 @@ kernelconfig checkroot -chrootpreparex64 () { +chrootprepare () { # check our environment for sanity # if safe, trigger start && break the loop to build packages # else trigger stop && cleanup && check again @@ -14,7 +14,7 @@ chrootpreparex64 () { for i in "$rodir" "$rwdir" "$workdir" "$overlaydir" ; do mkdir "$i" done - chrootstartx64 + chrootstart break elif [[ -d "$rodir" && -d "$rwdir" && -d "$workdir" && -d "$overlaydir" ]] ; then chrootstop @@ -27,12 +27,12 @@ chrootpreparex64 () { } main () { - chrootchecksumx64 - chrootpreparex64 - chrootdevtreex64 - chrootoverlaysx64 - chrootbuildsystemx64 - chrootbuildx64 + chrootchecksum + chrootprepare + chrootdevtree + chrootoverlays + chrootbuildsystem + chrootbuild chrootx64 chrootstop } -- cgit v1.2.3 From 791c1b2b7ef03116770f6bc514bc6af9861c7f0f Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 15:20:19 +0100 Subject: fix leftovers --- libvasile-kogaion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvasile-kogaion b/libvasile-kogaion index 5fedb23..47b1510 100755 --- a/libvasile-kogaion +++ b/libvasile-kogaion @@ -25,7 +25,7 @@ checkroot () { fi } -chrootchecksumx64 () { +chrootchecksum () { while : true ; do if [[ -f "$chrootx64" && -f "$chrootx64md5" ]] ; then echo "good, squashed chroot && checksum file found ... verifying integrity" -- cgit v1.2.3 From a4be9a729a445055e6777cf517b2bba04d073094 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 15:40:10 +0100 Subject: try to move some functions to helper scripts --- devmode | 13 +++++++++++-- libvasile-kogaion | 8 ++------ usermode | 10 +++++++++- vasile-kogaion | 9 +-------- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/devmode b/devmode index 9ee5742..3ebffa0 100755 --- a/devmode +++ b/devmode @@ -1,6 +1,6 @@ #!/usr/bin/env bash -fetch_devmod_portage_tree() { +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 @@ -10,8 +10,17 @@ fetch_devmod_portage_tree() { 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_devmod_portage_tree + fetch_devmode_portage_tree + set_devmode_portage_tree } main diff --git a/libvasile-kogaion b/libvasile-kogaion index 47b1510..59baf9c 100755 --- a/libvasile-kogaion +++ b/libvasile-kogaion @@ -95,9 +95,7 @@ chrootbuildsystem () { echo "injecting "$releasename" buildsystem && setting up portage" echo "" sleep 1 - for cmd in "$chrootbuildgit" "$chrootportageconfig" "$chrootmakeconf" "$chrootprofile" "$chrootenvupdate" ; do - chroot "$overlaydir" su - "$chrootuser" -c "$cmd" - done + chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildgit" } chrootbuild () { @@ -165,9 +163,7 @@ isobuildsystem () { echo "injecting "$releasename" buildsystem && setting up portage" echo "" sleep 1 - for cmd in "$isobuildgit" "$isoportageconfig" "$isomakeconf" "$isoprofile" "$isoenvupdate" ; do - chroot "$isosyncdir" su - "$isouser" -c "$cmd" - done + chroot "$isosyncdir" su - "$isouser" -c "$isobuildgit" } isoramfs () { diff --git a/usermode b/usermode index 39c7167..c920ace 100755 --- a/usermode +++ b/usermode @@ -15,8 +15,16 @@ fetch_usermode_portage_tree() { 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_usermod_portage_tree + fetch_usermode_portage_tree } main diff --git a/vasile-kogaion b/vasile-kogaion index 6256913..6f8e5b2 100755 --- a/vasile-kogaion +++ b/vasile-kogaion @@ -25,10 +25,6 @@ export local chrootbuildtarget="emerge -kav "$chroottarget"" export local chrootdevtree="/usr/share/vasile-kogaion/devmode" 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" -export local chrootportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" -export local chrootmakeconf="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-devel /etc/portage/make.conf" -export local chrootenvupdate="/usr/sbin/env-update && . /etc/profile" -export local chrootprofile="eselect profile set 1" # iso variables @@ -40,14 +36,11 @@ export local isoinstalltarget="emerge -Kav "$isotarget"" export local isousertree="/usr/share/vasile-kogaion/usermode" 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" -export local isoportageconfig="ln -sf /opt/"$releasename"-build/conf/intel/portage /etc/portage" -export local isoenvupdate="/usr/sbin/env-update && . /etc/profile" -export local isoprofile="eselect profile set 1" + export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver"" export local isodracutrd="initramfs-"$kernelver".img" export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" export local isomainarch="x86_64" -export local isomakeconf="ln -sf /opt/"$releasename"-build/conf/intel/portage/make.conf.amd64-user /etc/portage/make.conf" export local isorootdir=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx64"" export local isokernelname="kernel-genkernel-"$isomainarch"-"$kernelver"" export local isostagingdir="/tmp/"$isorootdir"" -- cgit v1.2.3 From 8bdac77d9703d1ed6104138e69fe3f980c4ef6ec Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 15:49:24 +0100 Subject: forgot to call the function we just created --- usermode | 1 + 1 file changed, 1 insertion(+) diff --git a/usermode b/usermode index c920ace..5ad32e2 100755 --- a/usermode +++ b/usermode @@ -25,6 +25,7 @@ set_usermode_portage_tree () { main() { fetch_usermode_portage_tree + set_usermode_portage_tree } main -- cgit v1.2.3 From c4cc2096a6adfc8edabc02c1f54220f2bd709742 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 16:06:42 +0100 Subject: implement resetmode to clean previous mode before switching to new mode --- resetmode | 3 +++ usermode | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/resetmode b/resetmode index f8ddc32..6fad670 100755 --- a/resetmode +++ b/resetmode @@ -4,6 +4,9 @@ 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 } diff --git a/usermode b/usermode index 5ad32e2..6a8e925 100755 --- a/usermode +++ b/usermode @@ -15,7 +15,7 @@ fetch_usermode_portage_tree() { fi } -set_usermode_portage_tree () { +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 -- cgit v1.2.3 From 9d30adec04432358469c8e58fc6a0c6c363004c7 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 16:11:43 +0100 Subject: milestone achieved, vasile can switch system modes (user/developer) INSTANTLY --- vasile-kogaion | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vasile-kogaion b/vasile-kogaion index 6f8e5b2..316b80c 100755 --- a/vasile-kogaion +++ b/vasile-kogaion @@ -60,12 +60,20 @@ case $1 in ;; --iso) source /usr/share/vasile-kogaion/iso ;; + --usermode) source /usr/share/vasile-kogaion/resetmode + source /usr/share/vasile-kogaion/usermode + ;; + --devmode) source /usr/share/vasile-kogaion/resetmode + source /usr/share/vasile-kogaion/devmode + ;; --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 "--help : display this help and exit" echo -e "" ;; -- cgit v1.2.3 From dd36cf0cef322ca6d0bd7b2028e92fcf6538effe Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 16:13:26 +0100 Subject: inject portage tree AFTER buildsystem was already injected --- build | 2 +- iso | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build b/build index cce336b..3121bf4 100755 --- a/build +++ b/build @@ -29,9 +29,9 @@ chrootprepare () { main () { chrootchecksum chrootprepare - chrootdevtree chrootoverlays chrootbuildsystem + chrootdevtree chrootbuild chrootx64 chrootstop diff --git a/iso b/iso index 080ebc5..86c20b3 100755 --- a/iso +++ b/iso @@ -43,9 +43,9 @@ prepareiso () { chmod 755 ""$isoefibootdir"/bootx64.efi" # configure portage && give up control for package / desktop environment installation isostart - isousertree isooverlays isobuildsystem + isousertree isochroot isostop # unmount rootfs before compression -- cgit v1.2.3 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 From 4f6020aaa16412bee10b009d5d55b9f7357b97d5 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 16:50:50 +0100 Subject: final fix --- vasile-kogaion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vasile-kogaion b/vasile-kogaion index 0ba009e..d5505c7 100755 --- a/vasile-kogaion +++ b/vasile-kogaion @@ -41,7 +41,7 @@ export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o export local isodracutrd="initramfs-"$kernelver".img" export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" export local isomainarch="x86_64" -export local isorootdir=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx64"" +export local isorootdir=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch"" export local isokernelname="kernel-genkernel-"$isomainarch"-"$kernelver"" export local isostagingdir="/tmp/"$isorootdir"" export local isosupersquashdir=""$isorootdir"/CDroot" -- cgit v1.2.3 From ccea43a62a7100500e3eeccb646db168f86d4b99 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 17:02:01 +0100 Subject: typo --- vasile-kogaion | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vasile-kogaion b/vasile-kogaion index d5505c7..81f29b8 100755 --- a/vasile-kogaion +++ b/vasile-kogaion @@ -72,8 +72,8 @@ case $1 in echo -e "Options:" 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 "--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 "--help : display this help and exit" echo -e "" ;; -- cgit v1.2.3 From c33651eedfa6ec19ac6b523e1dfc3c9986efe9d5 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 17:15:19 +0100 Subject: adjust build and iso flags --- vasile-kogaion | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vasile-kogaion b/vasile-kogaion index 81f29b8..a20e1ca 100755 --- a/vasile-kogaion +++ b/vasile-kogaion @@ -56,9 +56,9 @@ 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/buildpkg + --buildpkg) source /usr/share/vasile-kogaion/buildpkg ;; - --iso) source /usr/share/vasile-kogaion/buildiso + --buildiso) source /usr/share/vasile-kogaion/buildiso ;; --usermode) source /usr/share/vasile-kogaion/modereset source /usr/share/vasile-kogaion/usermodeset -- cgit v1.2.3 From 3eb274bfcbe5f3d4c234d626d423d85250c1ada9 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 17:52:52 +0100 Subject: keep packages dir and distfiles dir intact when switching modes --- modereset | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modereset b/modereset index 6fad670..b3c8d41 100755 --- a/modereset +++ b/modereset @@ -2,7 +2,9 @@ reset_current_mode() { if [ -d /usr/portage/.git ] ; then - rm -rf /usr/portage/* + for i in "(ls /usr/portage|grep -v packages|grep -v distfiles)"; do + rm -rf $i + done rm -rf /usr/portage/.git* rm /etc/portage/make.conf rm /etc/portage/make.profile -- cgit v1.2.3 From 90eb32f31f8a14858a537b00a3bedff77321a3ff Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 17 Apr 2016 18:01:44 +0100 Subject: Revert "keep packages dir and distfiles dir intact when switching modes" This reverts commit 3eb274bfcbe5f3d4c234d626d423d85250c1ada9. --- modereset | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modereset b/modereset index b3c8d41..6fad670 100755 --- a/modereset +++ b/modereset @@ -2,9 +2,7 @@ reset_current_mode() { if [ -d /usr/portage/.git ] ; then - for i in "(ls /usr/portage|grep -v packages|grep -v distfiles)"; do - rm -rf $i - done + rm -rf /usr/portage/* rm -rf /usr/portage/.git* rm /etc/portage/make.conf rm /etc/portage/make.profile -- cgit v1.2.3 From 8fb6dc9a8dc3c44c69f579d649ddd0afb36c4cce Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 20 Apr 2016 18:03:21 +0100 Subject: make use of variables, avoid removal of distfiles and package directories when switching modes --- devmodeset | 14 +++++++++----- modereset | 14 ++++++++------ usermodeset | 14 +++++++++----- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/devmodeset b/devmodeset index 3ebffa0..cd28d1b 100755 --- a/devmodeset +++ b/devmodeset @@ -1,18 +1,22 @@ #!/usr/bin/env bash +export local portagedir="/usr/portage" +export local confdir="/etc/portage" +export local gitdir="/opt/kogaion-build/conf/intel/portage" + fetch_devmode_portage_tree() { - if [[ ! -d /usr/portage/.git ]] ; then - cd /usr/portage && git init > /dev/null 2>&1 + if [[ ! -d "$portagedir"/.git ]] ; then + cd "$portagedir" && 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 + rm -rf ""$portagedir"/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 + ln -sf "$gitdir" "$confdir" + ln -sf "$confdir"/make.conf.amd64-devel "$confdir"/make.conf eselect profile set 1 env-update . /etc/profile diff --git a/modereset b/modereset index 6fad670..84b0d35 100755 --- a/modereset +++ b/modereset @@ -1,12 +1,14 @@ #!/usr/bin/env bash +export local portagedir="/usr/portage" +export local confdir="/etc/portage" + 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 + if [ -d ""$portagedir"/.git" ] ; then + rm -rf $(find "$portagedir" -mindepth 1 | grep -v "distfiles" | grep -v "packages") + rm ""$confdir"/make.conf" + rm ""$confdir"/make.profile" + rm "$confdir" fi } diff --git a/usermodeset b/usermodeset index 6a8e925..ae4a9ec 100755 --- a/usermodeset +++ b/usermodeset @@ -1,8 +1,12 @@ #!/usr/bin/env bash +export local portagedir="/usr/portage" +export local confdir="/etc/portage" +export local gitdir="/opt/kogaion-build/conf/intel/portage" + fetch_usermode_portage_tree() { - if [[ ! -d /usr/portage/.git ]] ; then - cd /usr/portage && git init > /dev/null 2>&1 + if [[ ! -d "$portagedir"/.git ]] ; then + cd "$portagedir" && 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 @@ -11,13 +15,13 @@ fetch_usermode_portage_tree() { echo ".gitignore" >> .git/info/sparse-checkout git pull --depth=1 origin master git branch -u origin/master master - rm -rf /usr/portage/profiles/updates + rm -rf ""$portagedir"/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 + ln -sf "$gitdir" "$confdir" + ln -sf "$confdir"/make.conf.amd64-user "$confdir"/make.conf eselect profile set 1 env-update . /etc/profile -- cgit v1.2.3 From 7f0f70126a79ee23c2c7eaf2cc07a85e44714f9a Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 20 Apr 2016 18:12:24 +0100 Subject: vasile-kogaion is a stupid name, change it to kvasile...aka vasile Kogaion edition, or, if you like, KDE edition lol --- kvasile | 84 ++++++++++++++++++++++++ libkvasile | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ libvasile-kogaion | 190 ------------------------------------------------------ vasile-kogaion | 84 ------------------------ 4 files changed, 274 insertions(+), 274 deletions(-) create mode 100755 kvasile create mode 100755 libkvasile delete mode 100755 libvasile-kogaion delete mode 100755 vasile-kogaion diff --git a/kvasile b/kvasile new file mode 100755 index 0000000..172ae25 --- /dev/null +++ b/kvasile @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# Say Hello to Vasile, a modular script to build Kogaion/Argent Linux packages && ISO images using a clean squashfs + overlayfs chroot +# Main author : Ghiunhan Mamut (aka V3n3RiX) @ RogentOS Development Group +# Dependencies : kernel built with squashfs + overlayfs + loopback support && sys-fs/grub:2 && sys-fs/squashfs-tools && dev-libs/libisoburn && sys-fs/mtools +# + +# generic variables + +export local releasename="kogaion" +export local releasetarget="desktop" +export local releaseversion="3" +export local kernelver="3.14.50-"$releasename"" +export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" +export local chrootx64md5=""$chrootx64".md5" + +# build variables + +export local rodir="rodir" +export local rwdir="rwdir" +export local workdir="workdir" # only needed for overlayfs on kernel greather than 3.18 +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/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" + +# iso variables + +export local bootcorepath="/tmp/bootcore" +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/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" + +export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver"" +export local isodracutrd="initramfs-"$kernelver".img" +export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" +export local isomainarch="x86_64" +export local isorootdir=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch"" +export local isokernelname="kernel-genkernel-"$isomainarch"-"$kernelver"" +export local isostagingdir="/tmp/"$isorootdir"" +export local isosupersquashdir=""$isorootdir"/CDroot" +export local isolivesqfsdir=""$isosupersquashdir"/LiveOS" +export local isoliveosdir=""$isorootdir"/LiveOS" +export local isosyncdir=""$isorootdir"/rootfs" +export local isobootdir=""$isorootdir"/boot/grub" +export local isoefibootdir=""$isorootdir"/efi/boot" +export local dracutrd="initramfs-genkernel-"$isomainarch"-"$kernelver"" +export local dracutcmd="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrd""" + +source /usr/lib/kvasile/libkvasile + +case $1 in + --buildpkg) source /usr/share/kvasile/buildpkg + ;; + --buildiso) source /usr/share/kvasile/buildiso + ;; + --usermode) source /usr/share/kvasile/modereset + source /usr/share/kvasile/usermodeset + ;; + --devmode) source /usr/share/kvasile/modereset + source /usr/share/kvasile/devmodeset + ;; + --help) echo -e "" + echo -e "Usage: kvasile [options]" + echo -e "" + echo -e "Options:" + echo -e "--buildpkg : build package/target in a clean squashed core" + echo -e "--buildiso : 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 "--help : display this help and exit" + echo -e "" + ;; + *) echo -e "error: no operation specified, use --help for help" + ;; +esac + +exit 0 diff --git a/libkvasile b/libkvasile new file mode 100755 index 0000000..d187456 --- /dev/null +++ b/libkvasile @@ -0,0 +1,190 @@ +# generic functions (used for both build && iso creation) + +kernelconfig () { + if [[ $(zgrep 'CONFIG_OVERLAYFS_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then + # if you use 3.18 LTS or newer kernels, change CONFIG_OVERLAYFS_FS to CONFIG_OVERLAY_FS + echo "" + echo "Kernel configuration seems OK, moving on" + echo "" + sleep 1 + else + echo "" + echo "Vasile needs OVERLAYFS && SQUASHFS && LOOP DEVICES to work" + echo "Please rebuild the kernel with those activated to use it" + echo "" + exit 1 + fi +} + +checkroot () { + if [[ "$(whoami)" != root ]] ; then + echo "" + echo "You're not root?...No cookies for you, go away !!!" + echo "" + exit 1 + fi +} + +chrootchecksum () { + while : true ; do + if [[ -f "$chrootx64" && -f "$chrootx64md5" ]] ; then + echo "good, squashed chroot && checksum file found ... verifying integrity" + echo "" + if [[ "$(md5sum -c "$chrootx64md5")" ]] ; then + echo "good, squashed chroot checksum passed ... starting engines" + echo "" + sleep 1 + break + else + echo "ooops, squashed chroot checksum failed ... aborting" + exit 1 + fi + else + echo "ooops, squashed chroot or checksum file not found ... aborting" + exit 1 + fi + done +} + +# build functions + +chrootstop () { + umount -l "$overlaydir"/proc > /dev/null 2>&1 + umount -l "$overlaydir"/sys > /dev/null 2>&1 + umount -l "$overlaydir"/dev/pts > /dev/null 2>&1 + umount -l "$overlaydir"/dev/shm > /dev/null 2>&1 + umount -l "$overlaydir"/dev > /dev/null 2>&1 + umount -l "$overlaydir"/tmp > /dev/null 2>&1 + umount -l "$overlaydir"/usr/portage/packages > /dev/null 2>&1 + umount -l "$overlaydir"/usr/portage/distfiles > /dev/null 2>&1 + umount -l "$overlaydir" > /dev/null 2>&1 + umount -l "$rodir" > /dev/null 2>&1 +} + +chrootstart () { + mount -t squashfs "$chrootx64" "$rodir" + if [[ "$(uname -r | cut -d . -f1,2)" = "3.14" ]] ; then + mount -t overlayfs -o lowerdir="$rodir",upperdir="$rwdir" overlayfs "$overlaydir" + else # kernel version equal or above 3.18 + mount -t overlay -o lowerdir="$rodir",upperdir="$rwdir",workdir="$workdir" overlay "$overlaydir" + fi + mount -o bind packages "$overlaydir"/usr/portage/packages + mount -o bind distfiles "$overlaydir"/usr/portage/distfiles + mount -t proc proc "$overlaydir"/proc + mount -t sysfs sysfs "$overlaydir"/sys + mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$overlaydir"/dev + mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$overlaydir"/dev/pts + mount -t tmpfs -o nosuid,nodev none "$overlaydir"/dev/shm + mount -t tmpfs -o nosuid,nodev,noexec none "$overlaydir"/tmp +} + +chrootdevtree () { + echo "" + echo "injecting full portage tree into build environment" + echo "" + sleep 1 + chroot "$overlaydir" su - "$chrootuser" -c "$chrootdevtree" +} + +chrootoverlays () { + echo "injecting "$releasename" "$releasetarget" overlay into build environment" + sleep 1 + chroot "$overlaydir" su - "$chrootuser" -c "$chrootmainoverlay" +} + +chrootbuildsystem () { + echo "injecting "$releasename" buildsystem && setting up portage" + echo "" + sleep 1 + chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildgit" +} + +chrootbuild () { + echo "" + echo "Environment is up && running ... building targets" + sleep 1 + chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildtarget" +} + +chrootx64 () { + echo -e "" + echo -e "#################################################################" + echo -e "# ENTERING CHROOT ENV FOR YOU TO PUSH BUILT PACKAGES #" + echo -e "# OR TO FIX EVENTUAL BUILD ERRORS #" + echo -e "#################################################################" + echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" + echo -e "#################################################################" + echo -e "# NEXT RUN OF THIS SCRIPT WILL DESTROY ALL YOUR WORK #" + echo -e "# DO NOT EXIT CHROOT UNTIL ALL PACKAGES ARE PUSHED TO REPOS #" + echo -e "# OR, IN CASE OF BUILD FAILURES, UNTIL ALL FIXES ARE COMMITED #" + echo -e "#################################################################" + echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" + echo -e "#################################################################" + echo -e "" + echo -e "" + chroot "$overlaydir" su - "$chrootuser" +} + +# iso functions + +isostart () { + mount -o bind packages "$isosyncdir"/usr/portage/packages + mount -t proc proc "$isosyncdir"/proc + mount -t sysfs sysfs "$isosyncdir"/sys + mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$isosyncdir"/dev + mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$isosyncdir"/dev/pts + mount -t tmpfs -o nosuid,nodev none "$isosyncdir"/dev/shm + mount -t tmpfs -o nosuid,nodev,noexec none "$isosyncdir"/tmp +} + +isostop () { + umount -l "$isosyncdir"/proc > /dev/null 2>&1 + umount -l "$isosyncdir"/sys > /dev/null 2>&1 + umount -l "$isosyncdir"/dev/pts > /dev/null 2>&1 + umount -l "$isosyncdir"/dev/shm > /dev/null 2>&1 + umount -l "$isosyncdir"/dev > /dev/null 2>&1 + umount -l "$isosyncdir"/tmp > /dev/null 2>&1 + umount -l "$isosyncdir"/usr/portage/packages > /dev/null 2>&1 +} + +isousertree () { + echo "" + echo "injecting minimal portage tree into environment (user mode)" + echo "" + sleep 1 + chroot "$isosyncdir" su - "$isouser" -c "$isousertree" +} + +isooverlays () { + echo "injecting "$releasename" "$releasetarget" overlay into environment" + sleep 1 + chroot "$isosyncdir" su - "$isouser" -c "$isomainoverlay" +} + +isobuildsystem () { + echo "injecting "$releasename" buildsystem && setting up portage" + echo "" + sleep 1 + chroot "$isosyncdir" su - "$isouser" -c "$isobuildgit" +} + +isoramfs () { + chroot "$isosyncdir" su - "$isouser" -c "$isodracutcmd" +} + +systemramfs () { + chroot "$isosyncdir" su - "$isouser" -c "$dracutcmd" +} + +isoefiimg () { + chroot "$isosyncdir" su - "$isouser" -c "$isoeficmd" +} + +isochroot () { + echo -e "" + echo -e "DROPPING YOU TO A ROOT SHELL INTO ISO ENVIRONMENT" + echo -e "INSTALL APPS & TARGETS & DES YOU WANT INSIDE ISO" + echo -e "EXIT WHEN YOU'RE DONE AND I'LL CREATE THE IMAGE" + echo -e "" + chroot "$isosyncdir" su - "$isouser" +} diff --git a/libvasile-kogaion b/libvasile-kogaion deleted file mode 100755 index d187456..0000000 --- a/libvasile-kogaion +++ /dev/null @@ -1,190 +0,0 @@ -# generic functions (used for both build && iso creation) - -kernelconfig () { - if [[ $(zgrep 'CONFIG_OVERLAYFS_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then - # if you use 3.18 LTS or newer kernels, change CONFIG_OVERLAYFS_FS to CONFIG_OVERLAY_FS - echo "" - echo "Kernel configuration seems OK, moving on" - echo "" - sleep 1 - else - echo "" - echo "Vasile needs OVERLAYFS && SQUASHFS && LOOP DEVICES to work" - echo "Please rebuild the kernel with those activated to use it" - echo "" - exit 1 - fi -} - -checkroot () { - if [[ "$(whoami)" != root ]] ; then - echo "" - echo "You're not root?...No cookies for you, go away !!!" - echo "" - exit 1 - fi -} - -chrootchecksum () { - while : true ; do - if [[ -f "$chrootx64" && -f "$chrootx64md5" ]] ; then - echo "good, squashed chroot && checksum file found ... verifying integrity" - echo "" - if [[ "$(md5sum -c "$chrootx64md5")" ]] ; then - echo "good, squashed chroot checksum passed ... starting engines" - echo "" - sleep 1 - break - else - echo "ooops, squashed chroot checksum failed ... aborting" - exit 1 - fi - else - echo "ooops, squashed chroot or checksum file not found ... aborting" - exit 1 - fi - done -} - -# build functions - -chrootstop () { - umount -l "$overlaydir"/proc > /dev/null 2>&1 - umount -l "$overlaydir"/sys > /dev/null 2>&1 - umount -l "$overlaydir"/dev/pts > /dev/null 2>&1 - umount -l "$overlaydir"/dev/shm > /dev/null 2>&1 - umount -l "$overlaydir"/dev > /dev/null 2>&1 - umount -l "$overlaydir"/tmp > /dev/null 2>&1 - umount -l "$overlaydir"/usr/portage/packages > /dev/null 2>&1 - umount -l "$overlaydir"/usr/portage/distfiles > /dev/null 2>&1 - umount -l "$overlaydir" > /dev/null 2>&1 - umount -l "$rodir" > /dev/null 2>&1 -} - -chrootstart () { - mount -t squashfs "$chrootx64" "$rodir" - if [[ "$(uname -r | cut -d . -f1,2)" = "3.14" ]] ; then - mount -t overlayfs -o lowerdir="$rodir",upperdir="$rwdir" overlayfs "$overlaydir" - else # kernel version equal or above 3.18 - mount -t overlay -o lowerdir="$rodir",upperdir="$rwdir",workdir="$workdir" overlay "$overlaydir" - fi - mount -o bind packages "$overlaydir"/usr/portage/packages - mount -o bind distfiles "$overlaydir"/usr/portage/distfiles - mount -t proc proc "$overlaydir"/proc - mount -t sysfs sysfs "$overlaydir"/sys - mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$overlaydir"/dev - mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$overlaydir"/dev/pts - mount -t tmpfs -o nosuid,nodev none "$overlaydir"/dev/shm - mount -t tmpfs -o nosuid,nodev,noexec none "$overlaydir"/tmp -} - -chrootdevtree () { - echo "" - echo "injecting full portage tree into build environment" - echo "" - sleep 1 - chroot "$overlaydir" su - "$chrootuser" -c "$chrootdevtree" -} - -chrootoverlays () { - echo "injecting "$releasename" "$releasetarget" overlay into build environment" - sleep 1 - chroot "$overlaydir" su - "$chrootuser" -c "$chrootmainoverlay" -} - -chrootbuildsystem () { - echo "injecting "$releasename" buildsystem && setting up portage" - echo "" - sleep 1 - chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildgit" -} - -chrootbuild () { - echo "" - echo "Environment is up && running ... building targets" - sleep 1 - chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildtarget" -} - -chrootx64 () { - echo -e "" - echo -e "#################################################################" - echo -e "# ENTERING CHROOT ENV FOR YOU TO PUSH BUILT PACKAGES #" - echo -e "# OR TO FIX EVENTUAL BUILD ERRORS #" - echo -e "#################################################################" - echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" - echo -e "#################################################################" - echo -e "# NEXT RUN OF THIS SCRIPT WILL DESTROY ALL YOUR WORK #" - echo -e "# DO NOT EXIT CHROOT UNTIL ALL PACKAGES ARE PUSHED TO REPOS #" - echo -e "# OR, IN CASE OF BUILD FAILURES, UNTIL ALL FIXES ARE COMMITED #" - echo -e "#################################################################" - echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" - echo -e "#################################################################" - echo -e "" - echo -e "" - chroot "$overlaydir" su - "$chrootuser" -} - -# iso functions - -isostart () { - mount -o bind packages "$isosyncdir"/usr/portage/packages - mount -t proc proc "$isosyncdir"/proc - mount -t sysfs sysfs "$isosyncdir"/sys - mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$isosyncdir"/dev - mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$isosyncdir"/dev/pts - mount -t tmpfs -o nosuid,nodev none "$isosyncdir"/dev/shm - mount -t tmpfs -o nosuid,nodev,noexec none "$isosyncdir"/tmp -} - -isostop () { - umount -l "$isosyncdir"/proc > /dev/null 2>&1 - umount -l "$isosyncdir"/sys > /dev/null 2>&1 - umount -l "$isosyncdir"/dev/pts > /dev/null 2>&1 - umount -l "$isosyncdir"/dev/shm > /dev/null 2>&1 - umount -l "$isosyncdir"/dev > /dev/null 2>&1 - umount -l "$isosyncdir"/tmp > /dev/null 2>&1 - umount -l "$isosyncdir"/usr/portage/packages > /dev/null 2>&1 -} - -isousertree () { - echo "" - echo "injecting minimal portage tree into environment (user mode)" - echo "" - sleep 1 - chroot "$isosyncdir" su - "$isouser" -c "$isousertree" -} - -isooverlays () { - echo "injecting "$releasename" "$releasetarget" overlay into environment" - sleep 1 - chroot "$isosyncdir" su - "$isouser" -c "$isomainoverlay" -} - -isobuildsystem () { - echo "injecting "$releasename" buildsystem && setting up portage" - echo "" - sleep 1 - chroot "$isosyncdir" su - "$isouser" -c "$isobuildgit" -} - -isoramfs () { - chroot "$isosyncdir" su - "$isouser" -c "$isodracutcmd" -} - -systemramfs () { - chroot "$isosyncdir" su - "$isouser" -c "$dracutcmd" -} - -isoefiimg () { - chroot "$isosyncdir" su - "$isouser" -c "$isoeficmd" -} - -isochroot () { - echo -e "" - echo -e "DROPPING YOU TO A ROOT SHELL INTO ISO ENVIRONMENT" - echo -e "INSTALL APPS & TARGETS & DES YOU WANT INSIDE ISO" - echo -e "EXIT WHEN YOU'RE DONE AND I'LL CREATE THE IMAGE" - echo -e "" - chroot "$isosyncdir" su - "$isouser" -} diff --git a/vasile-kogaion b/vasile-kogaion deleted file mode 100755 index a20e1ca..0000000 --- a/vasile-kogaion +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env bash -# Say Hello to Vasile, a modular script to build Kogaion/Argent Linux packages && ISO images using a clean squashfs + overlayfs chroot -# Main author : Ghiunhan Mamut (aka V3n3RiX) @ RogentOS Development Group -# Dependencies : kernel built with squashfs + overlayfs + loopback support && sys-fs/grub:2 && sys-fs/squashfs-tools && dev-libs/libisoburn && sys-fs/mtools -# - -# generic variables - -export local releasename="kogaion" -export local releasetarget="desktop" -export local releaseversion="3" -export local kernelver="3.14.50-"$releasename"" -export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" -export local chrootx64md5=""$chrootx64".md5" - -# build variables - -export local rodir="rodir" -export local rwdir="rwdir" -export local workdir="workdir" # only needed for overlayfs on kernel greather than 3.18 -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/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" - -# iso variables - -export local bootcorepath="/tmp/bootcore" -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/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" - -export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver"" -export local isodracutrd="initramfs-"$kernelver".img" -export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" -export local isomainarch="x86_64" -export local isorootdir=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch"" -export local isokernelname="kernel-genkernel-"$isomainarch"-"$kernelver"" -export local isostagingdir="/tmp/"$isorootdir"" -export local isosupersquashdir=""$isorootdir"/CDroot" -export local isolivesqfsdir=""$isosupersquashdir"/LiveOS" -export local isoliveosdir=""$isorootdir"/LiveOS" -export local isosyncdir=""$isorootdir"/rootfs" -export local isobootdir=""$isorootdir"/boot/grub" -export local isoefibootdir=""$isorootdir"/efi/boot" -export local dracutrd="initramfs-genkernel-"$isomainarch"-"$kernelver"" -export local dracutcmd="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrd""" - -source /usr/lib/vasile-kogaion/libvasile-kogaion - -case $1 in - --buildpkg) source /usr/share/vasile-kogaion/buildpkg - ;; - --buildiso) source /usr/share/vasile-kogaion/buildiso - ;; - --usermode) source /usr/share/vasile-kogaion/modereset - source /usr/share/vasile-kogaion/usermodeset - ;; - --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 "--buildpkg : build package/target in a clean squashed core" - echo -e "--buildiso : 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 "--help : display this help and exit" - echo -e "" - ;; - *) echo -e "error: no operation specified, use --help for help" - ;; -esac - -exit 0 -- cgit v1.2.3 From 4baf0ea369a74c341cc21b27ac1cbfec08bf1165 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 20 Apr 2016 18:19:26 +0100 Subject: adjust squashfs to vasile changes --- kvasile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kvasile b/kvasile index 172ae25..a9f8670 100755 --- a/kvasile +++ b/kvasile @@ -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/devmodeset" +export local chrootdevtree="/usr/share/kvasile/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/usermodeset" +export local isousertree="/usr/share/kvasile/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" -- cgit v1.2.3 From af26936d648563d8003a1d19fb170b90992fd3bf Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 20 Apr 2016 19:33:59 +0100 Subject: fix : greping so many files and feeding them to rm will trigger kernel ARG_MAX when switching from devmode to usermode --- modereset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modereset b/modereset index 84b0d35..166421e 100755 --- a/modereset +++ b/modereset @@ -5,7 +5,7 @@ export local confdir="/etc/portage" reset_current_mode() { if [ -d ""$portagedir"/.git" ] ; then - rm -rf $(find "$portagedir" -mindepth 1 | grep -v "distfiles" | grep -v "packages") + find "$portagedir" -mindepth 1 -name "packages" -prune -o -name "distfiles" -prune -o -exec rm -rf {} \; > /dev/null 2>&1 rm ""$confdir"/make.conf" rm ""$confdir"/make.profile" rm "$confdir" -- cgit v1.2.3 From 438f58670a5f54ab88937847bbb6e494eefb211d Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 24 Apr 2016 15:11:19 +0100 Subject: make vasile use the new kernel when building iso image --- kvasile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kvasile b/kvasile index a9f8670..2beae11 100755 --- a/kvasile +++ b/kvasile @@ -9,7 +9,7 @@ export local releasename="kogaion" export local releasetarget="desktop" export local releaseversion="3" -export local kernelver="3.14.50-"$releasename"" +export local kernelver="4.4.4-"$releasename"" export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" export local chrootx64md5=""$chrootx64".md5" -- cgit v1.2.3 From faee5dfe770876aada81d676658cb708f8d72ed7 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 14 May 2016 15:44:06 +0100 Subject: generate syslinux chainloader --- kvasile | 1 + 1 file changed, 1 insertion(+) diff --git a/kvasile b/kvasile index 2beae11..bae83c6 100755 --- a/kvasile +++ b/kvasile @@ -40,6 +40,7 @@ export local isobuildgit="cd /opt && git clone https://gitlab.com/"$releasename" export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver"" export local isodracutrd="initramfs-"$kernelver".img" export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" +export local isoubncmd="grub2-mkimage -d /usr/lib64/grub/i386-pc -o core.img -O i386-pc biosdisk part_msdos fat" export local isomainarch="x86_64" export local isorootdir=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch"" export local isokernelname="kernel-genkernel-"$isomainarch"-"$kernelver"" -- cgit v1.2.3 From 3bca8966cfbe0ec58e3a58cc4a592b7002b0e1c6 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 14 May 2016 15:54:33 +0100 Subject: plug all parts together...from now on, chainloader will be created automatically --- buildiso | 7 +++++++ kvasile | 2 +- libkvasile | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/buildiso b/buildiso index 86c20b3..fdf993b 100755 --- a/buildiso +++ b/buildiso @@ -41,6 +41,13 @@ prepareiso () { # copy efi image into cdroot mv ""$isosyncdir"/root/bootx64.efi" "$isoefibootdir" chmod 755 ""$isoefibootdir"/bootx64.efi" + # generate grub chainloader for syslinux + isostart + isochainload + isostop + # copy chainloader parts into cdroot + mv ""$isosyncdir"/root/core.img" "$isobootdir" + cp -avx ""$isosyncdir"/usr/lib64/grub/i386-pc/lnxboot.img" "$isobootdir" # configure portage && give up control for package / desktop environment installation isostart isooverlays diff --git a/kvasile b/kvasile index bae83c6..5259e7a 100755 --- a/kvasile +++ b/kvasile @@ -40,7 +40,7 @@ export local isobuildgit="cd /opt && git clone https://gitlab.com/"$releasename" export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver"" export local isodracutrd="initramfs-"$kernelver".img" export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" -export local isoubncmd="grub2-mkimage -d /usr/lib64/grub/i386-pc -o core.img -O i386-pc biosdisk part_msdos fat" +export local isochainloadcmd="grub2-mkimage -d /usr/lib64/grub/i386-pc -o core.img -O i386-pc biosdisk part_msdos fat" export local isomainarch="x86_64" export local isorootdir=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch"" export local isokernelname="kernel-genkernel-"$isomainarch"-"$kernelver"" diff --git a/libkvasile b/libkvasile index d187456..73ea8d7 100755 --- a/libkvasile +++ b/libkvasile @@ -180,6 +180,10 @@ isoefiimg () { chroot "$isosyncdir" su - "$isouser" -c "$isoeficmd" } +isochainload () { + chroot "$isosyncdir" su - "$isouser" -c "$isochainloadcmd" +} + isochroot () { echo -e "" echo -e "DROPPING YOU TO A ROOT SHELL INTO ISO ENVIRONMENT" -- cgit v1.2.3 From 34b4ee0f3bdf46ef2d9a9151cf17add400a0a6c8 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 21 May 2016 11:44:13 +0100 Subject: small improvements --- buildiso | 94 ---------------------------------------------------------------- buildpkg | 41 ---------------------------- kvasile | 8 +++--- makeiso | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ makepkg | 41 ++++++++++++++++++++++++++++ 5 files changed, 139 insertions(+), 139 deletions(-) delete mode 100755 buildiso delete mode 100755 buildpkg create mode 100755 makeiso create mode 100755 makepkg diff --git a/buildiso b/buildiso deleted file mode 100755 index fdf993b..0000000 --- a/buildiso +++ /dev/null @@ -1,94 +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" - # generate grub chainloader for syslinux - isostart - isochainload - isostop - # copy chainloader parts into cdroot - mv ""$isosyncdir"/root/core.img" "$isobootdir" - cp -avx ""$isosyncdir"/usr/lib64/grub/i386-pc/lnxboot.img" "$isobootdir" - # 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 deleted file mode 100755 index 3121bf4..0000000 --- a/buildpkg +++ /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/kvasile b/kvasile index 5259e7a..80e3a03 100755 --- a/kvasile +++ b/kvasile @@ -57,9 +57,9 @@ export local dracutcmd="dracut -N -o systemd -o systemd-initrd -o systemd-networ source /usr/lib/kvasile/libkvasile case $1 in - --buildpkg) source /usr/share/kvasile/buildpkg + --buildpkg) source /usr/share/kvasile/makepkg ;; - --buildiso) source /usr/share/kvasile/buildiso + --buildiso) source /usr/share/kvasile/makeiso ;; --usermode) source /usr/share/kvasile/modereset source /usr/share/kvasile/usermodeset @@ -71,8 +71,8 @@ case $1 in echo -e "Usage: kvasile [options]" echo -e "" echo -e "Options:" - echo -e "--buildpkg : build package/target in a clean squashed core" - echo -e "--buildiso : build iso based on clean squashed core + targets" + echo -e "--makepkg : build package/target in a clean squashed core" + echo -e "--makeiso : 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 "--help : display this help and exit" diff --git a/makeiso b/makeiso new file mode 100755 index 0000000..fdf993b --- /dev/null +++ b/makeiso @@ -0,0 +1,94 @@ +#!/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" + # generate grub chainloader for syslinux + isostart + isochainload + isostop + # copy chainloader parts into cdroot + mv ""$isosyncdir"/root/core.img" "$isobootdir" + cp -avx ""$isosyncdir"/usr/lib64/grub/i386-pc/lnxboot.img" "$isobootdir" + # 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/makepkg b/makepkg new file mode 100755 index 0000000..3121bf4 --- /dev/null +++ b/makepkg @@ -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 -- cgit v1.2.3 From f245f35f8de1962ae36d2b49b6ced354bd6f40be Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 21 May 2016 13:16:57 +0100 Subject: forgot to change those --- kvasile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kvasile b/kvasile index 80e3a03..6e15b77 100755 --- a/kvasile +++ b/kvasile @@ -57,9 +57,9 @@ export local dracutcmd="dracut -N -o systemd -o systemd-initrd -o systemd-networ source /usr/lib/kvasile/libkvasile case $1 in - --buildpkg) source /usr/share/kvasile/makepkg + --makepkg) source /usr/share/kvasile/makepkg ;; - --buildiso) source /usr/share/kvasile/makeiso + --makeiso) source /usr/share/kvasile/makeiso ;; --usermode) source /usr/share/kvasile/modereset source /usr/share/kvasile/usermodeset -- cgit v1.2.3 From 42db0af4dfac231d1d011e830e5451a1236580a7 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 16 Jul 2016 17:47:07 +0100 Subject: always reset mode before switching between usermode and devmode && and always use fresh upstream copy of portage configs so that whatever someone fucks in devmode, usermode is never affected...just switch back and upgrade --- kvasile | 2 +- modereset | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/kvasile b/kvasile index 6e15b77..0007b2a 100755 --- a/kvasile +++ b/kvasile @@ -74,7 +74,7 @@ case $1 in echo -e "--makepkg : build package/target in a clean squashed core" echo -e "--makeiso : 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 "--devmode : switch INSTALLED Kogaion system to devmode (use source packages from portage tree)" echo -e "--help : display this help and exit" echo -e "" ;; diff --git a/modereset b/modereset index 166421e..e961c6a 100755 --- a/modereset +++ b/modereset @@ -2,17 +2,30 @@ export local portagedir="/usr/portage" export local confdir="/etc/portage" +export local gitdir="/opt/kogaion-build" -reset_current_mode() { +empty_portage_tree() { if [ -d ""$portagedir"/.git" ] ; then find "$portagedir" -mindepth 1 -name "packages" -prune -o -name "distfiles" -prune -o -exec rm -rf {} \; > /dev/null 2>&1 - rm ""$confdir"/make.conf" - rm ""$confdir"/make.profile" - rm "$confdir" fi } +reset_portage_config() { + rm ""$confdir"/make.conf" + rm ""$confdir"/make.profile" + rm "$confdir" + rm -rf "$gitdir" +} + +fetch_portage_config() { + pushd /opt > /dev/null 2>&1 + git clone https://gitlab.com/kogaion/kogaion-build.git > /dev/null 2>&1 + popd > /dev/null 2>&1 +} + main () { - reset_current_mode + empty_portage_tree + reset_portage_config + fetch_portage_config } main -- cgit v1.2.3 From 6b098dc017a69cac78a4f56c497c717cb72e4508 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 7 Aug 2016 16:12:42 +0100 Subject: enable systemservices at iso creation --- libkvasile | 6 ++++++ makeiso | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/libkvasile b/libkvasile index 73ea8d7..c2e496e 100755 --- a/libkvasile +++ b/libkvasile @@ -184,6 +184,12 @@ isochainload () { chroot "$isosyncdir" su - "$isouser" -c "$isochainloadcmd" } +isoservices () { + for service in cups kogaionlive lightdm NetworkManager virtualbox-guest-additions ; do + chroot "$isosyncdir" su - "$isouser" -c "systemctl enable "$service"" + done +} + isochroot () { echo -e "" echo -e "DROPPING YOU TO A ROOT SHELL INTO ISO ENVIRONMENT" diff --git a/makeiso b/makeiso index fdf993b..0c7b8f9 100755 --- a/makeiso +++ b/makeiso @@ -55,6 +55,10 @@ prepareiso () { isousertree isochroot isostop + # enable system services + isostart + isoservices + isostop # unmount rootfs before compression umount -l "$isosyncdir" > /dev/null 2>&1 # move rootfs in place -- cgit v1.2.3 From 3012f3053db8d3b4c4443cd49d6ef08424d6f58e Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 18 Aug 2016 19:11:34 +0100 Subject: connman should be enabled by default in lxqt --- libkvasile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libkvasile b/libkvasile index c2e496e..67aa65b 100755 --- a/libkvasile +++ b/libkvasile @@ -185,7 +185,7 @@ isochainload () { } isoservices () { - for service in cups kogaionlive lightdm NetworkManager virtualbox-guest-additions ; do + for service in cups connman kogaionlive lightdm NetworkManager virtualbox-guest-additions ; do chroot "$isosyncdir" su - "$isouser" -c "systemctl enable "$service"" done } -- cgit v1.2.3 From 994178b1c5757d37c190aa2c4032d7a5a69d9623 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 28 Aug 2016 14:21:40 +0100 Subject: bump vasile to use new kernel --- kvasile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kvasile b/kvasile index 0007b2a..31b2f8f 100755 --- a/kvasile +++ b/kvasile @@ -9,7 +9,7 @@ export local releasename="kogaion" export local releasetarget="desktop" export local releaseversion="3" -export local kernelver="4.4.4-"$releasename"" +export local kernelver="4.4.5-"$releasename"" export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" export local chrootx64md5=""$chrootx64".md5" -- cgit v1.2.3 From 13b0fd28a276552f2a15439309f1e0b1d0cd13b5 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 4 Sep 2016 14:27:36 +0100 Subject: avoid bouncing back and forward with variables and functions...check requirements only once...add reset option --- kvasile | 61 ++++++++++++------------------------------------------------- libkvasile | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ makeiso | 5 ----- makepkg | 5 ----- 4 files changed, 73 insertions(+), 59 deletions(-) diff --git a/kvasile b/kvasile index 31b2f8f..9256187 100755 --- a/kvasile +++ b/kvasile @@ -4,63 +4,25 @@ # Dependencies : kernel built with squashfs + overlayfs + loopback support && sys-fs/grub:2 && sys-fs/squashfs-tools && dev-libs/libisoburn && sys-fs/mtools # -# generic variables +# Import our variables and functions -export local releasename="kogaion" -export local releasetarget="desktop" -export local releaseversion="3" -export local kernelver="4.4.5-"$releasename"" -export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" -export local chrootx64md5=""$chrootx64".md5" - -# build variables - -export local rodir="rodir" -export local rwdir="rwdir" -export local workdir="workdir" # only needed for overlayfs on kernel greather than 3.18 -export local overlaydir="overlaydir" -export local chrootuser="root" -export local chroottarget="${@:2}" -export local chrootbuildtarget="emerge -kav "$chroottarget"" -export local chrootdevtree="/usr/share/kvasile/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" - -# iso variables +source /usr/lib/kvasile/libkvasile -export local bootcorepath="/tmp/bootcore" -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/kvasile/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" +# Vasile need root privileges and a proper kernel to run +# Also, running it in live mode is a really bad idea -export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver"" -export local isodracutrd="initramfs-"$kernelver".img" -export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" -export local isochainloadcmd="grub2-mkimage -d /usr/lib64/grub/i386-pc -o core.img -O i386-pc biosdisk part_msdos fat" -export local isomainarch="x86_64" -export local isorootdir=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch"" -export local isokernelname="kernel-genkernel-"$isomainarch"-"$kernelver"" -export local isostagingdir="/tmp/"$isorootdir"" -export local isosupersquashdir=""$isorootdir"/CDroot" -export local isolivesqfsdir=""$isosupersquashdir"/LiveOS" -export local isoliveosdir=""$isorootdir"/LiveOS" -export local isosyncdir=""$isorootdir"/rootfs" -export local isobootdir=""$isorootdir"/boot/grub" -export local isoefibootdir=""$isorootdir"/efi/boot" -export local dracutrd="initramfs-genkernel-"$isomainarch"-"$kernelver"" -export local dracutcmd="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrd""" +checkroot +checkiflive +kernelconfig -source /usr/lib/kvasile/libkvasile case $1 in --makepkg) source /usr/share/kvasile/makepkg ;; --makeiso) source /usr/share/kvasile/makeiso ;; + --resetmode) source /usr/share/kvasile/modereset + ;; --usermode) source /usr/share/kvasile/modereset source /usr/share/kvasile/usermodeset ;; @@ -73,8 +35,9 @@ case $1 in echo -e "Options:" echo -e "--makepkg : build package/target in a clean squashed core" echo -e "--makeiso : 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 "--resetmode : reset INSTALLED Kogaion system state - You're on your own, you've been warned!" + echo -e "--usermode : switch INSTALLED Kogaion system state to usermode - use binary packages from repositories" + echo -e "--devmode : switch INSTALLED Kogaion system state to devmode (aka Gentoo mode) - use source packages from portage tree" echo -e "--help : display this help and exit" echo -e "" ;; diff --git a/libkvasile b/libkvasile index 67aa65b..23a3874 100755 --- a/libkvasile +++ b/libkvasile @@ -1,3 +1,55 @@ +#!/usr/bin/env bash + +# generic variables + +export local releasename="kogaion" +export local releasetarget="desktop" +export local releaseversion="3" +export local kernelver="4.4.5-"$releasename"" +export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" +export local chrootx64md5=""$chrootx64".md5" + +# build variables + +export local rodir="rodir" +export local rwdir="rwdir" +export local workdir="workdir" # only needed for overlayfs on kernel greather than 3.18 +export local overlaydir="overlaydir" +export local chrootuser="root" +export local chroottarget="${@:2}" +export local chrootbuildtarget="emerge -kav "$chroottarget"" +export local chrootdevtree="/usr/share/kvasile/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" + +# iso variables + +export local bootcorepath="/tmp/bootcore" +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/kvasile/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" + +export local isodracutcmd="dracut -N -a dmsquash-live -a pollcdrom -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver"" +export local isodracutrd="initramfs-"$kernelver".img" +export local isoeficmd="grub2-mkimage -d /usr/lib64/grub/x86_64-efi -o bootx64.efi -O x86_64-efi ext2 fat udf btrfs ntfs reiserfs xfs hfsplus lvm ata part_msdos part_gpt part_apple bsd search_fs_uuid normal chain iso9660 configfile help loadenv reboot cat search memdisk tar boot linux chain" +export local isochainloadcmd="grub2-mkimage -d /usr/lib64/grub/i386-pc -o core.img -O i386-pc biosdisk part_msdos fat" +export local isomainarch="x86_64" +export local isorootdir=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch"" +export local isokernelname="kernel-genkernel-"$isomainarch"-"$kernelver"" +export local isostagingdir="/tmp/"$isorootdir"" +export local isosupersquashdir=""$isorootdir"/CDroot" +export local isolivesqfsdir=""$isosupersquashdir"/LiveOS" +export local isoliveosdir=""$isorootdir"/LiveOS" +export local isosyncdir=""$isorootdir"/rootfs" +export local isobootdir=""$isorootdir"/boot/grub" +export local isoefibootdir=""$isorootdir"/efi/boot" +export local dracutrd="initramfs-genkernel-"$isomainarch"-"$kernelver"" +export local dracutcmd="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrd""" + # generic functions (used for both build && iso creation) kernelconfig () { @@ -25,6 +77,15 @@ checkroot () { fi } +checkiflive () { + if [[ -L /dev/mapper/live-base ]] ; then + echo "" + echo "Running Vasile in live mode is a bad idea ... aborting !!!" + echo "" + exit 1 + fi +} + chrootchecksum () { while : true ; do if [[ -f "$chrootx64" && -f "$chrootx64md5" ]] ; then diff --git a/makeiso b/makeiso index 0c7b8f9..8c8cbe4 100755 --- a/makeiso +++ b/makeiso @@ -1,10 +1,5 @@ #!/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" diff --git a/makepkg b/makepkg index 3121bf4..d8590b5 100755 --- a/makepkg +++ b/makepkg @@ -1,10 +1,5 @@ #!/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 -- cgit v1.2.3 From 145522311104a5df2cddce6e5844ae74d18539b3 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 4 Sep 2016 14:58:33 +0100 Subject: fix intendation --- kvasile | 59 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/kvasile b/kvasile index 9256187..2fd2fa2 100755 --- a/kvasile +++ b/kvasile @@ -17,32 +17,39 @@ kernelconfig case $1 in - --makepkg) source /usr/share/kvasile/makepkg - ;; - --makeiso) source /usr/share/kvasile/makeiso - ;; - --resetmode) source /usr/share/kvasile/modereset - ;; - --usermode) source /usr/share/kvasile/modereset - source /usr/share/kvasile/usermodeset - ;; - --devmode) source /usr/share/kvasile/modereset - source /usr/share/kvasile/devmodeset - ;; - --help) echo -e "" - echo -e "Usage: kvasile [options]" - echo -e "" - echo -e "Options:" - echo -e "--makepkg : build package/target in a clean squashed core" - echo -e "--makeiso : build iso based on clean squashed core + targets" - echo -e "--resetmode : reset INSTALLED Kogaion system state - You're on your own, you've been warned!" - echo -e "--usermode : switch INSTALLED Kogaion system state to usermode - use binary packages from repositories" - echo -e "--devmode : switch INSTALLED Kogaion system state to devmode (aka Gentoo mode) - use source packages from portage tree" - echo -e "--help : display this help and exit" - echo -e "" - ;; - *) echo -e "error: no operation specified, use --help for help" - ;; + --makepkg) + source /usr/share/kvasile/makepkg + ;; + --makeiso) + source /usr/share/kvasile/makeiso + ;; + --resetmode) + source /usr/share/kvasile/modereset + ;; + --usermode) + source /usr/share/kvasile/modereset + source /usr/share/kvasile/usermodeset + ;; + --devmode) + source /usr/share/kvasile/modereset + source /usr/share/kvasile/devmodeset + ;; + --help) + echo -e "" + echo -e "Usage: kvasile [options]" + echo -e "" + echo -e "Options:" + echo -e "--makepkg : build package/target in a clean squashed core" + echo -e "--makeiso : build iso based on clean squashed core + targets" + echo -e "--resetmode : reset INSTALLED Kogaion system state - You're on your own, you've been warned!" + echo -e "--usermode : switch INSTALLED Kogaion system state to usermode - use binary packages from repositories" + echo -e "--devmode : switch INSTALLED Kogaion system state to devmode (aka Gentoo mode) - use source packages from portage tree" + echo -e "--help : display this help and exit" + echo -e "" + ;; + *) + echo -e "error: no operation specified, use --help for help" + ;; esac exit 0 -- cgit v1.2.3 From 4f813466c4b55b8992f295691a3a9c15b319e8d2 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 4 Sep 2016 16:45:39 +0100 Subject: adjust vasile to work on our latest kernel --- libkvasile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libkvasile b/libkvasile index 23a3874..112251e 100755 --- a/libkvasile +++ b/libkvasile @@ -53,7 +53,7 @@ export local dracutcmd="dracut -N -o systemd -o systemd-initrd -o systemd-networ # generic functions (used for both build && iso creation) kernelconfig () { - if [[ $(zgrep 'CONFIG_OVERLAYFS_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then + if [[ $(zgrep 'CONFIG_OVERLAY_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then # if you use 3.18 LTS or newer kernels, change CONFIG_OVERLAYFS_FS to CONFIG_OVERLAY_FS echo "" echo "Kernel configuration seems OK, moving on" -- cgit v1.2.3 From 7e54680f0e40a7ecd76cbf65741aa290c26dd1a8 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 8 Sep 2016 19:00:46 +0100 Subject: enable some lvm2 services && ModemManager by default --- libkvasile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libkvasile b/libkvasile index 112251e..bc8edac 100755 --- a/libkvasile +++ b/libkvasile @@ -246,7 +246,7 @@ isochainload () { } isoservices () { - for service in cups connman kogaionlive lightdm NetworkManager virtualbox-guest-additions ; do + for service in cups connman dm-event kogaionlive lightdm lvm2-lvmetad lvm2-monitor NetworkManager ModemManager virtualbox-guest-additions ; do chroot "$isosyncdir" su - "$isouser" -c "systemctl enable "$service"" done } -- cgit v1.2.3 From 21b03a3f899c380310f084ea7ac9bb34cf5b677e Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 22 Sep 2016 18:03:26 +0100 Subject: make vasile use our portage tree clone --- devmodeset | 2 +- usermodeset | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/devmodeset b/devmodeset index cd28d1b..ac1ff3f 100755 --- a/devmodeset +++ b/devmodeset @@ -7,7 +7,7 @@ export local gitdir="/opt/kogaion-build/conf/intel/portage" fetch_devmode_portage_tree() { if [[ ! -d "$portagedir"/.git ]] ; then cd "$portagedir" && git init > /dev/null 2>&1 - git remote add origin git://anongit.gentoo.org/repo/gentoo.git + git remote add origin https://gitlab.com/kogaion/portage.git git pull --depth=1 origin master git branch -u origin/master master rm -rf ""$portagedir"/profiles/updates" diff --git a/usermodeset b/usermodeset index ae4a9ec..0edef40 100755 --- a/usermodeset +++ b/usermodeset @@ -7,7 +7,7 @@ export local gitdir="/opt/kogaion-build/conf/intel/portage" fetch_usermode_portage_tree() { if [[ ! -d "$portagedir"/.git ]] ; then cd "$portagedir" && git init > /dev/null 2>&1 - git remote add origin git://anongit.gentoo.org/repo/gentoo.git + git remote add origin https://gitlab.com/kogaion/portage.git git config core.sparsecheckout true echo "profiles/*" >> .git/info/sparse-checkout echo "metadata/*" >> .git/info/sparse-checkout -- cgit v1.2.3 From 822ba778053b8ba94f0adb6a2a9b9282b53d1b49 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 10 Oct 2016 18:30:39 +0100 Subject: make use of gentoo functions --- kvasile | 23 ++++++++--------- libkvasile | 87 ++++++++++++++++++++++++-------------------------------------- 2 files changed, 45 insertions(+), 65 deletions(-) diff --git a/kvasile b/kvasile index 2fd2fa2..4a4bdf5 100755 --- a/kvasile +++ b/kvasile @@ -35,20 +35,19 @@ case $1 in source /usr/share/kvasile/devmodeset ;; --help) - echo -e "" - echo -e "Usage: kvasile [options]" - echo -e "" - echo -e "Options:" - echo -e "--makepkg : build package/target in a clean squashed core" - echo -e "--makeiso : build iso based on clean squashed core + targets" - echo -e "--resetmode : reset INSTALLED Kogaion system state - You're on your own, you've been warned!" - echo -e "--usermode : switch INSTALLED Kogaion system state to usermode - use binary packages from repositories" - echo -e "--devmode : switch INSTALLED Kogaion system state to devmode (aka Gentoo mode) - use source packages from portage tree" - echo -e "--help : display this help and exit" - echo -e "" + einfo "Usage: kvasile [options]" + einfo "" + einfo "Options:" + einfo "--makepkg : build package/target in a clean squashed core" + einfo "--makeiso : build iso based on clean squashed core + targets" + einfo "--resetmode : reset INSTALLED Kogaion system state - You're on your own, you've been warned!" + einfo "--usermode : switch INSTALLED Kogaion system state to usermode - use binary packages from repositories" + einfo "--devmode : switch INSTALLED Kogaion system state to devmode (aka Gentoo mode) - use source packages from portage tree" + einfo "--help : display this help and exit" + einfo "" ;; *) - echo -e "error: no operation specified, use --help for help" + eerror -e "error: no operation specified, use --help for help" ;; esac diff --git a/libkvasile b/libkvasile index bc8edac..63ffbd9 100755 --- a/libkvasile +++ b/libkvasile @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# import gentoo functions +source /lib/gentoo/functions.sh + # generic variables export local releasename="kogaion" @@ -55,33 +58,25 @@ export local dracutcmd="dracut -N -o systemd -o systemd-initrd -o systemd-networ kernelconfig () { if [[ $(zgrep 'CONFIG_OVERLAY_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then # if you use 3.18 LTS or newer kernels, change CONFIG_OVERLAYFS_FS to CONFIG_OVERLAY_FS - echo "" - echo "Kernel configuration seems OK, moving on" - echo "" + einfo "Kernel configuration seems OK, moving on" sleep 1 else - echo "" - echo "Vasile needs OVERLAYFS && SQUASHFS && LOOP DEVICES to work" - echo "Please rebuild the kernel with those activated to use it" - echo "" + eerror "Vasile needs OVERLAYFS && SQUASHFS && LOOP DEVICES to work" + eerror "Please rebuild the kernel with those activated to use it" exit 1 fi } checkroot () { if [[ "$(whoami)" != root ]] ; then - echo "" - echo "You're not root?...No cookies for you, go away !!!" - echo "" + eerror "You're not root?...No cookies for you, go away !!!" exit 1 fi } checkiflive () { if [[ -L /dev/mapper/live-base ]] ; then - echo "" - echo "Running Vasile in live mode is a bad idea ... aborting !!!" - echo "" + eerror "Running Vasile in live mode is a bad idea ... aborting !!!" exit 1 fi } @@ -89,19 +84,17 @@ checkiflive () { chrootchecksum () { while : true ; do if [[ -f "$chrootx64" && -f "$chrootx64md5" ]] ; then - echo "good, squashed chroot && checksum file found ... verifying integrity" - echo "" + einfo "good, squashed chroot && checksum file found ... verifying integrity" if [[ "$(md5sum -c "$chrootx64md5")" ]] ; then - echo "good, squashed chroot checksum passed ... starting engines" - echo "" + einfo "good, squashed chroot checksum passed ... starting engines" sleep 1 break else - echo "ooops, squashed chroot checksum failed ... aborting" + eerror "ooops, squashed chroot checksum failed ... aborting" exit 1 fi else - echo "ooops, squashed chroot or checksum file not found ... aborting" + eerror "ooops, squashed chroot or checksum file not found ... aborting" exit 1 fi done @@ -140,49 +133,42 @@ chrootstart () { } chrootdevtree () { - echo "" - echo "injecting full portage tree into build environment" - echo "" + einfo "injecting full portage tree into build environment" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootdevtree" } chrootoverlays () { - echo "injecting "$releasename" "$releasetarget" overlay into build environment" + einfo "injecting "$releasename" "$releasetarget" overlay into build environment" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootmainoverlay" } chrootbuildsystem () { - echo "injecting "$releasename" buildsystem && setting up portage" - echo "" + einfo "injecting "$releasename" buildsystem && setting up portage" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildgit" } chrootbuild () { - echo "" - echo "Environment is up && running ... building targets" + einfo "Environment is up && running ... building targets" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildtarget" } chrootx64 () { - echo -e "" - echo -e "#################################################################" - echo -e "# ENTERING CHROOT ENV FOR YOU TO PUSH BUILT PACKAGES #" - echo -e "# OR TO FIX EVENTUAL BUILD ERRORS #" - echo -e "#################################################################" - echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" - echo -e "#################################################################" - echo -e "# NEXT RUN OF THIS SCRIPT WILL DESTROY ALL YOUR WORK #" - echo -e "# DO NOT EXIT CHROOT UNTIL ALL PACKAGES ARE PUSHED TO REPOS #" - echo -e "# OR, IN CASE OF BUILD FAILURES, UNTIL ALL FIXES ARE COMMITED #" - echo -e "#################################################################" - echo -e "# !!! WARNING !!! WARNING !!! WARNING !!! #" - echo -e "#################################################################" - echo -e "" - echo -e "" + einfo "#################################################################" + einfo "# ENTERING CHROOT ENV FOR YOU TO PUSH BUILT PACKAGES #" + einfo "# OR TO FIX EVENTUAL BUILD ERRORS #" + einfo "#################################################################" + einfo "# !!! WARNING !!! WARNING !!! WARNING !!! #" + einfo "#################################################################" + einfo "# NEXT RUN OF THIS SCRIPT WILL DESTROY ALL YOUR WORK #" + einfo "# DO NOT EXIT CHROOT UNTIL ALL PACKAGES ARE PUSHED TO REPOS #" + einfo "# OR, IN CASE OF BUILD FAILURES, UNTIL ALL FIXES ARE COMMITED #" + einfo "#################################################################" + einfo "# !!! WARNING !!! WARNING !!! WARNING !!! #" + einfo "#################################################################" chroot "$overlaydir" su - "$chrootuser" } @@ -209,22 +195,19 @@ isostop () { } isousertree () { - echo "" - echo "injecting minimal portage tree into environment (user mode)" - echo "" + einfo "injecting minimal portage tree into environment (user mode)" sleep 1 chroot "$isosyncdir" su - "$isouser" -c "$isousertree" } isooverlays () { - echo "injecting "$releasename" "$releasetarget" overlay into environment" + einfo "injecting "$releasename" "$releasetarget" overlay into environment" sleep 1 chroot "$isosyncdir" su - "$isouser" -c "$isomainoverlay" } isobuildsystem () { - echo "injecting "$releasename" buildsystem && setting up portage" - echo "" + einfo "injecting "$releasename" buildsystem && setting up portage" sleep 1 chroot "$isosyncdir" su - "$isouser" -c "$isobuildgit" } @@ -252,10 +235,8 @@ isoservices () { } isochroot () { - echo -e "" - echo -e "DROPPING YOU TO A ROOT SHELL INTO ISO ENVIRONMENT" - echo -e "INSTALL APPS & TARGETS & DES YOU WANT INSIDE ISO" - echo -e "EXIT WHEN YOU'RE DONE AND I'LL CREATE THE IMAGE" - echo -e "" + einfo "DROPPING YOU TO A ROOT SHELL INTO ISO ENVIRONMENT" + einfo "INSTALL APPS & TARGETS & DES YOU WANT INSIDE ISO" + einfo "EXIT WHEN YOU'RE DONE AND I'LL CREATE THE IMAGE" chroot "$isosyncdir" su - "$isouser" } -- cgit v1.2.3 From 5efcfd7f941b021b7638cd2870be5f88d5eca728 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 10 Oct 2016 18:41:54 +0100 Subject: drop support for kernel 3.14 --- kvasile | 3 +-- libkvasile | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/kvasile b/kvasile index 4a4bdf5..9e5c55c 100755 --- a/kvasile +++ b/kvasile @@ -44,10 +44,9 @@ case $1 in einfo "--usermode : switch INSTALLED Kogaion system state to usermode - use binary packages from repositories" einfo "--devmode : switch INSTALLED Kogaion system state to devmode (aka Gentoo mode) - use source packages from portage tree" einfo "--help : display this help and exit" - einfo "" ;; *) - eerror -e "error: no operation specified, use --help for help" + eerror "error: no operation specified, use --help for help" ;; esac diff --git a/libkvasile b/libkvasile index 63ffbd9..b2880d8 100755 --- a/libkvasile +++ b/libkvasile @@ -117,11 +117,7 @@ chrootstop () { chrootstart () { mount -t squashfs "$chrootx64" "$rodir" - if [[ "$(uname -r | cut -d . -f1,2)" = "3.14" ]] ; then - mount -t overlayfs -o lowerdir="$rodir",upperdir="$rwdir" overlayfs "$overlaydir" - else # kernel version equal or above 3.18 - mount -t overlay -o lowerdir="$rodir",upperdir="$rwdir",workdir="$workdir" overlay "$overlaydir" - fi + mount -t overlay -o lowerdir="$rodir",upperdir="$rwdir",workdir="$workdir" overlay "$overlaydir" mount -o bind packages "$overlaydir"/usr/portage/packages mount -o bind distfiles "$overlaydir"/usr/portage/distfiles mount -t proc proc "$overlaydir"/proc -- cgit v1.2.3 From c37d43c2fb1513188a1cdc6f4124d093ccf7c333 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 11 Oct 2016 22:05:19 +0100 Subject: auto enable avahi daemon --- libkvasile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libkvasile b/libkvasile index b2880d8..e938d2b 100755 --- a/libkvasile +++ b/libkvasile @@ -225,7 +225,7 @@ isochainload () { } isoservices () { - for service in cups connman dm-event kogaionlive lightdm lvm2-lvmetad lvm2-monitor NetworkManager ModemManager virtualbox-guest-additions ; do + for service in avahi-daemon cups connman dm-event kogaionlive lightdm lvm2-lvmetad lvm2-monitor NetworkManager ModemManager virtualbox-guest-additions ; do chroot "$isosyncdir" su - "$isouser" -c "systemctl enable "$service"" done } -- cgit v1.2.3 From 776c6d8125820d0c281a4dc1027b35bfe6f9af3d Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 18 Oct 2016 18:43:14 +0100 Subject: do not create a system initramfs anymore, we rely on kernel and dracut to handle it --- libkvasile | 8 +------- makeiso | 4 ---- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/libkvasile b/libkvasile index e938d2b..5d7988a 100755 --- a/libkvasile +++ b/libkvasile @@ -8,7 +8,7 @@ source /lib/gentoo/functions.sh export local releasename="kogaion" export local releasetarget="desktop" export local releaseversion="3" -export local kernelver="4.4.5-"$releasename"" +export local kernelver="4.4.10-"$releasename"" export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" export local chrootx64md5=""$chrootx64".md5" @@ -50,8 +50,6 @@ export local isoliveosdir=""$isorootdir"/LiveOS" export local isosyncdir=""$isorootdir"/rootfs" export local isobootdir=""$isorootdir"/boot/grub" export local isoefibootdir=""$isorootdir"/efi/boot" -export local dracutrd="initramfs-genkernel-"$isomainarch"-"$kernelver"" -export local dracutcmd="dracut -N -o systemd -o systemd-initrd -o systemd-networkd -o dracut-systemd --force --kver "$kernelver" "/boot/"$dracutrd""" # generic functions (used for both build && iso creation) @@ -212,10 +210,6 @@ isoramfs () { chroot "$isosyncdir" su - "$isouser" -c "$isodracutcmd" } -systemramfs () { - chroot "$isosyncdir" su - "$isouser" -c "$dracutcmd" -} - isoefiimg () { chroot "$isosyncdir" su - "$isouser" -c "$isoeficmd" } diff --git a/makeiso b/makeiso index 8c8cbe4..e6ef8dc 100755 --- a/makeiso +++ b/makeiso @@ -23,10 +23,6 @@ prepareiso () { 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 -- cgit v1.2.3 From abf9e8a1a22b54976d6580c16e3f2397b6dd610c Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 22 Oct 2016 18:15:42 +0100 Subject: adjust vasile to use the new kernel --- libkvasile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libkvasile b/libkvasile index 5d7988a..d38c6f1 100755 --- a/libkvasile +++ b/libkvasile @@ -8,7 +8,7 @@ source /lib/gentoo/functions.sh export local releasename="kogaion" export local releasetarget="desktop" export local releaseversion="3" -export local kernelver="4.4.10-"$releasename"" +export local kernelver="4.8.4-"$releasename"" export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" export local chrootx64md5=""$chrootx64".md5" -- cgit v1.2.3 From 78c720beecec09a96fc5caf00b924c12432df828 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 25 Oct 2016 19:11:01 +0100 Subject: auto enable dkms service in our iso images --- libkvasile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libkvasile b/libkvasile index d38c6f1..b95b821 100755 --- a/libkvasile +++ b/libkvasile @@ -219,7 +219,7 @@ isochainload () { } isoservices () { - for service in avahi-daemon cups connman dm-event kogaionlive lightdm lvm2-lvmetad lvm2-monitor NetworkManager ModemManager virtualbox-guest-additions ; do + for service in avahi-daemon cups connman dkms dm-event kogaionlive lightdm lvm2-lvmetad lvm2-monitor NetworkManager ModemManager virtualbox-guest-additions ; do chroot "$isosyncdir" su - "$isouser" -c "systemctl enable "$service"" done } -- cgit v1.2.3 From d0fb65244a988b1b9a30ae40453b37c23d67fccf Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 26 Oct 2016 22:17:15 +0100 Subject: adjust some messages to todays reality --- libkvasile | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/libkvasile b/libkvasile index b95b821..04d21bd 100755 --- a/libkvasile +++ b/libkvasile @@ -30,8 +30,6 @@ export local chrootbuildgit="cd /opt && git clone https://gitlab.com/"$releasena export local bootcorepath="/tmp/bootcore" 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/kvasile/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" @@ -55,7 +53,6 @@ export local isoefibootdir=""$isorootdir"/efi/boot" kernelconfig () { if [[ $(zgrep 'CONFIG_OVERLAY_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then - # if you use 3.18 LTS or newer kernels, change CONFIG_OVERLAYFS_FS to CONFIG_OVERLAY_FS einfo "Kernel configuration seems OK, moving on" sleep 1 else @@ -74,7 +71,7 @@ checkroot () { checkiflive () { if [[ -L /dev/mapper/live-base ]] ; then - eerror "Running Vasile in live mode is a bad idea ... aborting !!!" + eerror "Running in Live mode is unsupported" exit 1 fi } @@ -82,17 +79,17 @@ checkiflive () { chrootchecksum () { while : true ; do if [[ -f "$chrootx64" && -f "$chrootx64md5" ]] ; then - einfo "good, squashed chroot && checksum file found ... verifying integrity" + einfo "Squashed chroot && Checksum file found" if [[ "$(md5sum -c "$chrootx64md5")" ]] ; then - einfo "good, squashed chroot checksum passed ... starting engines" + einfo "Squashed chroot checksum passed" sleep 1 break else - eerror "ooops, squashed chroot checksum failed ... aborting" + eerror "Squashed chroot checksum failed" exit 1 fi else - eerror "ooops, squashed chroot or checksum file not found ... aborting" + eerror "Squashed chroot || Checksum file not found" exit 1 fi done @@ -127,42 +124,34 @@ chrootstart () { } chrootdevtree () { - einfo "injecting full portage tree into build environment" + einfo "Injecting devmode portage tree" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootdevtree" } chrootoverlays () { - einfo "injecting "$releasename" "$releasetarget" overlay into build environment" + einfo "Injecting "$releasename" "$releasetarget" overlay" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootmainoverlay" } chrootbuildsystem () { - einfo "injecting "$releasename" buildsystem && setting up portage" + einfo "Injecting "$releasename" buildsystem" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildgit" } chrootbuild () { - einfo "Environment is up && running ... building targets" + einfo "All systems are go!" sleep 1 chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildtarget" } chrootx64 () { - einfo "#################################################################" - einfo "# ENTERING CHROOT ENV FOR YOU TO PUSH BUILT PACKAGES #" - einfo "# OR TO FIX EVENTUAL BUILD ERRORS #" - einfo "#################################################################" - einfo "# !!! WARNING !!! WARNING !!! WARNING !!! #" - einfo "#################################################################" - einfo "# NEXT RUN OF THIS SCRIPT WILL DESTROY ALL YOUR WORK #" - einfo "# DO NOT EXIT CHROOT UNTIL ALL PACKAGES ARE PUSHED TO REPOS #" - einfo "# OR, IN CASE OF BUILD FAILURES, UNTIL ALL FIXES ARE COMMITED #" - einfo "#################################################################" - einfo "# !!! WARNING !!! WARNING !!! WARNING !!! #" - einfo "#################################################################" + einfo "DROPPING YOU TO A ROOT SHELL INTO BUILD ENVIRONMENT" + einfo "FIX FAILURES && ADJUST PORTAGE CONFIGURATION FILES" + einfo "TEST USEFLAGS && KEYWORDS && MASKS IF REQUIRED" + einfo "IN THE END : DO NOT FORGET TO COMMIT YOUR CHANGES" chroot "$overlaydir" su - "$chrootuser" } @@ -189,19 +178,19 @@ isostop () { } isousertree () { - einfo "injecting minimal portage tree into environment (user mode)" + einfo "Injecting usermode portage tree" sleep 1 chroot "$isosyncdir" su - "$isouser" -c "$isousertree" } isooverlays () { - einfo "injecting "$releasename" "$releasetarget" overlay into environment" + einfo "Injecting "$releasename" "$releasetarget" overlay" sleep 1 chroot "$isosyncdir" su - "$isouser" -c "$isomainoverlay" } isobuildsystem () { - einfo "injecting "$releasename" buildsystem && setting up portage" + einfo "Injecting "$releasename" buildsystem" sleep 1 chroot "$isosyncdir" su - "$isouser" -c "$isobuildgit" } -- cgit v1.2.3 From 7fdb4e5689cf6cc1c7e524962a5940e64097b6c0 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 30 Oct 2016 02:20:47 +0000 Subject: adjustments for new kernel --- libkvasile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libkvasile b/libkvasile index 04d21bd..981f265 100755 --- a/libkvasile +++ b/libkvasile @@ -8,7 +8,7 @@ source /lib/gentoo/functions.sh export local releasename="kogaion" export local releasetarget="desktop" export local releaseversion="3" -export local kernelver="4.8.4-"$releasename"" +export local kernelver="4.8.5-"$releasename"" export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" export local chrootx64md5=""$chrootx64".md5" -- cgit v1.2.3