mirror of
https://github.com/antos-rde/antos.git
synced 2024-11-08 06:28:25 +01:00
feat: allow to query all components version in frontend + improve backend security
This commit is contained in:
parent
9b9a43f7f2
commit
5d9bae6172
6
Makefile
6
Makefile
@ -5,7 +5,7 @@ DOCKER_TAG?=$(subst master,stable,$(subst refs/heads/,,$(shell git symbolic-ref
|
|||||||
DOCKER_IMAGE?=iohubdev/antos
|
DOCKER_IMAGE?=iohubdev/antos
|
||||||
|
|
||||||
ARCH?=amd64
|
ARCH?=amd64
|
||||||
VERSION?=2.0.0-b
|
VERSION?=2.1.0-b
|
||||||
|
|
||||||
RUSTUP_HOME?=/opt/rust
|
RUSTUP_HOME?=/opt/rust
|
||||||
CARGO_HOME?=/opt/rust/cargo
|
CARGO_HOME?=/opt/rust/cargo
|
||||||
@ -44,6 +44,10 @@ all: antos tar.gz
|
|||||||
|
|
||||||
antos: antd backend frontend
|
antos: antd backend frontend
|
||||||
cp $(ROOT_DIR)/README.md $(INSTALL_DIR)/htdocs/os
|
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
|
antd: httpd plugins luasec luasocket silk luafcgi
|
||||||
rm $(INSTALL_DIR)/runner.ini
|
rm $(INSTALL_DIR)/runner.ini
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 14e20cf41e64ef548fd02d50949bf649490ef5c0
|
Subproject commit 824769dee2e89ef75b0c59e91d5ede5f2c815213
|
@ -1 +1 @@
|
|||||||
Subproject commit 37f68f0e04aadf3e829eab7e6a6fe569e2e3032a
|
Subproject commit ac36ba6ff0e870bc773a2664afee1c631c46cad1
|
@ -1 +1 @@
|
|||||||
Subproject commit f4ac0d639d85f7631251539b79028bdc2f768b6d
|
Subproject commit 04da2a9d39bd210ae8405b52094684384d422cae
|
140
scripts/version.sh
Executable file
140
scripts/version.sh
Executable file
@ -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"
|
Loading…
Reference in New Issue
Block a user