initial commit

This commit is contained in:
Ella Stanforth 2021-10-28 14:02:47 +00:00
commit cb55ae44e1
3 changed files with 120 additions and 0 deletions

8
.editorconfig Normal file
View file

@ -0,0 +1,8 @@
root = true
[*]
insert_final_newline = true
trim_trailing_whitespace = true
[*.sh]
indent_style = tab
tab_width = 4

1
README.md Normal file
View file

@ -0,0 +1 @@
# The Iglunix package manager

111
iglupkg.sh Executable file
View file

@ -0,0 +1,111 @@
#!/bin/sh
CWD="$(pwd)"
fatal() {
echo "ERROR: $@"
exit 1
}
warn() {
echo "WARNING: $@"
}
assert_file() {
stat "$1" \
> /dev/null \
2> /dev/null && return
fatal "$1 does not exist!"
}
make_dir() {
state "$1" \
> /dev/null \
2> /dev/null && return
mkdir -p "$1"
}
assert_file build.sh
. ./build.sh
srcdir="$CWD/src"
outdir="$CWD/out"
pkgdir="$outdir/$pkgname-$pkgver"
pkgfile="$outdir/$pkgname-$pkgver.tar.zst"
genmeta() {
echo "[pkg]"
echo "pkgname=$pkgname"
echo "pkgver=$pkgver"
echo "deps=$deps"
echo ""
echo "[license]"
license
echo ""
echo "[backup]"
backup
echo ""
echo "[fs]"
cd "$pkgdir"
find *
cd "$srcdir"
}
if [ ! -n "$FAKEROOTKEY" ]; then
stat $pkgfile \
> /dev/null \
2> /dev/null \
&& fatal 'Package already built'
stat $srcdir \
> /dev/null \
2> /dev/null \
&& warn 'Package partially built'
make_dir "$srcdir"
cd "$srcdir"
echo "=========="
echo " Fetching "
echo "=========="
fetch
cd "$srcdir"
echo "=========="
echo " Building "
echo "=========="
build
cd "$CWD"
fakeroot "$0"
else
echo "=========="
echo " Bundling "
echo "=========="
make_dir "$pkgdir"
make_dir "$outdir"
cd "$srcdir"
pkgdir="$pkgdir" package
cd "$srcdir"
install -d "$pkgdir/usr/share/iglupkg"
pkgmetafile="$pkgdir/usr/share/iglupkg/$pkgname"
genmeta > "$pkgmetafile"
tar -I zstd -cf "$pkgfile" *
fi