diff --git a/configs/meson.build b/configs/meson.build index a3f976afa..ba0a9a6af 100644 --- a/configs/meson.build +++ b/configs/meson.build @@ -50,11 +50,6 @@ foreach file : example_conf configuration : conf_data) endforeach -configure_file( - input : '../misc/dbconf.sh', - output : 'open5gs_db', - configuration : conf_data) - subdir('open5gs') subdir('freeDiameter') subdir('systemd') diff --git a/debian/open5gs-common.install b/debian/open5gs-common.install index 31606586c..ad6df1a6d 100644 --- a/debian/open5gs-common.install +++ b/debian/open5gs-common.install @@ -3,3 +3,4 @@ usr/lib/*/libfd*.so* usr/lib/*/freeDiameter/*.fdx configs/freeDiameter/cacert.pem /etc/freeDiameter configs/logrotate/open5gs /etc/logrotate.d +misc/db/open5gs-dbctl diff --git a/debian/open5gs-hss.install b/debian/open5gs-hss.install index cc3cb2803..100258889 100644 --- a/debian/open5gs-hss.install +++ b/debian/open5gs-hss.install @@ -2,4 +2,3 @@ usr/bin/open5gs-hssd configs/freeDiameter/hss.* etc/freeDiameter configs/open5gs/hss.yaml etc/open5gs configs/systemd/open5gs-hssd.service lib/systemd/system -configs/open5gs_db /usr/bin \ No newline at end of file diff --git a/meson.build b/meson.build index a0168d501..3c5e978e5 100644 --- a/meson.build +++ b/meson.build @@ -111,6 +111,7 @@ add_project_arguments( subdir('configs') subdir('lib') subdir('src') +subdir('misc') # Don’t build the tests unless we can run them (either natively or in an exe wrapper) build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper()) if build_tests diff --git a/misc/README.md b/misc/README.md index eeed98533..52ad22856 100644 --- a/misc/README.md +++ b/misc/README.md @@ -2,8 +2,5 @@ * Network Configuration $ sudo ./misc/netconf.sh -* Add/Update/Remove A User -$ ./misc/dbconf.sh - * Generate Key & Cert for Diameter $ ./misc/make_certs.sh ./freeDiameter diff --git a/misc/db/README.md b/misc/db/README.md new file mode 100644 index 000000000..e67967777 --- /dev/null +++ b/misc/db/README.md @@ -0,0 +1,2 @@ +* Add/Update/Remove A User +$ ./misc/db/open5gs-dbctl diff --git a/misc/db/meson.build b/misc/db/meson.build new file mode 100644 index 000000000..dedde1e71 --- /dev/null +++ b/misc/db/meson.build @@ -0,0 +1,27 @@ +# Copyright (C) 2019 by Sukchan Lee + +# This file is part of Open5GS. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +misc_db = ''' + open5gs-dbctl +'''.split() + +foreach file : misc_db + configure_file( + input : file, + output : file, + configuration : conf_data) +endforeach diff --git a/misc/dbconf.sh b/misc/db/open5gs-dbctl similarity index 85% rename from misc/dbconf.sh rename to misc/db/open5gs-dbctl index 8c0c445c8..98be3cdb6 100755 --- a/misc/dbconf.sh +++ b/misc/db/open5gs-dbctl @@ -3,7 +3,7 @@ version=0.9.0 display_help() { - echo "dbconf.sh: Open5GS Database Configuration Tool ($version)" + echo "open5gs-dbctl: Open5GS Database Configuration Tool ($version)" echo "COMMANDS:" >&2 echo " add {imsi key opc}: adds a user to the database with default values" echo " remove {imsi}: removes a user from the database" @@ -46,13 +46,13 @@ if [ "$1" = "add" ]; then exit 0 fi - echo "dbconf.sh: incorrect number of args, format is \"dbconf.sh add imsi key opc\"" + echo "open5gs-dbctl: incorrect number of args, format is \"open5gs-dbctl add imsi key opc\"" exit 1 fi if [ "$1" = "remove" ]; then if [ "$#" -ne 2 ]; then - echo "dbconf.sh: incorrect number of args, format is \"dbconf.sh remove imsi\"" + echo "open5gs-dbctl: incorrect number of args, format is \"open5gs-dbctl remove imsi\"" exit 1 fi @@ -63,7 +63,7 @@ fi if [ "$1" = "reset" ]; then if [ "$#" -ne 1 ]; then - echo "dbconf.sh: incorrect number of args, format is \"dbconf.sh reset\"" + echo "open5gs-dbctl: incorrect number of args, format is \"open5gs-dbctl reset\"" exit 1 fi @@ -73,7 +73,7 @@ fi if [ "$1" = "static_ip" ]; then if [ "$#" -ne 3 ]; then - echo "dbconf.sh: incorrect number of args, format is \"dbconf.sh static_ip imsi ip\"" + echo "open5gs-dbctl: incorrect number of args, format is \"open5gs-dbctl static_ip imsi ip\"" exit 1 fi IMSI=$2 @@ -85,7 +85,7 @@ fi if [ "$1" = "static_ip6" ]; then if [ "$#" -ne 3 ]; then - echo "dbconf.sh: incorrect number of args, format is \"dbconf.sh static_ip6 imsi ip\"" + echo "open5gs-dbctl: incorrect number of args, format is \"open5gs-dbctl static_ip6 imsi ip\"" exit 1 fi IMSI=$2 @@ -97,7 +97,7 @@ fi if [ "$1" = "type" ]; then if [ "$#" -ne 3 ]; then - echo "dbconf.sh: incorrect number of args, format is \"dbconf.sh type imsi type\"" + echo "open5gs-dbctl: incorrect number of args, format is \"open5gs-dbctl type imsi type\"" exit 1 fi IMSI=$2 diff --git a/misc/mongodb/python/Open5GS.py b/misc/db/python/Open5GS.py similarity index 100% rename from misc/mongodb/python/Open5GS.py rename to misc/db/python/Open5GS.py diff --git a/misc/mongodb/python/README.md b/misc/db/python/README.md similarity index 100% rename from misc/mongodb/python/README.md rename to misc/db/python/README.md diff --git a/misc/meson.build b/misc/meson.build new file mode 100644 index 000000000..43c5e1de5 --- /dev/null +++ b/misc/meson.build @@ -0,0 +1,31 @@ +# Copyright (C) 2019 by Sukchan Lee + +# This file is part of Open5GS. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +conf_data = configuration_data() + +conf_data.set('bindir', bindir) +conf_data.set('sysconfdir', sysconfdir) +conf_data.set('libdir', libdir) +conf_data.set('localstatedir', localstatedir) + +if host_system == 'linux' + conf_data.set('loopback_devname', 'lo') +else + conf_data.set('loopback_devname', 'lo0') +endif + +subdir('db')