From 5814c982f5bd598342d0635dac233e995680c89e Mon Sep 17 00:00:00 2001
From: davidovski <david@davidovski.xyz>
Date: Tue, 17 May 2022 19:08:32 +0100
Subject: fixed xi_buildscript issues

---
 Makefile          | 2 +-
 xi_buildscript.sh | 6 +++---
 xibuild.sh        | 7 ++++---
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index b3515d3..af75e7a 100644
--- a/Makefile
+++ b/Makefile
@@ -2,5 +2,5 @@ PREFIX=/usr
 
 install:
 	install -Dm755 xibuild.sh ${DESTDIR}${PREFIX}/bin/xibuild
-	install -Dm755 xi_profile.sh ${DESTDIR}${PREFIX}/lib/xibuild/xi_profile.sh
+	install -Dm755 xi_profile.sh ${DESTDIR}/etc/xibuild_profile.conf
 	install -Dm755 xi_buildscript.sh ${DESTDIR}${PREFIX}/lib/xibuild/xi_buildscript.sh
diff --git a/xi_buildscript.sh b/xi_buildscript.sh
index 0fbcc92..d9e19f7 100644
--- a/xi_buildscript.sh
+++ b/xi_buildscript.sh
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+PKG_NAME=$1
+cd $2
+
 . ./xi_profile.sh
 
 apply_patches () {
@@ -22,9 +25,6 @@ add_from_main () {
     done
 }
 
-PKG_NAME=$1
-cd $2
-
 stages="prepare build check package"
 case "$@" in
     *"-n"*)
diff --git a/xibuild.sh b/xibuild.sh
index 1c3c7d2..3518783 100644
--- a/xibuild.sh
+++ b/xibuild.sh
@@ -19,7 +19,7 @@ checkopt=""
 
 root="/"
 
-xibuild_profile="/usr/lib/xibuild/xi_profile.sh"
+xibuild_profile="/etc/xibuild_profile.conf"
 xibuild_script="/usr/lib/xibuild/xi_buildscript.sh"
 
 usage () {
@@ -35,9 +35,9 @@ ${BLUE}Avaiable Options:
     ${BLUE}-b ${LIGHT_BLUE}[path]
         ${LIGHT_CYAN}specify the directory to build things in ${LIGHT_WHITE}[default: /var/lib/xibuild]
     ${BLUE}-p ${LIGHT_BLUE}[file]
-        ${LIGHT_CYAN}specify a non-default xi_profile script, to run inside the chroot ${LIGHT_WHITE}[default: /usr/lib/xibuild/xi_profile.sh]
+        ${LIGHT_CYAN}specify a non-default xi_profile script, to run inside the chroot ${LIGHT_WHITE}[default: /etc/xibuild_profile.conf]
     ${BLUE}-k ${LIGHT_BLUE}[file]
-        ${LIGHT_CYAN}specify an openssl private key to sign packages with${LIGHT_WHITE}[default: /usr/lib/xibuild/xi_profile.sh]
+        ${LIGHT_CYAN}specify an openssl private key to sign packages with${LIGHT_WHITE}
     
     ${BLUE}-v
         ${LIGHT_CYAN}verbose: print logs to stdout
@@ -115,6 +115,7 @@ xibuild_fetch () {
 }
 
 xibuild_build () {
+    install -d $root/$build_dir/
     install -Dm755 $xibuild_profile $root/$build_dir/xi_profile.sh
     install -Dm755 $xibuild_script $root/$build_dir/xi_buildscript.sh
     mkdir -p $root/$export_dir
-- 
cgit v1.2.1