iglu: remove files, iglupkg: configurable paths

This commit is contained in:
Ella Stanforth 2022-04-09 14:54:11 +00:00
parent 63edae20e5
commit 2d89d5c376
2 changed files with 34 additions and 15 deletions

View file

@ -41,6 +41,8 @@ remove() {
while shift 2> /dev/null; do
if [ -d "/$1" ]; then
rmdir "/$1" 2> /dev/null
elif [ -f "/$1" ]; then
rm -f "/$1" 2> /dev/null
fi
done
set -e

View file

@ -4,8 +4,21 @@ set -e
export HOST_ARCH=$(uname -m)
export HOST_TRIPLE="$HOST_ARCH-unknown-linux-musl"
to_run=
usage() {
echo "usage: $(basename $0) [fbp]"
exit 1
}
fatal() {
echo "ERROR: $@"
exit 1
}
warn() {
echo "WARNING: $@"
}
to_run=
while [ ! -z "$1" ]; do
case "$1" in
--with-cross=*)
@ -17,10 +30,25 @@ while [ ! -z "$1" ]; do
--with-cross)
fatal '--with-cross=<arch> requires an argument'
;;
--with-cross-dir=*)
WITH_CROSS_DIR=$(echo "$1" | cut -d'=' -f2)
[ -z "$WITH_CROSS_DIR" ] && fatal '--with-cross-dir=<sysroot> requires an argument'
[ -d "$WITH_CROSS_DIR" ] 2>/dev/null || warn "$WITH_CROSS_DIR does not exist"
;;
--with-cross-dir)
fatal '--with-cross-dir=<sysroot> requires an argument'
;;
--for-cross)
echo 'INFO: for cross'
FOR_CROSS=1
;;
--for-cross-dir=*)
FOR_CROSS_DIR=$(echo "$1" | cut -d'=' -f2)
[ -z "$FOR_CROSS_DIR" ] && fatal '--for-cross-dir=<sysroot> requires an argument'
;;
--for-cross-dir)
fatal '--for-cross-dir=<sysroot> requires an argument'
;;
fbp)
to_run="f b p"
;;
@ -46,6 +74,9 @@ while [ ! -z "$1" ]; do
shift
done
[ -z "$WITH_CROSS_DIR" ] && WITH_CROSS_DIR=/usr/$ARCH-linux-musl
[ -z "$FOR_CROSS_DIR" ] && FOR_CROSS_DIR=/usr/$ARCH-linux-musl
if [ -z "$ARCH" ]; then
export ARCH=$HOST_ARCH
fi
@ -63,20 +94,6 @@ export CXXFLAGS=$CFLAGS
export JOBS=$(nproc)
usage() {
echo "usage: $(basename $0) [fbp]"
exit 1
}
fatal() {
echo "ERROR: $@"
exit 1
}
warn() {
echo "WARNING: $@"
}
[ -f build.sh ] || fatal 'build.sh not found'
. ./build.sh