diff options
-rwxr-xr-x | devmod | 17 | ||||
-rwxr-xr-x | devmode | 17 | ||||
-rwxr-xr-x | iso | 100 | ||||
-rwxr-xr-x | libvasile-kogaion | 74 | ||||
-rwxr-xr-x | resetmode | 13 | ||||
-rwxr-xr-x | usermode (renamed from usermod) | 10 | ||||
-rwxr-xr-x | vasile-kogaion | 36 |
7 files changed, 140 insertions, 127 deletions
@@ -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 @@ -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 @@ -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 @@ -1,6 +1,6 @@ #!/usr/bin/env bash -fetch_portage_tree() { +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 @@ -9,14 +9,14 @@ fetch_portage_tree() { 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 + git pull --depth=1 origin master + git branch -u origin/master master + rm -rf /usr/portage/profiles/updates fi } main() { - fetch_portage_tree + 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 "" ;; |