summaryrefslogtreecommitdiff
path: root/xibuild/build_all.sh
diff options
context:
space:
mode:
Diffstat (limited to 'xibuild/build_all.sh')
-rwxr-xr-xxibuild/build_all.sh105
1 files changed, 55 insertions, 50 deletions
diff --git a/xibuild/build_all.sh b/xibuild/build_all.sh
index dae63c6..2a1c0be 100755
--- a/xibuild/build_all.sh
+++ b/xibuild/build_all.sh
@@ -6,82 +6,87 @@ PASS="\033[0;32m"
NEUTRAL="\033[0;33m"
RESET="\033[0m"
+# scan and run all postinstall scripts
+#
+run_postinstall () {
+ postinstall="$XIB_CHROOT/var/lib/xipkg/postinstall"
+ if [ -d $postinstall ]; then
+ for file in "$postinstall/*.sh"; do
+ f=$(basename $file)
+
+ # run the postinstall 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
+
+}
+
+# install a single package if it is present
+#
+# $1: the exported .xipkg file
+#
install_package () {
- local exported_pkg=$(find $XIB_EXPORT -wholename "*/$1.xipkg" | head -1 | xargs realpath)
- if [ -f $exported_pkg ]; then
- local checksum=$(md5sum $exported_pkg)
-
- local installed_list="$XIB_CHROOT/installed"
- [ -f $installed_list ] || touch $installed_list
-
- if grep -q "^$checksum$" $installed_list; then
- echo $checksum >> $installed_list
-
- 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
- printf "$PASS installed to chroot!\n"
- else
- printf "$RESET already installed!\n"
- fi
+ printf "${INFO}${TABCHAR}install "
+ local checksum=$(md5sum $1 | cut -d' ' -f1)
+
+ if grep -q "^${checksum}$" $INSTALLED_PACKAGES; then
+ printf "${RESET}${CHECKMARK}\n"
+ else
+ tar -h --no-overwrite-dir -xf $1 -C $XIB_CHROOT
+ echo $checksum >> $INSTALLED_PACKAGES
+
+ printf "${PASS}${CHECKMARK}\n"
+ return 0
fi
}
+# build a package by its name
+#
build_package () {
- name=$(echo $line | cut -d"+" -f1)
- buildfile=$(find $XIB_BUILDFILES -wholename "*/$name.xibuild" | head -1)
+
+ local name=$(echo $1 | cut -d"+" -f1)
+ local install=$(echo $line | grep -q '+' && echo "true" || echo "false")
+ local buildfile=$(find $XIB_BUILDFILES -wholename "*/$name.xibuild" | head -1)
if [ -f "$buildfile" ]; then
- printf $INFO
- printf "Building$NEUTRAL %s$INFO:\n$RESET" $name
+ printf "${INFO}%s\n${RESET}" $name
+
./build_package.sh $buildfile || return 1
- # Install the package if it is needed for other builds
- if echo $line | grep -q '+'; then
- printf "$INFO\tInstalling..."
- install_package $name
+ # install the package it exists
+ local exported_pkg=$(find $XIB_EXPORT -wholename "*/$name.xipkg" | head -1 | xargs realpath)
+ if $install && [ -f $exported_pkg ] ; then
+ install_package $exported_pkg
fi
- printf $RESET
- printf "Finished building %s!\n" $name
- else
- printf "$ERROR$name does not exist\n"
+ return 0
fi
- # configure shadow here
- if [ "$name" = "shadow" ]; then
- xichroot "$XIB_CHROOT" "/usr/sbin/pwconv"
- xichroot "$XIB_CHROOT" "/usr/sbin/grpconv"
- xichroot "$XIB_CHROOT" "mkdir -p /etc/default"
- xichroot "$XIB_CHROOT" "/usr/sbin/useradd -D --gid 999"
- fi
+ printf "${ERROR}${CROSSMARK} ${name}\n"
}
+# build all of the packages
+#
build_all () {
for line in $(perl build_order.pm); do
build_package $line || return 1
done
-
}
+
if build_all; then
printf "\n${PASS}Built all packages!"
exit 0
else
- printf "$ERROR Something went wrong!$NEUTRAL Press enter to view recent log"
+ printf "${ERROR} Something went wrong!${NEUTRAL} Press enter to view recent log"
read;
- f=$(ls -1 --sort time $XIB_EXPORT/repo/*/*.log | head -1 | xargs realpath)
- less $f
+ less $(ls -1 --sort time $XIB_EXPORT/repo/*/*.log | head -1 | xargs realpath)
exit 1
fi