From 8fbf0baee6a6b82876d43cef4abc34d021252d25 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 4 Nov 2017 06:12:14 +0000 Subject: add Makefile --- Makefile | 22 ++ src/backend/c_jail.sh | 10 + src/backend/commands_jail.sh | 10 - src/backend/f_generic.sh | 48 +++ src/backend/f_help.sh | 80 +++++ src/backend/f_import.sh | 57 ++++ src/backend/f_makeiso.sh | 156 +++++++++ src/backend/f_makepkg.sh | 68 ++++ src/backend/f_modeswitch.sh | 141 +++++++++ src/backend/functions_generic.sh | 48 --- src/backend/functions_makeiso.sh | 156 --------- src/backend/functions_makepkg.sh | 68 ---- src/backend/functions_modeswitch.sh | 141 --------- src/backend/libvasile | 608 ------------------------------------ src/backend/libvasile.sh | 50 --- src/backend/v_jail.sh | 36 +++ src/backend/variables_jail.sh | 36 --- src/frontend/cli/vasile | 48 --- src/frontend/cli/vasile.sh | 47 +++ 19 files changed, 665 insertions(+), 1165 deletions(-) create mode 100644 Makefile create mode 100644 src/backend/c_jail.sh delete mode 100644 src/backend/commands_jail.sh create mode 100644 src/backend/f_generic.sh create mode 100644 src/backend/f_help.sh create mode 100644 src/backend/f_import.sh create mode 100644 src/backend/f_makeiso.sh create mode 100644 src/backend/f_makepkg.sh create mode 100644 src/backend/f_modeswitch.sh delete mode 100644 src/backend/functions_generic.sh delete mode 100644 src/backend/functions_makeiso.sh delete mode 100644 src/backend/functions_makepkg.sh delete mode 100644 src/backend/functions_modeswitch.sh delete mode 100755 src/backend/libvasile delete mode 100644 src/backend/libvasile.sh create mode 100644 src/backend/v_jail.sh delete mode 100644 src/backend/variables_jail.sh delete mode 100755 src/frontend/cli/vasile create mode 100755 src/frontend/cli/vasile.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2a3461a --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +SUBDIRS = +DESTDIR = +UBINDIR ?= /usr/bin +ULIBDIR ?= /usr/lib/vasile + +all: + for d in $(SUBDIRS); do $(MAKE) -C $$d; done + +clean: + for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done + +install: + for d in $(SUBDIRS); do $(MAKE) -C $$d install; done + + install -d $(DESTDIR)$(UBINDIR) + install -m 0755 src/frontend/cli/vasile.sh $(DESTDIR)$(UBINDIR)/ + install -d $(DESTDIR)$(ULIBDIR) + install -m 0644 src/backend/*sh $(DESTDIR)$(ULIBDIR)/ + +uninstall: + rm -rf $(DESTDIR)$(UBINDIR)/vasile.sh + rm -rf $(DESTDIR)$(ULIBDIR) diff --git a/src/backend/c_jail.sh b/src/backend/c_jail.sh new file mode 100644 index 0000000..fe5e82b --- /dev/null +++ b/src/backend/c_jail.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +export local jailbinmodecmd="vasile --binmode" +export local jailsrcmodecmd="vasile --srcmode" +export local jaildkmscmd="vasile --dkms" +export local jailportagecmd="emerge -kav "$jailtarget"" +export local jaildracutcmd="dracut -N -a dmsquash-live -a pollcdrom --force --kver="$kernver" /boot/"$jailramfsname"" +export local jailmkchainloadercmd="grub2-mkimage -d /usr/lib64/grub/i386-pc -o core.img -O i386-pc biosdisk part_msdos fat -p /boot/grub" +export local jailmkx64eficmd="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 -p /boot/grub" +export local jailmkia32eficmd="grub2-mkimage -d /usr/lib64/grub/i386-efi -o bootia32.efi -O i386-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 -p /boot/grub" diff --git a/src/backend/commands_jail.sh b/src/backend/commands_jail.sh deleted file mode 100644 index fe5e82b..0000000 --- a/src/backend/commands_jail.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -export local jailbinmodecmd="vasile --binmode" -export local jailsrcmodecmd="vasile --srcmode" -export local jaildkmscmd="vasile --dkms" -export local jailportagecmd="emerge -kav "$jailtarget"" -export local jaildracutcmd="dracut -N -a dmsquash-live -a pollcdrom --force --kver="$kernver" /boot/"$jailramfsname"" -export local jailmkchainloadercmd="grub2-mkimage -d /usr/lib64/grub/i386-pc -o core.img -O i386-pc biosdisk part_msdos fat -p /boot/grub" -export local jailmkx64eficmd="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 -p /boot/grub" -export local jailmkia32eficmd="grub2-mkimage -d /usr/lib64/grub/i386-efi -o bootia32.efi -O i386-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 -p /boot/grub" diff --git a/src/backend/f_generic.sh b/src/backend/f_generic.sh new file mode 100644 index 0000000..d692c46 --- /dev/null +++ b/src/backend/f_generic.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +checkifroot () { + if [[ "$(whoami)" != root ]] ; then + eerror "I won't do that, unless you're root!" + exit 1 + fi +} + +checkkerncfg () { + if [[ $(zgrep 'CONFIG_OVERLAY_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then + einfo "Kernel config OK, moving on" + else + eerror "I won't do that with the current kernel" + eerror "I want a kernel with OVERLAYFS && SQUASHFS && LOOP DEVICES enabled" + exit 1 + fi +} + +checkiflive () { + if [[ -L /dev/mapper/live-base ]] ; then + eerror "I won't do that on a live system" + exit 1 + fi +} + +checkjailsum () { + if [[ -f "$jailx64" && -f "$jailx64sum" ]] ; then + if [[ "$(md5sum -c "$jailx64sum")" ]] ; then + einfo "Jail integrity OK, moving on" + else + eerror "I won't do that with a corrupted jail" + exit 1 + fi + else + eerror "I won't do that with a missing jail" + exit 1 + fi +} + +jaildkmsbuild () { + checkifroot + if [[ -x /usr/sbin/dkms ]] ; then + for i in $(dkms status | cut -d " " -f1,2 | sed -e 's/,//g' | sed -e 's/ /\//g' | sed -e 's/://g') ; do + dkms install $i + done + fi +} diff --git a/src/backend/f_help.sh b/src/backend/f_help.sh new file mode 100644 index 0000000..f8cc605 --- /dev/null +++ b/src/backend/f_help.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash + +export local colorstart="\e[1;49;34m" +export local colorstop="\e[0m" + +showhelp () { + +echo -e "\ +"$colorstart"SYNOPSIS"$colorstop" + "$colorstart"vasile --option"$colorstop" ["$colorstart"arguments"$colorstop"] + "$colorstart"vasile --help"$colorstop" + +"$colorstart"DESCRIPTION"$colorstop" + + Vasile is an acronym for ** Versatile Advanced Script for Iso and Latest Enchantments ** + +"$colorstart"OPTIONS"$colorstop" + "$colorstart"--makepkg"$colorstop" ["$colorstart"package(s)"$colorstop"] + This option will allow you to build a package or multiple packages in an overlayfs mounted squashfs chroot jail. + + It must be run in the folder where the squashfs chroot jail resides, or else it will fail to mount the squahfs chroot jail and build the package(s). + + The squashfs chroot jail and the md5sum checksum file are hardcored into "$colorstart"libvasile"$colorstop", but you may want to change them to suit your needs. + + You MUST provide package(s) to build as arguments, or else vasile will only mount the chroot jail + + Examples : + "$colorstart"vasile --makepkg wine"$colorstop" + "$colorstart"vasile --makepkg wine playonlinux q4wine"$colorstop" + + If the package(s) is/are already built, it will not build it/them again (unless newer version(s) is/are available), but install it/them into squahfs chroot jail + + If the package(s) you want to build depends on any already built package(s) it will make use of it/them to satisfy the required dependencies. + + "$colorstart"--makeiso"$colorstop" + This option will allow you to build a live iso image based on the squashfs chroot jail. + + It must be run in the folder where the squashfs chroot jail resides, or else it will fail to rsync the contents of it and build the iso image. + + It is not fully automatic, it will only rsync the contents of the squashfs chroot jail, chroot into it, and let you install packages you want into the iso image. + There are some predefined package sets available in "$colorstart"/etc/portage/sets"$colorstop". Adjust them to suit your needs. + + It will ALLWAYS use package(s) built with "$colorstart"--makepkg"$colorstop" option. When you are happy with package selection, just exit the chroot environment and + the live filesystem will be compressed, live services will be autoenabled, live bootloader autoconfigured and in the end live iso image will be built. You will find + a list of predefined live services list hardcoded into "$colorstart"libvasile"$colorstop". Adjust it to suit your needs. + + "$colorstart"--resetmode"$colorstop" + This option will allow you to reset the system state. It will remove whole portage tree, overlays and portage configuration files and reset the system profile. Usually + you will never want to call this option directly, unless you really really really know what are you doing. It is called automatically when switching to other states. + + !!! WARNING !!! : Never never never leave the system in this state. You will no longer be able to install/remove/upgrade any packages untill you set the system profile, + get the portage tree, overlays and configure portage by hand. Or, you can always activate one of the three other supported system states. + + "$colorstart"--binmode"$colorstop" + This option will allow you to change the system state to binmode. In this state portage will allways use only binary packages from the binhost. It will fetch a minimal + portage tree without any ebuilds in it, but only with portage profiles, metadata and eclass. It will also fetch overlay and portage configuration files, and will adjust + "$colorstart"make.conf"$colorstop" for binary only usage. This system state is for those who just meet with the power of Gentoo. + + !!! WARNING !!! : Never never never modify or create any file in "$colorstart"/etc/portage/"$colorstop" in this state. + + "$colorstart"--mixedmode"$colorstop" + This option will allow you to change the system state to mixedmode. In this state portage will prefer binary packages from the binhost over ebuilds from the portage tree. + It will fetch the full portage tree, the overlay and portage configuration files, and adjust "$colorstart"make.conf"$colorstop" for binary/ebuild usage. Usually you will find this system state + useful if you want to install a package not available in the binhost, you want to upgrade a package to a newer version from portage tree or if you wanna rebuild a package + with your own useflags. + + !!! WARNING !!! : Never never never modify any file in "$colorstart"/etc/portage/"$colorstop" in this state. If you want to adjust useflags or keywords for a package, you can create a new file + e.g.: "$colorstart"100-my.package.use"$colorstop" in "$colorstart"/etc/portage/package.use/"$colorstop" or "$colorstart"100-my.package.keywords"$colorstop" in "$colorstart"/etc/portage/package.keywords/"$colorstop". + + "$colorstart"--srcmode"$colorstop" + This option will allow you to change the system state to srcmode. In more clear terms, it will transform your Kogaion/Argent/Redcore system into pure Gentoo. Binary packages + from the binhost will be ignored, and you will only install packages building from portage tree using emerge. It will fetch the full portage tree, the overlay and portage + configuration files and adjust "$colorstart"make.conf"$colorstop" for ebuild only usage. + + In this system state you can modify whatever you want in "$colorstart"/etc/portage/"$colorstop". You can adjust useflags, keywords, masks, build environment and rebuild the whole system to suit you. + You have the full power of Gentoo available only one command away! + + !!! WARNING !!! : Only use this system state if you have a strong knowledge of Gentoo tools e.g.: "$colorstart"emerge, equery, layman, eix, qlist, useflags, keywords, masks"$colorstop". " +exit 0 +} diff --git a/src/backend/f_import.sh b/src/backend/f_import.sh new file mode 100644 index 0000000..f8dbcf3 --- /dev/null +++ b/src/backend/f_import.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +if [[ -f /lib/gentoo/functions.sh ]] ; then + source /lib/gentoo/functions.sh +else + echo "Cannot import Gentoo functions, I will abort now!" + exit 1 +fi + +if [[ -f /usr/lib/vasile/v_jail.sh ]] ; then + source /usr/lib/vasile/v_jail.sh +else + echo "Cannot import jail variables, I will abort now!" + exit 1 +fi + +if [[ -f /usr/lib/vasile/c_jail.sh ]] ; then + source /usr/lib/vasile/c_jail.sh +else + echo "Cannot import jail commands, I will abort now!" + exit 1 +fi + +if [[ -f /usr/lib/vasile/f_generic.sh ]] ; then + source /usr/lib/vasile/f_generic.sh +else + echo "Cannot import generic functions, I will abort now!" + exit 1 +fi + +if [[ -f /usr/lib/vasile/f_makepkg.sh ]] ; then + source /usr/lib/vasile/f_makepkg.sh +else + echo "Cannot import makepkg functions, I will abort now!" + exit 1 +fi + +if [[ -f /usr/lib/vasile/f_makeiso.sh ]] ; then + source /usr/lib/vasile/f_makeiso.sh +else + echo "Cannot import makeiso functions, I will abort now!" + exit 1 +fi + +if [[ -f /usr/lib/vasile/f_modeswitch.sh ]] ; then + source /usr/lib/vasile/f_modeswitch.sh +else + echo "Cannot import modeswitch functions, I will abort now!" + exit 1 +fi + +if [[ -f /usr/lib/vasile/f_help.sh ]] ; then + source /usr/lib/vasile/f_help.sh +else + echo "Cannot import help functions, I will abort now!" + exit 1 +fi diff --git a/src/backend/f_makeiso.sh b/src/backend/f_makeiso.sh new file mode 100644 index 0000000..be5a550 --- /dev/null +++ b/src/backend/f_makeiso.sh @@ -0,0 +1,156 @@ +#!/usr/bin/env bash + +jailisomnt () { + mount -o bind packages "$jailsynctarget"/var/cache/packages + mount -t proc proc "$jailsynctarget"/proc + mount -t sysfs sysfs "$jailsynctarget"/sys + mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$jailsynctarget"/dev + mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$jailsynctarget"/dev/pts + mount -t tmpfs -o nosuid,nodev none "$jailsynctarget"/dev/shm + mount -t tmpfs -o nosuid,nodev,noexec none "$jailsynctarget"/tmp +} + +jailisodmnt () { + umount -l "$jailsynctarget"/proc > /dev/null 2>&1 + umount -l "$jailsynctarget"/sys > /dev/null 2>&1 + umount -l "$jailsynctarget"/dev/pts > /dev/null 2>&1 + umount -l "$jailsynctarget"/dev/shm > /dev/null 2>&1 + umount -l "$jailsynctarget"/dev > /dev/null 2>&1 + umount -l "$jailsynctarget"/tmp > /dev/null 2>&1 + umount -l "$jailsynctarget"/var/cache/packages > /dev/null 2>&1 +} + +jailisobinmode () { + chroot "$jailsynctarget" su - "$jailuser" -c "$jailbinmodecmd" +} + +jailisomkramfs () { + chroot "$jailsynctarget" su - "$jailuser" -c "$jaildracutcmd" +} + +jailisomkefi () { + chroot "$jailsynctarget" su - "$jailuser" -c "$jailmkx64eficmd" + chroot "$jailsynctarget" su - "$jailuser" -c "$jailmkia32eficmd" +} + +jailisomkchload () { + chroot "$jailsynctarget" su - "$jailuser" -c "$jailmkchainloadercmd" +} + +jailisoenserv () { + chroot "$jailsynctarget" su - "$jailuser" -c "rc-update add redcorelive boot" + for service in acpid dbus NetworkManager avahi-daemon syslog-ng cupsd cronie cgmanager consolekit alsasound bluetooth ntpd openrc-settingsd xdm virtualbox-guest-additions ; do + chroot "$jailsynctarget" su - "$jailuser" -c "rc-update add "$service" default" + done +} + +jailisomkdkms () { + chroot "$jailsynctarget" su - "$jailuser" -c "$jaildkmscmd" +} + +jailisostart () { + einfo "Oh no, I'm in jail!" + chroot "$jailsynctarget" su - "$jailuser" +} + +mkliveimg () { + # create live filesystem image layout + mkdir -p "$jailsynctarget" + truncate -s 10G ""$jailsynctarget".img" + sync + mkfs.ext2 -F ""$jailsynctarget".img" + mkdir -p "$jailsyncsource" + mkdir -p "$jaildvdpath" + mkdir -p "$jailsquashfspath" + mkdir -p "$jailrealfspath" + mkdir -p "$jailbootldrpath" + mkdir -p "$jailefildrpath" + sync + # mount "stage4" image and sync live filesystem image core components + mount -t squashfs "$jailx64" "$jailsyncsource" + mount -t ext4 ""$jailsynctarget".img" "$jailsynctarget" + rsync -aHAXr --progress "$jailsyncsource/" "$jailsynctarget/" + sync + # umount "stage4" image + umount "$jailsyncsource" + # copy live kernel image + cp -avx ""$jailsynctarget"/boot/"$jailkernname"" ""$jailrootpath"/boot/vmlinuz" + # create and copy live initramfs + jailisomnt + jailisomkramfs + jailisodmnt + mv ""$jailsynctarget"/boot/"$jailramfsname"" ""$jailrootpath"/boot/initrd" + sync + # create and copy EFI loader + jailisomnt + jailisomkefi + jailisodmnt + mv ""$jailsynctarget"/root/bootx64.efi" "$jailefildrpath" + mv ""$jailsynctarget"/root/bootia32.efi" "$jailefildrpath" + chmod 755 ""$jailefildrpath"/bootx64.efi" + chmod 755 ""$jailefildrpath"/bootia32.efi" + sync + # create and copy syslinux -> grub chainloader for Unetbootin compatibility + jailisomnt + jailisomkchload + jailisodmnt + mv ""$jailsynctarget"/root/core.img" "$jailbootldrpath" + cp -avx ""$jailsynctarget"/usr/lib64/grub/i386-pc/lnxboot.img" "$jailbootldrpath" + sync + # chroot into live filesystem image + jailisomnt + jailisobinmode + jailisostart + jailisodmnt + sync + # compile and install DKMS modules, if any + jailisomnt + jailisomkdkms + jailisodmnt + sync + # enable live services + jailisomnt + jailisoenserv + jailisodmnt + sync + # unmount live filesystem image + umount -l "$jailsynctarget" > /dev/null 2>&1 + # move live filesystem image where it should be + mv ""$jailsynctarget".img" "$jailrealfspath" + sync + # compress live filesystem image + mksquashfs "$jaildvdpath" ""$jailrootpath"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100% + sync + # move compressed live filesystem image where it should be + mv ""$jailrootpath/"squashfs.img" "$jailsquashfspath" + sync +} + +cfgbootldr () { + # fetch and install GRUB2 config files + git clone https://gitlab.com/"$distname"/boot-core.git "$jailbootldrdlpath" + cp -avx "$jailbootldrcfgpath" "$jailrootpath" + sync +} + +mkclean () { + # clean temporary resources + rm -rf "$jailsyncsource" + rm -rf "$jailsynctarget" + rm -rf "$jaildvdpath" + rm -rf "$jailbootldrdlpath" +} + +mkisoimg () { + # create the actual iso image + grub2-mkrescue -o ""$jailrootpath".iso" "$jailrootpath" +} + +makeiso () { + checkifroot + checkjailsum + mkliveimg + cfgbootldr + mkclean + mkisoimg +} diff --git a/src/backend/f_makepkg.sh b/src/backend/f_makepkg.sh new file mode 100644 index 0000000..1c16d45 --- /dev/null +++ b/src/backend/f_makepkg.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +jailpkgprep () { + while : true ; do + if [[ ! -d "$ropath" || ! -d "$rwpath" || ! -d "$workpath" || ! -d "$overlaypath" ]] ; then + export local i + for i in "$ropath" "$rwpath" "$workpath" "$overlaypath" ; do + mkdir "$i" + done + jailpkgmnt + break + elif [[ -d "$ropath" || -d "$rwpath" || -d "$workpath" || -d "$overlaypath" ]] ; then + jailpkgdmnt + export local j + for j in "$ropath" "$rwpath" "$workpath" "$overlaypath" ; do + rm -rf "$j" + done + continue + fi + done +} + +jailpkgmnt () { + mount -t squashfs "$jailx64" "$ropath" + mount -t overlay -o lowerdir="$ropath",upperdir="$rwpath",workdir="$workpath" overlay "$overlaypath" + mount -o bind packages "$overlaypath"/var/cache/packages + mount -o bind distfiles "$overlaypath"/var/cache/distfiles + mount -t proc proc "$overlaypath"/proc + mount -t sysfs sysfs "$overlaypath"/sys + mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$overlaypath"/dev + mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$overlaypath"/dev/pts + mount -t tmpfs -o nosuid,nodev none "$overlaypath"/dev/shm +} + +jailpkgdmnt () { + umount -l "$overlaypath"/proc > /dev/null 2>&1 + umount -l "$overlaypath"/sys > /dev/null 2>&1 + umount -l "$overlaypath"/dev/pts > /dev/null 2>&1 + umount -l "$overlaypath"/dev/shm > /dev/null 2>&1 + umount -l "$overlaypath"/dev > /dev/null 2>&1 + umount -l "$overlaypath"/var/cache/packages > /dev/null 2>&1 + umount -l "$overlaypath"/var/cache/distfiles > /dev/null 2>&1 + umount -l "$overlaypath" > /dev/null 2>&1 + umount -l "$ropath" > /dev/null 2>&1 +} + +jailpkgsrcmode () { + chroot "$overlaypath" su - "$jailuser" -c "$jailsrcmodecmd" +} + +jailpkgbuild () { + chroot "$overlaypath" su - "$jailuser" -c "$jailportagecmd" +} + +jailpkgstart () { + einfo "Oh no, I'm in jail!" + chroot "$overlaypath" su - "$jailuser" +} + +makepkg () { + checkifroot + checkjailsum + jailpkgprep + jailpkgsrcmode + jailpkgbuild + jailpkgstart + jailpkgdmnt +} diff --git a/src/backend/f_modeswitch.sh b/src/backend/f_modeswitch.sh new file mode 100644 index 0000000..0f66964 --- /dev/null +++ b/src/backend/f_modeswitch.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +rmmainporttree () { + einfo "I am removing Gentoo ebuild tree" + if [ -d ""$jailmainportpath"/.git" ] ; then + find "$jailmainportpath" -mindepth 1 -exec rm -rf {} \; > /dev/null 2>&1 + fi +} + +rmaddonporttree () { + einfo "I am removing Redcore ebuild tree" + if [ -d ""$jailaddonportpath"/.git" ] ; then + find "$jailaddonportpath" -mindepth 1 -exec rm -rf {} \; > /dev/null 2>&1 + fi +} + +rmportcfgtree () { + einfo "I am removing ebuild tree configuration" + rm ""$jailportcfgtarget"/make.conf" > /dev/null 2>&1 + rm ""$jailportcfgtarget"/make.profile" > /dev/null 2>&1 + rm "$jailportcfgtarget" > /dev/null 2>&1 + rm -rf "$jailportvcspath" > /dev/null 2>&1 +} + +resetmode () { + checkifroot + rmmainporttree + rmaddonporttree + rmportcfgtree +} + +dlmainportfulltree () { + if [ ! -d ""$jailmainportpath"/.git" ] ; then + einfo "I am injecting Gentoo ebuild tree" + cd "$jailmainportpath" && git init > /dev/null 2>&1 + git remote add origin https://gitlab.com/redcore/portage.git + git pull --depth=1 origin master + git branch -u origin/master master + rm -rf ""$jailmainportpath"/profiles/updates" + fi +} + +dlmainportmintree () { + if [ ! -d ""$jailmainportpath"/.git" ] ; then + einfo "I am injecting Gentoo ebuild tree" + cd "$jailmainportpath" && git init > /dev/null 2>&1 + git remote add origin https://gitlab.com/redcore/portage.git + git config core.sparsecheckout true + echo "profiles/*" >> .git/info/sparse-checkout + echo "metadata/*" >> .git/info/sparse-checkout + echo "eclass/*" >> .git/info/sparse-checkout + git pull --depth=1 origin master + git branch -u origin/master master + rm -rf ""$gentooportdir"/profiles/updates" + fi +} + +dladdonportfulltree () { + if [ ! -d ""$jailaddonportpath"/.git" ] ; then + einfo "I am injecting Redcore ebuild tree" + cd "$jailaddonportpath" && git init > /dev/null 2>&1 + git remote add origin https://gitlab.com/redcore/redcore-desktop.git + git pull --depth=1 origin master + git branch -u origin/master master + fi +} + +dladdonportmintree () { + if [ ! -d ""$jailaddonportpath"/.git" ] ; then + einfo "I am injecting Redcore ebuild tree" + cd "$jailaddonportpath" && git init > /dev/null 2>&1 + git remote add origin https://gitlab.com/redcore/redcore-desktop.git + git config core.sparsecheckout true + echo "profiles/*" >> .git/info/sparse-checkout + echo "metadata/*" >> .git/info/sparse-checkout + echo "eclass/*" >> .git/info/sparse-checkout + git pull --depth=1 origin master + git branch -u origin/master master + fi +} + +dlportcfgtree () { + pushd /opt > /dev/null 2>&1 + einfo "I am injecting ebuild tree configuration" + git clone https://gitlab.com/redcore/redcore-build.git + popd > /dev/null 2>&1 +} + +injectportmintree () { + dlmainportmintree + dladdonportmintree + dlportcfgtree +} + +injectportfulltree () { + dlmainportfulltree + dladdonportfulltree + dlportcfgtree +} + +setbinmodecfg () { + ln -sf "$jailportcfgsource" "$jailportcfgtarget" + ln -sf "$jailportcfgtarget"/make.conf.amd64-binmode "$jailportcfgtarget"/make.conf + eselect profile set 1 + env-update + . /etc/profile +} + +binmode () { + resetmode + injectportmintree + setbinmodecfg +} + +setmixedmodecfg () { + ln -sf "$jailportcfgsource" "$jailportcfgtarget" + ln -sf "$jailportcfgtarget"/make.conf.amd64-mixedmode "$jailportcfgtarget"/make.conf + eselect profile set 1 + env-update + . /etc/profile +} + +mixedmode () { + resetmode + injectportfulltree + setmixedmodecfg +} + +setsrcmodecfg () { + ln -sf "$jailportcfgsource" "$jailportcfgtarget" + ln -sf "$jailportcfgtarget"/make.conf.amd64-srcmode "$jailportcfgtarget"/make.conf + eselect profile set 1 + env-update + . /etc/profile +} + +srcmode() { + resetmode + injectportfulltree + setsrcmodecfg +} diff --git a/src/backend/functions_generic.sh b/src/backend/functions_generic.sh deleted file mode 100644 index d692c46..0000000 --- a/src/backend/functions_generic.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -checkifroot () { - if [[ "$(whoami)" != root ]] ; then - eerror "I won't do that, unless you're root!" - exit 1 - fi -} - -checkkerncfg () { - if [[ $(zgrep 'CONFIG_OVERLAY_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then - einfo "Kernel config OK, moving on" - else - eerror "I won't do that with the current kernel" - eerror "I want a kernel with OVERLAYFS && SQUASHFS && LOOP DEVICES enabled" - exit 1 - fi -} - -checkiflive () { - if [[ -L /dev/mapper/live-base ]] ; then - eerror "I won't do that on a live system" - exit 1 - fi -} - -checkjailsum () { - if [[ -f "$jailx64" && -f "$jailx64sum" ]] ; then - if [[ "$(md5sum -c "$jailx64sum")" ]] ; then - einfo "Jail integrity OK, moving on" - else - eerror "I won't do that with a corrupted jail" - exit 1 - fi - else - eerror "I won't do that with a missing jail" - exit 1 - fi -} - -jaildkmsbuild () { - checkifroot - if [[ -x /usr/sbin/dkms ]] ; then - for i in $(dkms status | cut -d " " -f1,2 | sed -e 's/,//g' | sed -e 's/ /\//g' | sed -e 's/://g') ; do - dkms install $i - done - fi -} diff --git a/src/backend/functions_makeiso.sh b/src/backend/functions_makeiso.sh deleted file mode 100644 index be5a550..0000000 --- a/src/backend/functions_makeiso.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env bash - -jailisomnt () { - mount -o bind packages "$jailsynctarget"/var/cache/packages - mount -t proc proc "$jailsynctarget"/proc - mount -t sysfs sysfs "$jailsynctarget"/sys - mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$jailsynctarget"/dev - mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$jailsynctarget"/dev/pts - mount -t tmpfs -o nosuid,nodev none "$jailsynctarget"/dev/shm - mount -t tmpfs -o nosuid,nodev,noexec none "$jailsynctarget"/tmp -} - -jailisodmnt () { - umount -l "$jailsynctarget"/proc > /dev/null 2>&1 - umount -l "$jailsynctarget"/sys > /dev/null 2>&1 - umount -l "$jailsynctarget"/dev/pts > /dev/null 2>&1 - umount -l "$jailsynctarget"/dev/shm > /dev/null 2>&1 - umount -l "$jailsynctarget"/dev > /dev/null 2>&1 - umount -l "$jailsynctarget"/tmp > /dev/null 2>&1 - umount -l "$jailsynctarget"/var/cache/packages > /dev/null 2>&1 -} - -jailisobinmode () { - chroot "$jailsynctarget" su - "$jailuser" -c "$jailbinmodecmd" -} - -jailisomkramfs () { - chroot "$jailsynctarget" su - "$jailuser" -c "$jaildracutcmd" -} - -jailisomkefi () { - chroot "$jailsynctarget" su - "$jailuser" -c "$jailmkx64eficmd" - chroot "$jailsynctarget" su - "$jailuser" -c "$jailmkia32eficmd" -} - -jailisomkchload () { - chroot "$jailsynctarget" su - "$jailuser" -c "$jailmkchainloadercmd" -} - -jailisoenserv () { - chroot "$jailsynctarget" su - "$jailuser" -c "rc-update add redcorelive boot" - for service in acpid dbus NetworkManager avahi-daemon syslog-ng cupsd cronie cgmanager consolekit alsasound bluetooth ntpd openrc-settingsd xdm virtualbox-guest-additions ; do - chroot "$jailsynctarget" su - "$jailuser" -c "rc-update add "$service" default" - done -} - -jailisomkdkms () { - chroot "$jailsynctarget" su - "$jailuser" -c "$jaildkmscmd" -} - -jailisostart () { - einfo "Oh no, I'm in jail!" - chroot "$jailsynctarget" su - "$jailuser" -} - -mkliveimg () { - # create live filesystem image layout - mkdir -p "$jailsynctarget" - truncate -s 10G ""$jailsynctarget".img" - sync - mkfs.ext2 -F ""$jailsynctarget".img" - mkdir -p "$jailsyncsource" - mkdir -p "$jaildvdpath" - mkdir -p "$jailsquashfspath" - mkdir -p "$jailrealfspath" - mkdir -p "$jailbootldrpath" - mkdir -p "$jailefildrpath" - sync - # mount "stage4" image and sync live filesystem image core components - mount -t squashfs "$jailx64" "$jailsyncsource" - mount -t ext4 ""$jailsynctarget".img" "$jailsynctarget" - rsync -aHAXr --progress "$jailsyncsource/" "$jailsynctarget/" - sync - # umount "stage4" image - umount "$jailsyncsource" - # copy live kernel image - cp -avx ""$jailsynctarget"/boot/"$jailkernname"" ""$jailrootpath"/boot/vmlinuz" - # create and copy live initramfs - jailisomnt - jailisomkramfs - jailisodmnt - mv ""$jailsynctarget"/boot/"$jailramfsname"" ""$jailrootpath"/boot/initrd" - sync - # create and copy EFI loader - jailisomnt - jailisomkefi - jailisodmnt - mv ""$jailsynctarget"/root/bootx64.efi" "$jailefildrpath" - mv ""$jailsynctarget"/root/bootia32.efi" "$jailefildrpath" - chmod 755 ""$jailefildrpath"/bootx64.efi" - chmod 755 ""$jailefildrpath"/bootia32.efi" - sync - # create and copy syslinux -> grub chainloader for Unetbootin compatibility - jailisomnt - jailisomkchload - jailisodmnt - mv ""$jailsynctarget"/root/core.img" "$jailbootldrpath" - cp -avx ""$jailsynctarget"/usr/lib64/grub/i386-pc/lnxboot.img" "$jailbootldrpath" - sync - # chroot into live filesystem image - jailisomnt - jailisobinmode - jailisostart - jailisodmnt - sync - # compile and install DKMS modules, if any - jailisomnt - jailisomkdkms - jailisodmnt - sync - # enable live services - jailisomnt - jailisoenserv - jailisodmnt - sync - # unmount live filesystem image - umount -l "$jailsynctarget" > /dev/null 2>&1 - # move live filesystem image where it should be - mv ""$jailsynctarget".img" "$jailrealfspath" - sync - # compress live filesystem image - mksquashfs "$jaildvdpath" ""$jailrootpath"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100% - sync - # move compressed live filesystem image where it should be - mv ""$jailrootpath/"squashfs.img" "$jailsquashfspath" - sync -} - -cfgbootldr () { - # fetch and install GRUB2 config files - git clone https://gitlab.com/"$distname"/boot-core.git "$jailbootldrdlpath" - cp -avx "$jailbootldrcfgpath" "$jailrootpath" - sync -} - -mkclean () { - # clean temporary resources - rm -rf "$jailsyncsource" - rm -rf "$jailsynctarget" - rm -rf "$jaildvdpath" - rm -rf "$jailbootldrdlpath" -} - -mkisoimg () { - # create the actual iso image - grub2-mkrescue -o ""$jailrootpath".iso" "$jailrootpath" -} - -makeiso () { - checkifroot - checkjailsum - mkliveimg - cfgbootldr - mkclean - mkisoimg -} diff --git a/src/backend/functions_makepkg.sh b/src/backend/functions_makepkg.sh deleted file mode 100644 index 1c16d45..0000000 --- a/src/backend/functions_makepkg.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash - -jailpkgprep () { - while : true ; do - if [[ ! -d "$ropath" || ! -d "$rwpath" || ! -d "$workpath" || ! -d "$overlaypath" ]] ; then - export local i - for i in "$ropath" "$rwpath" "$workpath" "$overlaypath" ; do - mkdir "$i" - done - jailpkgmnt - break - elif [[ -d "$ropath" || -d "$rwpath" || -d "$workpath" || -d "$overlaypath" ]] ; then - jailpkgdmnt - export local j - for j in "$ropath" "$rwpath" "$workpath" "$overlaypath" ; do - rm -rf "$j" - done - continue - fi - done -} - -jailpkgmnt () { - mount -t squashfs "$jailx64" "$ropath" - mount -t overlay -o lowerdir="$ropath",upperdir="$rwpath",workdir="$workpath" overlay "$overlaypath" - mount -o bind packages "$overlaypath"/var/cache/packages - mount -o bind distfiles "$overlaypath"/var/cache/distfiles - mount -t proc proc "$overlaypath"/proc - mount -t sysfs sysfs "$overlaypath"/sys - mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$overlaypath"/dev - mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$overlaypath"/dev/pts - mount -t tmpfs -o nosuid,nodev none "$overlaypath"/dev/shm -} - -jailpkgdmnt () { - umount -l "$overlaypath"/proc > /dev/null 2>&1 - umount -l "$overlaypath"/sys > /dev/null 2>&1 - umount -l "$overlaypath"/dev/pts > /dev/null 2>&1 - umount -l "$overlaypath"/dev/shm > /dev/null 2>&1 - umount -l "$overlaypath"/dev > /dev/null 2>&1 - umount -l "$overlaypath"/var/cache/packages > /dev/null 2>&1 - umount -l "$overlaypath"/var/cache/distfiles > /dev/null 2>&1 - umount -l "$overlaypath" > /dev/null 2>&1 - umount -l "$ropath" > /dev/null 2>&1 -} - -jailpkgsrcmode () { - chroot "$overlaypath" su - "$jailuser" -c "$jailsrcmodecmd" -} - -jailpkgbuild () { - chroot "$overlaypath" su - "$jailuser" -c "$jailportagecmd" -} - -jailpkgstart () { - einfo "Oh no, I'm in jail!" - chroot "$overlaypath" su - "$jailuser" -} - -makepkg () { - checkifroot - checkjailsum - jailpkgprep - jailpkgsrcmode - jailpkgbuild - jailpkgstart - jailpkgdmnt -} diff --git a/src/backend/functions_modeswitch.sh b/src/backend/functions_modeswitch.sh deleted file mode 100644 index 0f66964..0000000 --- a/src/backend/functions_modeswitch.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env bash - -rmmainporttree () { - einfo "I am removing Gentoo ebuild tree" - if [ -d ""$jailmainportpath"/.git" ] ; then - find "$jailmainportpath" -mindepth 1 -exec rm -rf {} \; > /dev/null 2>&1 - fi -} - -rmaddonporttree () { - einfo "I am removing Redcore ebuild tree" - if [ -d ""$jailaddonportpath"/.git" ] ; then - find "$jailaddonportpath" -mindepth 1 -exec rm -rf {} \; > /dev/null 2>&1 - fi -} - -rmportcfgtree () { - einfo "I am removing ebuild tree configuration" - rm ""$jailportcfgtarget"/make.conf" > /dev/null 2>&1 - rm ""$jailportcfgtarget"/make.profile" > /dev/null 2>&1 - rm "$jailportcfgtarget" > /dev/null 2>&1 - rm -rf "$jailportvcspath" > /dev/null 2>&1 -} - -resetmode () { - checkifroot - rmmainporttree - rmaddonporttree - rmportcfgtree -} - -dlmainportfulltree () { - if [ ! -d ""$jailmainportpath"/.git" ] ; then - einfo "I am injecting Gentoo ebuild tree" - cd "$jailmainportpath" && git init > /dev/null 2>&1 - git remote add origin https://gitlab.com/redcore/portage.git - git pull --depth=1 origin master - git branch -u origin/master master - rm -rf ""$jailmainportpath"/profiles/updates" - fi -} - -dlmainportmintree () { - if [ ! -d ""$jailmainportpath"/.git" ] ; then - einfo "I am injecting Gentoo ebuild tree" - cd "$jailmainportpath" && git init > /dev/null 2>&1 - git remote add origin https://gitlab.com/redcore/portage.git - git config core.sparsecheckout true - echo "profiles/*" >> .git/info/sparse-checkout - echo "metadata/*" >> .git/info/sparse-checkout - echo "eclass/*" >> .git/info/sparse-checkout - git pull --depth=1 origin master - git branch -u origin/master master - rm -rf ""$gentooportdir"/profiles/updates" - fi -} - -dladdonportfulltree () { - if [ ! -d ""$jailaddonportpath"/.git" ] ; then - einfo "I am injecting Redcore ebuild tree" - cd "$jailaddonportpath" && git init > /dev/null 2>&1 - git remote add origin https://gitlab.com/redcore/redcore-desktop.git - git pull --depth=1 origin master - git branch -u origin/master master - fi -} - -dladdonportmintree () { - if [ ! -d ""$jailaddonportpath"/.git" ] ; then - einfo "I am injecting Redcore ebuild tree" - cd "$jailaddonportpath" && git init > /dev/null 2>&1 - git remote add origin https://gitlab.com/redcore/redcore-desktop.git - git config core.sparsecheckout true - echo "profiles/*" >> .git/info/sparse-checkout - echo "metadata/*" >> .git/info/sparse-checkout - echo "eclass/*" >> .git/info/sparse-checkout - git pull --depth=1 origin master - git branch -u origin/master master - fi -} - -dlportcfgtree () { - pushd /opt > /dev/null 2>&1 - einfo "I am injecting ebuild tree configuration" - git clone https://gitlab.com/redcore/redcore-build.git - popd > /dev/null 2>&1 -} - -injectportmintree () { - dlmainportmintree - dladdonportmintree - dlportcfgtree -} - -injectportfulltree () { - dlmainportfulltree - dladdonportfulltree - dlportcfgtree -} - -setbinmodecfg () { - ln -sf "$jailportcfgsource" "$jailportcfgtarget" - ln -sf "$jailportcfgtarget"/make.conf.amd64-binmode "$jailportcfgtarget"/make.conf - eselect profile set 1 - env-update - . /etc/profile -} - -binmode () { - resetmode - injectportmintree - setbinmodecfg -} - -setmixedmodecfg () { - ln -sf "$jailportcfgsource" "$jailportcfgtarget" - ln -sf "$jailportcfgtarget"/make.conf.amd64-mixedmode "$jailportcfgtarget"/make.conf - eselect profile set 1 - env-update - . /etc/profile -} - -mixedmode () { - resetmode - injectportfulltree - setmixedmodecfg -} - -setsrcmodecfg () { - ln -sf "$jailportcfgsource" "$jailportcfgtarget" - ln -sf "$jailportcfgtarget"/make.conf.amd64-srcmode "$jailportcfgtarget"/make.conf - eselect profile set 1 - env-update - . /etc/profile -} - -srcmode() { - resetmode - injectportfulltree - setsrcmodecfg -} diff --git a/src/backend/libvasile b/src/backend/libvasile deleted file mode 100755 index e1678ad..0000000 --- a/src/backend/libvasile +++ /dev/null @@ -1,608 +0,0 @@ -#!/usr/bin/env bash - -# import gentoo functions - -source /lib/gentoo/functions.sh - -# generic variables - -export local releasename="redcore" -export local releasetarget="desktop" -export local releaseversion="1" - -# kernel version && name from inside core squashfs (we need to know this, to generate a matching kernel/live initramfs) - -export local kernelver="4.9.53-"$releasename"-lts" - -# core squahfs name and md5 checksum file - -export local chrootx64=""$releasename"_"$releaseversion"_core_x64.squashfs" -export local chrootx64md5=""$chrootx64".md5" - -# overlay mount 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" - -# build variables and commands to run inside core squashfs when building packages - -export local chrootuser="root" -export local chroottarget="${@:2}" -export local chrootbuildtarget="emerge -kav "$chroottarget"" -export local chrootsrcmode="vasile --srcmode" - -# iso variables and commands to run inside core squahfs when making iso image - -export local isouser="root" -export local isomainarch="x86_64" -export local isobinmode="vasile --binmode" -export local isodkms="vasile --dkms" -export local isokernelname="kernel-genkernel-"$isomainarch"-"$kernelver"" -export local isoramfsname="initramfs-genkernel-"$isomainarch"-"$kernelver"" -export local isoramfscmd="dracut -N -a dmsquash-live -a pollcdrom --force --kver="$kernelver" /boot/"$isoramfsname"" -export local isochainloadcmd="grub2-mkimage -d /usr/lib64/grub/i386-pc -o core.img -O i386-pc biosdisk part_msdos fat -p /boot/grub" -export local isoefix64cmd="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 -p /boot/grub" -export local isoefiia32cmd="grub2-mkimage -d /usr/lib64/grub/i386-efi -o bootia32.efi -O i386-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 -p /boot/grub" - -# iso image layout variables - -export local bootloaderfetchpath="/tmp/bootcore" -export local bootloaderconfigs=""$bootloaderfetchpath"/cdroot/boot" -export local isorootdir=""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch"" -export local isogrubdir=""$isorootdir"/boot/grub" -export local isoefidir=""$isorootdir"/efi/boot" -export local isorsynctarget=""$isorootdir"/rootfs" -export local isorsyncsource="/tmp/"$isorootdir"" -export local isocdrootdir=""$isorootdir"/CDroot" -export local isorealfsdir=""$isocdrootdir"/LiveOS" -export local isosquashfsdir=""$isorootdir"/LiveOS" - -# modechange variables - -export local gentooportdir="/usr/ports/gentoo" -export local redcoreportdir="/usr/ports/redcore" -export local portconfdir="/etc/portage" -export local portgitdir="/opt/redcore-build/conf/intel/portage" -export local portclonedir="/opt/redcore-build" - -# generic functions (used for both build && iso creation) - -kernelconfig () { - # check if the host kernel has needed modules for vasile to work properly...fail to start if it doesn't - if [[ $(zgrep 'CONFIG_OVERLAY_FS=' /proc/config.gz) && $(zgrep "CONFIG_SQUASHFS=" /proc/config.gz) && $(zgrep "CONFIG_BLK_DEV_LOOP=" /proc/config.gz) ]] ; then - einfo "Kernel configuration seems OK, moving on" - sleep 1 - else - eerror "Vasile needs OVERLAYFS && SQUASHFS && LOOP DEVICES to work" - eerror "Please rebuild the kernel with those activated to use it" - exit 1 - fi -} - -checkroot () { - # check for root privileges, needed for mount && chroot...fail to start if not root - if [[ "$(whoami)" != root ]] ; then - eerror "You're not root?...No cookies for you, go away !!!" - exit 1 - fi -} - -checkiflive () { - # check if running in live mode...fail to start if so - if [[ -L /dev/mapper/live-base ]] ; then - eerror "Running in Live mode is unsupported" - exit 1 - fi -} - -chrootchecksum () { - # check if core squashfs and md5 checksum file exists, verify core squashfs integrity against md5 checksum file - # fail to start if core squashfs or md5 checksum file doesn't exist, or if core squashfs fails md5 verification - while : true ; do - if [[ -f "$chrootx64" && -f "$chrootx64md5" ]] ; then - einfo "Squashed chroot && Checksum file found" - if [[ "$(md5sum -c "$chrootx64md5")" ]] ; then - einfo "Squashed chroot checksum passed" - sleep 1 - break - else - eerror "Squashed chroot checksum failed" - exit 1 - fi - else - eerror "Squashed chroot || Checksum file not found" - exit 1 - fi - done -} - -dkmsmod () { - checkroot - # build and install any 3rd party kernel modules using DKMS - if [[ -x $(which dkms) ]] ; then - for i in $(dkms status | cut -d " " -f1,2 | sed -e 's/,//g' | sed -e 's/ /\//g' | sed -e 's/://g') ; do - dkms install $i - done - fi -} - -# build functions - -chrootprepare () { - # always start from fresh overlay mount path, if previous exists, remove it and start over - 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 - -} - -chrootstop () { - # umount core squashfs overlay mount - 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"/var/cache/packages > /dev/null 2>&1 - umount -l "$overlaydir"/var/cache/distfiles > /dev/null 2>&1 - umount -l "$overlaydir" > /dev/null 2>&1 - umount -l "$rodir" > /dev/null 2>&1 -} - -chrootstart () { - # mount core squashfs in overlay - mount -t squashfs "$chrootx64" "$rodir" - mount -t overlay -o lowerdir="$rodir",upperdir="$rwdir",workdir="$workdir" overlay "$overlaydir" - mount -o bind packages "$overlaydir"/var/cache/packages - mount -o bind distfiles "$overlaydir"/var/cache/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 () { - # inject portage tree, redcore overlay && redcore buildsystem (portage config) - chroot "$overlaydir" su - "$chrootuser" -c "$chrootsrcmode" -} - -chrootbuild () { - # build and install package(s) given as argument...if is already built, install it - einfo "All systems are go!" - sleep 1 - chroot "$overlaydir" su - "$chrootuser" -c "$chrootbuildtarget" -} - -chrootx64 () { - # land into a chroot env into overlay mounted core squashfs and make build adjustments, if needed - 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" -} - -makepkg () { - checkroot - chrootchecksum - chrootprepare - chrootdevtree - chrootbuild - chrootx64 - chrootstop -} - -# iso functions - -isostart () { - # mount iso image core - mount -o bind packages "$isorsynctarget"/var/cache/packages - mount -t proc proc "$isorsynctarget"/proc - mount -t sysfs sysfs "$isorsynctarget"/sys - mount -t devtmpfs -o relatime,size=3055348k,nr_inodes=763837,mode=755 none "$isorsynctarget"/dev - mount -t devpts -o nosuid,noexec,relatime,gid=5,mode=620 none "$isorsynctarget"/dev/pts - mount -t tmpfs -o nosuid,nodev none "$isorsynctarget"/dev/shm - mount -t tmpfs -o nosuid,nodev,noexec none "$isorsynctarget"/tmp -} - -isostop () { - # umount iso image core - umount -l "$isorsynctarget"/proc > /dev/null 2>&1 - umount -l "$isorsynctarget"/sys > /dev/null 2>&1 - umount -l "$isorsynctarget"/dev/pts > /dev/null 2>&1 - umount -l "$isorsynctarget"/dev/shm > /dev/null 2>&1 - umount -l "$isorsynctarget"/dev > /dev/null 2>&1 - umount -l "$isorsynctarget"/tmp > /dev/null 2>&1 - umount -l "$isorsynctarget"/var/cache/packages > /dev/null 2>&1 -} - -isousertree () { - # inject portage tree, redcore overlay && redcore buildsystem (portage config) - chroot "$isorsynctarget" su - "$isouser" -c "$isobinmode" -} - -isoramfs () { - # generate iso initramfs with required modules for live boot - chroot "$isorsynctarget" su - "$isouser" -c "$isoramfscmd" -} - -isoefiimg () { - # generate efi bootloader - chroot "$isorsynctarget" su - "$isouser" -c "$isoefix64cmd" - chroot "$isorsynctarget" su - "$isouser" -c "$isoefiia32cmd" -} - -isochainloader () { - # generate syslinux -> grub chainloader for unetbootin compatibility - chroot "$isorsynctarget" su - "$isouser" -c "$isochainloadcmd" -} - -isoservices () { - # enable live user setup service (runlevel : boot) - chroot "$isorsynctarget" su - "$isouser" -c "rc-update add redcorelive boot" - - # enable live iso system services (runlevel : default) - for service in acpid dbus NetworkManager avahi-daemon syslog-ng cupsd cronie cgmanager consolekit alsasound bluetooth ntpd openrc-settingsd xdm virtualbox-guest-additions ; do - chroot "$isorsynctarget" su - "$isouser" -c "rc-update add "$service" default" - done -} - -isomodules () { - # build and install any 3rd party kernel modules using DKMS (virtualbox-guest in our case) - chroot "$isorsynctarget" su - "$isouser" -c "$isodkms" -} - -isochroot () { - # land into a chroot env into iso image core and make adjustments, if needed - 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 "$isorsynctarget" su - "$isouser" -} - -prepareiso () { - # prepare iso image layout - mkdir -p "$isorsynctarget" - dd if=/dev/zero of=""$isorsynctarget".img" bs=1M count=10240 && sync - mkfs.ext2 -F ""$isorsynctarget".img" - mkdir -p "$isorsyncsource" - mkdir -p "$isocdrootdir" - mkdir -p "$isosquashfsdir" - mkdir -p "$isorealfsdir" - mkdir -p "$isogrubdir" - mkdir -p "$isoefidir" - # mount core squashfs and rsync it's contents into core iso image - mount -t squashfs "$chrootx64" "$isorsyncsource" - mount -t ext4 ""$isorsynctarget".img" "$isorsynctarget" - rsync -aHAXr --progress "$isorsyncsource/" "$isorsynctarget/" - # copy the kernel for live boot - cp -avx ""$isorsynctarget"/boot/"$isokernelname"" ""$isorootdir"/boot/vmlinuz" - # generate and copy initramfs for live boot - isostart - isoramfs - isostop - mv ""$isorsynctarget"/boot/"$isoramfsname"" ""$isorootdir"/boot/initrd" - # generate and copy efi bootloader for live boot - isostart - isoefiimg - isostop - mv ""$isorsynctarget"/root/bootx64.efi" "$isoefidir" - chmod 755 ""$isoefidir"/bootx64.efi" - mv ""$isorsynctarget"/root/bootia32.efi" "$isoefidir" - chmod 755 ""$isoefidir"/bootia32.efi" - # generate and copy syslinux -> grub chainloader for unetbootin compatibility - isostart - isochainloader - isostop - mv ""$isorsynctarget"/root/core.img" "$isogrubdir" - cp -avx ""$isorsynctarget"/usr/lib64/grub/i386-pc/lnxboot.img" "$isogrubdir" - # land into a chroot env into live environment to make adjustments, if needed - isostart - isousertree - isochroot - isostop - # build and install any 3rd party kernel modules using DKMS (virtualbox-guest in our case) - isostart - isomodules - isostop - # enable live iso image system services - isostart - isoservices - isostop - # umount "real" live filesystem - umount -l "$isorsynctarget" > /dev/null 2>&1 - # fix any possible "real" live filesystem corruptions - # e2fsck -fy ""$isorsynctarget".img" - # move "real" live filesystem into right place - mv ""$isorsynctarget".img" "$isorealfsdir" - # compress "fake" live filesystem - mksquashfs "$isocdrootdir" ""$isorootdir"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100% - mv ""$isorootdir/"squashfs.img" "$isosquashfsdir" - # dracut requires "real" live filesystem to be placed - # into a "fake" squashfs live filesystem as bellow : - # /cdroot/LiveOS/squashfs.img/LiveOS/rootfs.img - # squashfs.img is the "fake" squashfs live filesystem - # rootfs.img is the "real" live filesystem -} - -bootloaderiso () { - # get grub2 live boot configs and place them into right place - git clone https://gitlab.com/"$releasename"/boot-core.git "$bootloaderfetchpath" - cp -avx "$bootloaderconfigs" "$isorootdir" -} - -cleanupiso () { - # cleanup temporary files used during iso image layout preparation - umount "$isorsyncsource" - rm -rf "$isorsynctarget" - rm -rf "$isorsyncsource" - rm -rf "$isocdrootdir" - rm -rf "$bootloaderfetchpath" -} - -makeisoimg () { - # create iso image - grub2-mkrescue -o ""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch".iso" "$isorootdir" -} - -makeiso () { - checkroot - chrootchecksum - prepareiso - bootloaderiso - cleanupiso - makeisoimg -} - -# modechange functions - -removeportagetree() { - # remove portage tree, but leave packages and distfiles directories intact - einfo "Removing gentoo portage tree" - if [ -d ""$gentooportdir"/.git" ] ; then - find "$gentooportdir" -mindepth 1 -exec rm -rf {} \; > /dev/null 2>&1 - fi -} - -removeoverlays() { - # remove redcore overlay - einfo "Removing "$releasename"-"$releasetarget" overlay" - if [ -d ""$redcoreportdir"/.git" ] ; then - find "$redcoreportdir" -mindepth 1 -exec rm -rf {} \; > /dev/null 2>&1 - fi -} - -removeportageconfig() { - # remove redcore buildsystem (portage configuration) - einfo "Removing "$releasename"-"$releasetarget" buildsystem" - rm ""$portconfdir"/make.conf" > /dev/null 2>&1 - rm ""$portconfdir"/make.profile" > /dev/null 2>&1 - rm "$portconfdir" > /dev/null 2>&1 - rm -rf "$portclonedir" > /dev/null 2>&1 -} - -resetmode () { - checkroot - removeportagetree - removeoverlays - removeportageconfig -} - -fetchportageconfig() { - # fetch redcore buildsystem (portage configuration) - pushd /opt > /dev/null 2>&1 - einfo "Injecting "$releasename"-"$releasetarget" buildsystem" - git clone https://gitlab.com/redcore/redcore-build.git - popd > /dev/null 2>&1 -} - -fetchfullportagetree() { - # fetch full portage tree - if [ ! -d ""$gentooportdir"/.git" ] ; then - einfo "Injecting mixedmode/srcmode (full) gentoo portage tree" - cd "$gentooportdir" && git init > /dev/null 2>&1 - git remote add origin https://gitlab.com/redcore/portage.git - git pull --depth=1 origin master - git branch -u origin/master master - rm -rf ""$gentooportdir"/profiles/updates" - fi -} - -fetchminimalportagetree() { - # fetch minimal portage tree - # in binmode we don't want the whole tree of gentoo ebuilds - # but we need portage profiles portage metadata && portage eclasses - # so make a sparse-checkout, to fetch only what we need - if [ ! -d ""$gentooportdir"/.git" ] ; then - einfo "Injecting binmode (minimal) gentoo portage tree" - cd "$gentooportdir" && git init > /dev/null 2>&1 - git remote add origin https://gitlab.com/redcore/portage.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 ""$gentooportdir"/profiles/updates" - fi -} - -fetchfulloverlays () { - # fetch full redcore overlay - if [ ! -d ""$redcoreportdir"/.git" ] ; then - einfo "Injecting "$releasename"-"$releasetarget" overlay" - cd "$redcoreportdir" && git init > /dev/null 2>&1 - git remote add origin https://gitlab.com/redcore/redcore-desktop.git - git pull --depth=1 origin master - git branch -u origin/master master - fi -} - -fetchminimaloverlays () { - # fetch minimal redcore overlay - if [ ! -d ""$redcoreportdir"/.git" ] ; then - einfo "Injecting binmode (minimal) "$releasename"-"$releasetarget" overlay" - cd "$redcoreportdir" && git init > /dev/null 2>&1 - git remote add origin https://gitlab.com/redcore/redcore-desktop.git - git config core.sparsecheckout true - echo "profiles/*" >> .git/info/sparse-checkout - echo "metadata/*" >> .git/info/sparse-checkout - echo "eclass/*" >> .git/info/sparse-checkout - git pull --depth=1 origin master - git branch -u origin/master master - fi -} - -setbinmodeconfig() { - # set make.conf to binmode, portage will always use binary packages from binhost - ln -sf "$portgitdir" "$portconfdir" - ln -sf "$portconfdir"/make.conf.amd64-binmode "$portconfdir"/make.conf - eselect profile set 1 - env-update - . /etc/profile -} - -setmixedmodeconfig() { - # set make.conf to mixedmode, portage will prefer binary packages over ebuilds - # but will use ebuilds if they are newer than binary packages from binhost - # or if the binary package is not available in binhost - ln -sf "$portgitdir" "$portconfdir" - ln -sf "$portconfdir"/make.conf.amd64-mixedmode "$portconfdir"/make.conf - eselect profile set 1 - env-update - . /etc/profile -} - -setsrcmodeconfig () { - # set make.conf to srcmode, portage will always use ebuilds - ln -sf "$portgitdir" "$portconfdir" - ln -sf "$portconfdir"/make.conf.amd64-srcmode "$portconfdir"/make.conf - eselect profile set 1 - env-update - . /etc/profile -} - -binmode() { - resetmode - fetchminimalportagetree - fetchminimaloverlays - fetchportageconfig - setbinmodeconfig -} - -mixedmode() { - resetmode - fetchfullportagetree - fetchfulloverlays - fetchportageconfig - setmixedmodeconfig -} - -srcmode() { - resetmode - fetchfullportagetree - fetchfulloverlays - fetchportageconfig - setsrcmodeconfig -} - -# help menu color variables - -export local colorstart="\e[1;49;34m" -export local colorstop="\e[0m" - -# help menu function - -showhelp () { - -echo -e "\ -"$colorstart"SYNOPSIS"$colorstop" - "$colorstart"vasile --option"$colorstop" ["$colorstart"arguments"$colorstop"] - "$colorstart"vasile --help"$colorstop" - -"$colorstart"DESCRIPTION"$colorstop" - - Vasile is an acronym for ** Versatile Advanced Script for Iso and Latest Enchantments ** - -"$colorstart"OPTIONS"$colorstop" - "$colorstart"--makepkg"$colorstop" ["$colorstart"package(s)"$colorstop"] - This option will allow you to build a package or multiple packages in an overlayfs mounted squashfs chroot jail. - - It must be run in the folder where the squashfs chroot jail resides, or else it will fail to mount the squahfs chroot jail and build the package(s). - - The squashfs chroot jail and the md5sum checksum file are hardcored into "$colorstart"libvasile"$colorstop", but you may want to change them to suit your needs. - - You MUST provide package(s) to build as arguments, or else vasile will only mount the chroot jail - - Examples : - "$colorstart"vasile --makepkg wine"$colorstop" - "$colorstart"vasile --makepkg wine playonlinux q4wine"$colorstop" - - If the package(s) is/are already built, it will not build it/them again (unless newer version(s) is/are available), but install it/them into squahfs chroot jail - - If the package(s) you want to build depends on any already built package(s) it will make use of it/them to satisfy the required dependencies. - - "$colorstart"--makeiso"$colorstop" - This option will allow you to build a live iso image based on the squashfs chroot jail. - - It must be run in the folder where the squashfs chroot jail resides, or else it will fail to rsync the contents of it and build the iso image. - - It is not fully automatic, it will only rsync the contents of the squashfs chroot jail, chroot into it, and let you install packages you want into the iso image. - There are some predefined package sets available in "$colorstart"/etc/portage/sets"$colorstop". Adjust them to suit your needs. - - It will ALLWAYS use package(s) built with "$colorstart"--makepkg"$colorstop" option. When you are happy with package selection, just exit the chroot environment and - the live filesystem will be compressed, live services will be autoenabled, live bootloader autoconfigured and in the end live iso image will be built. You will find - a list of predefined live services list hardcoded into "$colorstart"libvasile"$colorstop". Adjust it to suit your needs. - - "$colorstart"--resetmode"$colorstop" - This option will allow you to reset the system state. It will remove whole portage tree, overlays and portage configuration files and reset the system profile. Usually - you will never want to call this option directly, unless you really really really know what are you doing. It is called automatically when switching to other states. - - !!! WARNING !!! : Never never never leave the system in this state. You will no longer be able to install/remove/upgrade any packages untill you set the system profile, - get the portage tree, overlays and configure portage by hand. Or, you can always activate one of the three other supported system states. - - "$colorstart"--binmode"$colorstop" - This option will allow you to change the system state to binmode. In this state portage will allways use only binary packages from the binhost. It will fetch a minimal - portage tree without any ebuilds in it, but only with portage profiles, metadata and eclass. It will also fetch overlay and portage configuration files, and will adjust - "$colorstart"make.conf"$colorstop" for binary only usage. This system state is for those who just meet with the power of Gentoo. - - !!! WARNING !!! : Never never never modify or create any file in "$colorstart"/etc/portage/"$colorstop" in this state. - - "$colorstart"--mixedmode"$colorstop" - This option will allow you to change the system state to mixedmode. In this state portage will prefer binary packages from the binhost over ebuilds from the portage tree. - It will fetch the full portage tree, the overlay and portage configuration files, and adjust "$colorstart"make.conf"$colorstop" for binary/ebuild usage. Usually you will find this system state - useful if you want to install a package not available in the binhost, you want to upgrade a package to a newer version from portage tree or if you wanna rebuild a package - with your own useflags. - - !!! WARNING !!! : Never never never modify any file in "$colorstart"/etc/portage/"$colorstop" in this state. If you want to adjust useflags or keywords for a package, you can create a new file - e.g.: "$colorstart"100-my.package.use"$colorstop" in "$colorstart"/etc/portage/package.use/"$colorstop" or "$colorstart"100-my.package.keywords"$colorstop" in "$colorstart"/etc/portage/package.keywords/"$colorstop". - - "$colorstart"--srcmode"$colorstop" - This option will allow you to change the system state to srcmode. In more clear terms, it will transform your Kogaion/Argent/Redcore system into pure Gentoo. Binary packages - from the binhost will be ignored, and you will only install packages building from portage tree using emerge. It will fetch the full portage tree, the overlay and portage - configuration files and adjust "$colorstart"make.conf"$colorstop" for ebuild only usage. - - In this system state you can modify whatever you want in "$colorstart"/etc/portage/"$colorstop". You can adjust useflags, keywords, masks, build environment and rebuild the whole system to suit you. - You have the full power of Gentoo available only one command away! - - !!! WARNING !!! : Only use this system state if you have a strong knowledge of Gentoo tools e.g.: "$colorstart"emerge, equery, layman, eix, qlist, useflags, keywords, masks"$colorstop". " -exit 0 -} diff --git a/src/backend/libvasile.sh b/src/backend/libvasile.sh deleted file mode 100644 index 506ee5e..0000000 --- a/src/backend/libvasile.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash - -if [[ -f /lib/gentoo/functions.sh ]] ; then - source /lib/gentoo/functions.sh -else - echo "Cannot import Gentoo functions, I will abort now!" - exit 1 -fi - -if [[ -f /usr/lib/vasile/variables_jail.sh ]] ; then - source /usr/lib/vasile/variables_jail.sh -else - echo "Cannot import jail variables, I will abort now!" - exit 1 -fi - -if [[ -f /usr/lib/vasile/commands_jail.sh ]] ; then - source /usr/lib/vasile/commands_jail.sh -else - echo "Cannot import jail commands, I will abort now!" - exit 1 -fi - -if [[ -f /usr/lib/vasile/functions_generic.sh ]] ; then - source /usr/lib/vasile/functions_generic.sh -else - echo "Cannot import generic functions, I will abort now!" - exit 1 -fi - -if [[ -f /usr/lib/vasile/functions_makepkg.sh ]] ; then - source /usr/lib/vasile/functions_makepkg.sh -else - echo "Cannot import makepkg functions, I will abort now!" - exit 1 -fi - -if [[ -f /usr/lib/vasile/functions_makeiso.sh ]] ; then - source /usr/lib/vasile/functions_makeiso.sh -else - echo "Cannot import makeiso functions, I will abort now!" - exit 1 -fi - -if [[ -f /usr/lib/vasile/functions_modeswitch.sh ]] ; then - source /usr/lib/vasile/functions_modeswitch.sh -else - echo "Cannot import modeswitch functions, I will abort now!" - exit 1 -fi diff --git a/src/backend/v_jail.sh b/src/backend/v_jail.sh new file mode 100644 index 0000000..4a08a26 --- /dev/null +++ b/src/backend/v_jail.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +export local distupstream="gentoo" +export local distname="redcore" +export local disttarget="desktop" +export local distver="1" +export local kernver="4.9.53-"$distname"-lts" + +export local jailx64=""$distname"_"$distver"_core_x64.squashfs" +export local jailx64sum=""$jailx64".md5sum" + +export local ropath="rodir" +export local rwpath="rwdir" +export local workpath="workdir" +export local overlaypath="overlaydir" + +export local jailuser="root" +export local jailarch="x86_64" +export local jailtarget="${@:2}" +export local jailkernname="kernel-genkernel-"$jailarch"-"$kernver"" +export local jailramfsname="initramfs-genkernel-"$jailarch"-"$kernver"" +export local jailrootpath="$distname"-"$disttarget"-"$distver"-"$jailarch" +export local jailsynctarget=""$jailrootpath"/rootfs" +export local jailsyncsource="/tmp/"$jailrootpath"" +export local jailbootldrpath=""$jailrootpath"/boot/grub" +export local jailefildrpath=""$jailrootpath"/efi/boot" +export local jaildvdpath=""$jailrootpath"/CDroot" +export local jailsquashfspath=""$jailrootpath"/LiveOS" +export local jailrealfspath=""$jaildvdpath"/LiveOS" +export local jailbootldrdlpath="/tmp/bootcore" +export local jailbootldrcfgpath=""$jailbootldrdlpath"/cdroot/boot" +export local jailmainportpath="/usr/ports/"$distupstream"" +export local jailaddonportpath="/usr/ports/"$distname"" +export local jailportcfgtarget="/etc/portage" +export local jailportcfgsource="/opt/"$distname"-build/conf/intel/portage" +export local jailportvcspath="/opt/"$distname"-build" diff --git a/src/backend/variables_jail.sh b/src/backend/variables_jail.sh deleted file mode 100644 index 4a08a26..0000000 --- a/src/backend/variables_jail.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -export local distupstream="gentoo" -export local distname="redcore" -export local disttarget="desktop" -export local distver="1" -export local kernver="4.9.53-"$distname"-lts" - -export local jailx64=""$distname"_"$distver"_core_x64.squashfs" -export local jailx64sum=""$jailx64".md5sum" - -export local ropath="rodir" -export local rwpath="rwdir" -export local workpath="workdir" -export local overlaypath="overlaydir" - -export local jailuser="root" -export local jailarch="x86_64" -export local jailtarget="${@:2}" -export local jailkernname="kernel-genkernel-"$jailarch"-"$kernver"" -export local jailramfsname="initramfs-genkernel-"$jailarch"-"$kernver"" -export local jailrootpath="$distname"-"$disttarget"-"$distver"-"$jailarch" -export local jailsynctarget=""$jailrootpath"/rootfs" -export local jailsyncsource="/tmp/"$jailrootpath"" -export local jailbootldrpath=""$jailrootpath"/boot/grub" -export local jailefildrpath=""$jailrootpath"/efi/boot" -export local jaildvdpath=""$jailrootpath"/CDroot" -export local jailsquashfspath=""$jailrootpath"/LiveOS" -export local jailrealfspath=""$jaildvdpath"/LiveOS" -export local jailbootldrdlpath="/tmp/bootcore" -export local jailbootldrcfgpath=""$jailbootldrdlpath"/cdroot/boot" -export local jailmainportpath="/usr/ports/"$distupstream"" -export local jailaddonportpath="/usr/ports/"$distname"" -export local jailportcfgtarget="/etc/portage" -export local jailportcfgsource="/opt/"$distname"-build/conf/intel/portage" -export local jailportvcspath="/opt/"$distname"-build" diff --git a/src/frontend/cli/vasile b/src/frontend/cli/vasile deleted file mode 100755 index d64b617..0000000 --- a/src/frontend/cli/vasile +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -# Say Hello to Vasile, a modular script to build Redcore Linux packages && ISO images using a clean squashfs + overlayfs chroot -# Main author : Ghiunhan Mamut (aka V3n3RiX) -# Dependencies : kernel built with squashfs + overlayfs + loopback support && sys-fs/grub:2 && sys-fs/squashfs-tools && dev-libs/libisoburn && sys-fs/mtools -# - -# Import our variables and functions - -source /usr/lib/vasile/libvasile - -# Vasile need root privileges and a proper kernel to run -# Also, running it in live mode is a really bad idea - -checkiflive -kernelconfig - - -case $1 in - --makepkg) - makepkg - ;; - --makeiso) - makeiso - ;; - --resetmode) - resetmode - ;; - --binmode) - binmode - ;; - --mixedmode) - mixedmode - ;; - --srcmode) - srcmode - ;; - --dkms) - dkmsmod - ;; - --help) - showhelp - ;; - *) - eerror "error: no operation specified, use --help for help" - ;; -esac - -exit 0 diff --git a/src/frontend/cli/vasile.sh b/src/frontend/cli/vasile.sh new file mode 100755 index 0000000..aeb27b3 --- /dev/null +++ b/src/frontend/cli/vasile.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# Say Hello to Vasile, a modular script to build Redcore Linux packages && ISO images using a clean squashfs + overlayfs chroot +# Main author : Ghiunhan Mamut (aka V3n3RiX) +# Dependencies : kernel built with squashfs + overlayfs + loopback support && sys-fs/grub:2 && sys-fs/squashfs-tools && dev-libs/libisoburn && sys-fs/mtools +# + +# Import our variables and functions + +source /usr/lib/vasile/f_import.sh + +# Vasile need root privileges and a proper kernel to run +# Also, running it in live mode is a really bad idea + +checkiflive +checkkerncfg + +case $1 in + --makepkg) + makepkg + ;; + --makeiso) + makeiso + ;; + --resetmode) + resetmode + ;; + --binmode) + binmode + ;; + --mixedmode) + mixedmode + ;; + --srcmode) + srcmode + ;; + --dkms) + dkmsmod + ;; + --help) + showhelp + ;; + *) + eerror "error: no operation specified, use --help for help" + ;; +esac + +exit 0 -- cgit v1.2.3