diff --git a/repo/.gitignore b/repo/.gitignore index fd572dc..c3607c0 100644 --- a/repo/.gitignore +++ b/repo/.gitignore @@ -1,3 +1,2 @@ *.pkg.tar.gz -index.yaml -*.key \ No newline at end of file +index \ No newline at end of file diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh index 44a5d65..83e7c73 100755 --- a/repo/entrypoint.sh +++ b/repo/entrypoint.sh @@ -8,4 +8,4 @@ done cd /repo ./mkindex.sh -curl -s http://piston_api:6969/repos -XPOST -d "slug=local&url=file:///repo/index.yaml" || echo "WARNING: Could not add repository" +python3 -m http.server \ No newline at end of file diff --git a/repo/mkindex.sh b/repo/mkindex.sh index a38caf6..c3c72a0 100755 --- a/repo/mkindex.sh +++ b/repo/mkindex.sh @@ -1,26 +1,22 @@ -echo "schema: ppman-repo-1" > index.yaml -echo "baseurl: file://$PWD" >> index.yaml -echo "keys: []" >> index.yaml -echo "packages: []" >> index.yaml +BASEURL=http://piston_fs_repo:8000/ -#yq -yi '.keys[0] = "0x107DA02C7AE97B084746564B9F1FD9D87950DB6F"' index.yaml +i=0 -i=-1 +echo "" > index for pkg in $(find ../packages -type f -name "*.pkg.tar.gz") do - ((i=i+1)) + cp $pkg . + PKGFILE=$(basename $pkg) PKGFILENAME=$(echo $PKGFILE | sed 's/\.pkg\.tar\.gz//g') + PKGNAME=$(echo $PKGFILENAME | grep -oP '^\K.+(?=-)') PKGVERSION=$(echo $PKGFILENAME | grep -oP '^.+-\K.+') - BUILDFILE=https://github.com/engineer-man/piston/tree/v3/packages/ - SIZE=$(tar tzvf $PKGFILE | sed 's/ \+/ /g' | cut -f3 -d' ' | sed '2,$s/^/+ /' | paste -sd' ' | bc) + PKGCHECKSUM=$(sha256sum $PKGFILE | awk '{print $1}') - tar xzf $PKGFILE pkg-info.json - - yq -yi ".packages[$i] = {} | .packages[$i].signature = \"\" | .packages[$i].buildfile = \"$BUILDFILE\" | .packages[$i].size = $SIZE | .packages[$i].download = \"$PKGFILE\" | .packages[$i].dependencies = $(jq .dependencies -r pkg-info.json) | .packages[$i].author = $(jq .author pkg-info.json) | .packages[$i].language =\"$PKGNAME\" | .packages[$i].version = \"$PKGVERSION\" | .packages[$i].checksums = {} | .packages[$i].checksums.sha256 = \"$(sha256sum $PKGFILE | awk '{print $1}')\"" index.yaml + echo "$PKGNAME,$PKGVERSION,$PKGCHECKSUM,$BASEURL$PKGFILE" >> index - rm pkg-info.json + ((i=i+1)) done \ No newline at end of file