diff --git a/Makefile b/Makefile index 3556c3f..d588330 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ DOCKER_TAG?=$(subst master,stable,$(subst refs/heads/,,$(shell git symbolic-ref DOCKER_IMAGE?=iohubdev/antos ARCH?=amd64 -VERSION?=2.0.0-b +VERSION?=2.1.0-b RUSTUP_HOME?=/opt/rust CARGO_HOME?=/opt/rust/cargo @@ -44,6 +44,10 @@ all: antos tar.gz antos: antd backend frontend cp $(ROOT_DIR)/README.md $(INSTALL_DIR)/htdocs/os + touch $(INSTALL_DIR)/htdocs/os/packages/.DENIED + touch $(INSTALL_DIR)/htdocs/os/libs/.DENIED + touch $(INSTALL_DIR)/htdocs/os/controllers/.DENIED + scripts/version.sh $(INSTALL_DIR)/htdocs/os/libs antd: httpd plugins luasec luasocket silk luafcgi rm $(INSTALL_DIR)/runner.ini diff --git a/antd/silk b/antd/silk index 14e20cf..824769d 160000 --- a/antd/silk +++ b/antd/silk @@ -1 +1 @@ -Subproject commit 14e20cf41e64ef548fd02d50949bf649490ef5c0 +Subproject commit 824769dee2e89ef75b0c59e91d5ede5f2c815213 diff --git a/antos-backend b/antos-backend index 37f68f0..ac36ba6 160000 --- a/antos-backend +++ b/antos-backend @@ -1 +1 @@ -Subproject commit 37f68f0e04aadf3e829eab7e6a6fe569e2e3032a +Subproject commit ac36ba6ff0e870bc773a2664afee1c631c46cad1 diff --git a/antos-frontend b/antos-frontend index f4ac0d6..04da2a9 160000 --- a/antos-frontend +++ b/antos-frontend @@ -1 +1 @@ -Subproject commit f4ac0d639d85f7631251539b79028bdc2f768b6d +Subproject commit 04da2a9d39bd210ae8405b52094684384d422cae diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100755 index 0000000..c51a815 --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,140 @@ +#! /bin/bash +get_version_lua_socket() { + file=$1 + dir=$(dirname "$(realpath "$file")") + line=$(grep -e "^## \[.*" "$file" | head -1) + ref=$(cd "$dir" && git rev-parse --short HEAD ) + regex="##\s+\[\s*v([0-9\.]+)\s*\].*" + name="luasocket" + if [[ $line =~ $regex ]]; then + version="${BASH_REMATCH[1]}" + echo " Project name: $name VERSION: $version REF: $ref" + cat << EOF >> /tmp/versions.json + "$name": + { + "version": "$version", + "ref": "$ref" + }, +EOF + else + echo "Unable to find version on $file" + exit 1 + fi +} + +get_version_lua_sec() { + file=$1 + dir=$(dirname "$(realpath "$file")") + line=$(grep -e "^LuaSec" $file | head -1) + ref=$(cd "$dir" && git rev-parse --short HEAD ) + regex="LuaSec\s+([0-9\.]+).*" + name="luasec" + if [[ $line =~ $regex ]]; then + version="${BASH_REMATCH[1]}" + echo " Project name: $name VERSION: $version REF: $ref" + cat << EOF >> /tmp/versions.json + "$name": + { + "version": "$version", + "ref": "$ref" + }, +EOF + else + echo "Unable to find version on $file" + exit 1 + fi +} + +get_version_rust() { + file=$1 + dir=$(dirname "$(realpath "$file")") + line=$(grep -e "^version\s*=.*" "$file") + ref=$(cd "$dir" && git rev-parse --short HEAD ) + regex="\s*version\s*=\s*\"([^\"]*)\".*" + if [[ $line =~ $regex ]]; then + version="${BASH_REMATCH[1]}" + else + echo "Unable to find version on $file" + exit 1 + fi + line=$(grep -e "^name\s*=.*" "$file") + regex="\s*name\s*=\s*\"([^\"]*)\".*" + if [[ $line =~ $regex ]]; then + name="${BASH_REMATCH[1]}" + else + echo "Unable to find name on $file" + exit 1 + fi + echo " Project name: $name VERSION: $version REF: $ref" + cat << EOF >> /tmp/versions.json + "$name": + { + "version": "$version", + "ref": "$ref" + }, +EOF +} + +get_version_autotool() { + file=$1 + dir=$(dirname "$(realpath "$file")") + line="$(grep "AC_INIT" "$file")" + regex="\s*AC_INIT\s*\(\s*\[\s*([a-zA-Z0-9_\-]*)\s*\]\s*,\s*\[\s*([a-zA-Z0-9\._\-]*).*" + if [[ $line =~ $regex ]]; then + name="${BASH_REMATCH[1]}" + version="${BASH_REMATCH[2]}" + ref=$(cd "$dir" && git rev-parse --short HEAD ) + echo " Project name: $name VERSION: $version REF: $ref" + cat << EOF >> /tmp/versions.json + "$name": + { + "version": "$version", + "ref": "$ref" + }, +EOF + else + echo "Unable to find version on $file" + exit 1 + fi +} + +get_version() { + dir=$1 + echo "getting version in $dir/configure.ac" + if [ -e "$dir/configure.ac" ]; then + get_version_autotool "$dir/configure.ac" + return 0 + fi + if [ -e "$dir/Cargo.toml" ]; then + get_version_rust "$dir/Cargo.toml" + return 0 + fi + if [ "$dir" = "antd/luasec" ]; then + get_version_lua_sec "$dir/CHANGELOG" + return 0 + fi + if [ "$dir" = "antd/luasocket" ]; then + get_version_lua_socket "$dir/CHANGELOG.md" + return 0 + fi + echo "Unknown version for project $dir" + exit 1 +} + +DESTDIR=$1 + +if [ -z "$DESTDIR" ]; then + echo "Please specify DESTDIR as parameter" + exit 1 +fi +mkdir -p "$DESTDIR" + +echo "{" > /tmp/versions.json + +for prj in antd/* ; do + get_version "$prj" +done +sed -i '$ s/.$//' /tmp/versions.json +echo "}" >> /tmp/versions.json +install -m 0644 /tmp/versions.json "$DESTDIR" +echo "DONE" \ No newline at end of file