summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV3n3RiX <venerix@rogentos.ro>2015-07-17 00:29:49 +0100
committerV3n3RiX <venerix@rogentos.ro>2015-07-17 00:29:49 +0100
commite023973a8bb2ce49b53febc5b9964bded1a4b5f8 (patch)
treeed404274a294f1fb7509a128841ace55075de1a3
parente2afa786dbdd9d2b31140cc3e3812bb019daff15 (diff)
rearrange functions in order they are called
-rwxr-xr-xvasile161
1 files changed, 80 insertions, 81 deletions
diff --git a/vasile b/vasile
index 92d9e01..d99de68 100755
--- a/vasile
+++ b/vasile
@@ -27,6 +27,30 @@ export local envkogaionoverlay="layman -f -a kogaion -o https://raw.github.com/R
export local envkogaiondesktopoverlay="layman -f -a kogaion-desktop -o https://raw.github.com/Rogentos/kogaion-desktop/master/overlay.xml"
+envkogaionstart () {
+ # mount ro squashfs chroot + add rw overlayfs layer to enable clean package building
+ mount -t squashfs "$sqfsroot" "$rodir"
+ mount -t overlayfs -o lowerdir="$rodir",upperdir="$rwdir" overlayfs "$overlaydir"
+ 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
+}
+
+envkogaionstop () {
+ # umount squashfs + overlayfs chroot
+ 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" > /dev/null 2>&1
+ umount -l "$rodir" > /dev/null 2>&1
+}
+
envcheckroot () {
if [[ "$(whoami)" != root ]] ; then
echo ""
@@ -83,67 +107,25 @@ envkogaionsquashfsintegrity () {
done
}
-envkogaionstart () {
- # mount ro squashfs chroot + add rw overlayfs layer to enable clean package building
- mount -t squashfs "$sqfsroot" "$rodir"
- mount -t overlayfs -o lowerdir="$rodir",upperdir="$rwdir" overlayfs "$overlaydir"
- 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
-}
-
-envkogaionstop () {
- # umount squashfs + overlayfs chroot
- 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" > /dev/null 2>&1
- umount -l "$rodir" > /dev/null 2>&1
-}
-
-envkogaionbuild () {
- # build packages in squashfs + overlayfs chroot
- if [[ "$(uname -m)" = "x86_64" ]] ; then
- echo ""
- echo "Environment is UP && RUNNING ... building targets"
- sleep 1
- chroot "$overlaydir" su - "$envkogaionuser" -c "$envkogaionbuildtarget"
- elif [[ "$(uname -m)" = "i686" ]] ; then
- echo ""
- echo "Environment is UP && RUNNING ... building targets"
- sleep 1
- linux32 chroot "$overlaydir" su - "$envkogaionuser" -c "$envkogaionbuildtarget"
- fi
-}
-
-envkogaionchroot() {
- # enter squashfs + overlayfs chroot to push packages, or debug build errors
- 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 ""
- if [[ "$(uname -m)" = "x86_64" ]] ; then
- chroot "$overlaydir" su - "$envkogaionuser"
- elif [[ "$(uname -m)" = "i686" ]] ; then
- linux32 chroot "$overlaydir" su - "$envkogaionuser"
- fi
+envkogaionprepare () {
+ # 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 "$overlaydir" ]] ; then
+ for i in "$rodir" "$rwdir" "$overlaydir" ; do
+ mkdir "$i"
+ done
+ envkogaionstart
+ break
+ elif [[ -d "$rodir" && -d "$rwdir" && -d "$overlaydir" ]] ; then
+ envkogaionstop
+ for i in "$rodir" "$rwdir" "$overlaydir" ; do
+ rm -rf "$i"
+ done
+ continue
+ fi
+ done
}
envkogaionoverlays() {
@@ -164,7 +146,6 @@ envkogaionoverlays() {
fi
}
-
envkogaionbuildsystem() {
# inject our buildsystem into squashfs + overlayfs chroot
if [[ "$(uname -m)" = "x86_64" ]] ; then
@@ -189,25 +170,43 @@ envkogaionbuildsystem() {
}
-envkogaionprepare () {
- # 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 "$overlaydir" ]] ; then
- for i in "$rodir" "$rwdir" "$overlaydir" ; do
- mkdir "$i"
- done
- envkogaionstart
- break
- elif [[ -d "$rodir" && -d "$rwdir" && -d "$overlaydir" ]] ; then
- envkogaionstop
- for i in "$rodir" "$rwdir" "$overlaydir" ; do
- rm -rf "$i"
- done
- continue
- fi
- done
+envkogaionbuild () {
+ # build packages in squashfs + overlayfs chroot
+ if [[ "$(uname -m)" = "x86_64" ]] ; then
+ echo ""
+ echo "Environment is UP && RUNNING ... building targets"
+ sleep 1
+ chroot "$overlaydir" su - "$envkogaionuser" -c "$envkogaionbuildtarget"
+ elif [[ "$(uname -m)" = "i686" ]] ; then
+ echo ""
+ echo "Environment is UP && RUNNING ... building targets"
+ sleep 1
+ linux32 chroot "$overlaydir" su - "$envkogaionuser" -c "$envkogaionbuildtarget"
+ fi
+}
+
+envkogaionchroot() {
+ # enter squashfs + overlayfs chroot to push packages, or debug build errors
+ 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 ""
+ if [[ "$(uname -m)" = "x86_64" ]] ; then
+ chroot "$overlaydir" su - "$envkogaionuser"
+ elif [[ "$(uname -m)" = "i686" ]] ; then
+ linux32 chroot "$overlaydir" su - "$envkogaionuser"
+ fi
}
main () {