summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/build.sh12
-rwxr-xr-xsrc/build_package.sh21
-rwxr-xr-xsrc/make_tools.sh4
-rwxr-xr-xsrc/prepare_environment.sh16
4 files changed, 38 insertions, 15 deletions
diff --git a/src/build.sh b/src/build.sh
index b4e8f6d..a01368b 100755
--- a/src/build.sh
+++ b/src/build.sh
@@ -23,6 +23,18 @@ build_package () {
exported_pkg=$(find $XIB_EXPORT -wholename "*/$name.xipkg" | head -1 | xargs realpath)
if [ -f $exported_pkg ]; then
tar -h --no-overwrite-dir -xf $exported_pkg -C $XIB_CHROOT
+
+ postinstall="$XIB_CHROOT/var/lib/xipkg/postinstall"
+ if [ -d $postinstall ]; then
+ for file in "$postinstall/*.sh"; do
+ f=$(basename $file)
+ chmod 755 $file
+ xichroot "$XIB_CHROOT" "/var/lib/xipkg/postinstall/$f"
+ rm $file
+ printf "$PASS run postinstall for $f!\n"
+ done
+ rmdir $postinstall
+ fi
fi
printf "$PASS installed to chroot!\n"
diff --git a/src/build_package.sh b/src/build_package.sh
index 0ba7bb2..a6d4a33 100755
--- a/src/build_package.sh
+++ b/src/build_package.sh
@@ -11,11 +11,11 @@ source $BUILDFILE
extract () {
FILE=$1
- case "${FILE#*.}" in
- "tar.gz" )
+ case "${FILE##*.}" in
+ "gz" )
tar -zxf $FILE
;;
- "tar.lz" )
+ "lz" )
tar --lzip -xf "$FILE"
;;
"zip" )
@@ -56,8 +56,8 @@ fetch_source () {
if git ls-remote -q $SOURCE $BRANCH &> /dev/null; then
# The source is a git repo
- git clone $SOURCE . > /dev/null
- git checkout $BRANCH > /dev/null
+ git clone $SOURCE . &> /dev/null
+ git checkout $BRANCH &> /dev/null
else
# The source is a file
@@ -100,6 +100,7 @@ clean_chroot () {
make_buildscript () {
echo MAKEFLAGS="$MAKEFLAGS" >> "$XIB_CHROOT/build/profile"
+ echo LDFLAGS="$LDFLAGS" >> "$XIB_CHROOT/build/profile"
cat > "$XIB_CHROOT/build/build.sh" << "EOF"
#!/bin/bash
@@ -137,14 +138,18 @@ check || exit 1
echo "==========================PACKAGE STAGE=========================="
package || exit 1
+printf "checking for postinstall... "
if command -v postinstall > /dev/null; then
- POSTINSTALL=$(type postinstall | sed '1,3d,$d')
- if [${#POSTINSTALL} != 0]; then
+ echo "adding postinstall"
+ POSTINSTALL=$(type postinstall | sed '1,3d;$d')
+ if [ ${#POSTINSTALL} != 0 ]; then
POST_DIR=$PKG_DEST/var/lib/xipkg/postinstall
mkdir -p $POST_DIR
echo "#!/bin/sh" > $POST_DIR/$PKG_NAME.sh
echo $POSTINSTALL >> $POST_DIR/$PKG_NAME.sh
fi
+else
+ echo "no postinstall"
fi
EOF
chmod 700 "$XIB_CHROOT/build/build.sh"
@@ -205,7 +210,7 @@ build () {
xichroot $XIB_CHROOT /build/build.sh &> $log_file && printf "$GREEN built!\n" || return 1
printf "$BLUE\tPackaging package..."
- package && printf "$GREEN packaged!\n" || return 1
+ package && printf "$GREEN packaged to $(du -sh "$XIB_EXPORT/repo/$REPO/$NAME.xipkg" | awk '{ print $1 }')!\n" || return 1
printf "$BLUE\tCreating package info..."
create_info && printf "$GREEN created info!\n" || return 1
diff --git a/src/make_tools.sh b/src/make_tools.sh
index 8fc5f69..5dc1f02 100755
--- a/src/make_tools.sh
+++ b/src/make_tools.sh
@@ -1,9 +1,9 @@
#!/bin/sh
# A small script to generate the chroot environment where building will take place
-export WORKING_DIR="/var/xilinux/xib"
+export WORKING_DIR="/var/lib/xib"
BUILDFILES_REPO_URL="https://xi.davidovski.xyz/git/buildfiles.git"
-export SYSTEM_DIR="$WORKING_DIR/system"
+export SYSTEM_DIR="$WORKING_DIR/chroot"
TOOL_DIR="$SYSTEM_DIR/tools"
SOURCES="$SYSTEM_DIR/sources"
diff --git a/src/prepare_environment.sh b/src/prepare_environment.sh
index 1edfd9c..0457e98 100755
--- a/src/prepare_environment.sh
+++ b/src/prepare_environment.sh
@@ -1,6 +1,7 @@
#!/bin/sh
export MAKEFLAGS="-j12"
+export LDFLAGS="-liconv"
export XIB_DIR="/var/lib/xib"
export XIB_BUILDFILES="$XIB_DIR/buildfiles"
@@ -8,17 +9,22 @@ export XIB_CHROOT="$XIB_DIR/chroot"
export XIB_EXPORT="$XIB_DIR/export"
export PRIV_KEY="/home/david/.ssh/xi.pem"
+export DEVELOPMENT_BUILDFILES="/home/david/docs/proj/xilinux/buildfiles"
export BUILDFILES_GIT_REPO="https://xi.davidovski.xyz/git/buildfiles.git"
mkdir -p $XIB_DIR $XIB_BUILDFILES $XIB_CHROOT $XIB_EXPORT
-if [ -d $XIB_BUILDFILES/.git ]; then
- cd $XIB_BUILDFILES
- git pull
- cd $OLDPWD
+if [ -d $DEVELOPMENT_BUILDFILES ]; then
+ cp -r $DEVELOPMENT_BUILDFILES/* $XIB_BUILDFILES/
else
- git clone $BUILDFILES_GIT_REPO $XIB_BUILDFILES
+ if [ -d $XIB_BUILDFILES/.git ]; then
+ cd $XIB_BUILDFILES
+ git pull
+ cd $OLDPWD
+ else
+ git clone $BUILDFILES_GIT_REPO $XIB_BUILDFILES
+ fi
fi