Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Ahnaf Tahmid Chowdhury | c48a6a8636 | |
Ahnaf Tahmid Chowdhury | cf300a6944 | |
Ahnaf Tahmid | 5b7ee5e26a | |
Ahnaf Tahmid | 200b0f1c1b | |
Ahnaf Tahmid | ae401eae3d | |
Ahnaf Tahmid | 0f369d3322 | |
Ahnaf Tahmid | 93d31026d4 |
|
@ -40,7 +40,3 @@ Contributions are welcome.
|
|||
## License
|
||||
|
||||
This project is licensed under the MIT License.
|
||||
|
||||
## Author
|
||||
|
||||
Ahnaf Tahmid Chowdhury
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ConfigConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "config"
|
|
@ -0,0 +1,3 @@
|
|||
from django.db import models
|
||||
|
||||
# Create your models here.
|
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -4,133 +4,150 @@ import time
|
|||
|
||||
|
||||
def get_subscribers_list():
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \r\n\r")
|
||||
t.write(b"show subscribers all \r\n\r")
|
||||
try:
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \r\n\r")
|
||||
t.write(b"show subscribers all \r\n\r")
|
||||
|
||||
time.sleep(0.01)
|
||||
read = t.read_very_eager()
|
||||
subscribers = read.rsplit(b"NAM")[1].split(b"\r\n")[2:-4]
|
||||
subscribers = [subscriber.decode().split() for subscriber in subscribers]
|
||||
t.close()
|
||||
return subscribers
|
||||
time.sleep(0.01)
|
||||
read = t.read_very_eager()
|
||||
subscribers = read.rsplit(b"NAM")[1].split(b"\r\n")[2:-4]
|
||||
subscribers = [subscriber.decode().split() for subscriber in subscribers]
|
||||
t.close()
|
||||
return subscribers
|
||||
except:
|
||||
return []
|
||||
|
||||
|
||||
def get_subscribers_last_seen():
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \r\n\r")
|
||||
t.write(b"show subscribers last-seen \r\n\r")
|
||||
time.sleep(0.01)
|
||||
read = t.read_very_eager()
|
||||
subscribers = read.rsplit(b"NAM")[1].split(b"\r\n")[2:-4]
|
||||
subscribers = [subscriber.decode().split() for subscriber in subscribers]
|
||||
t.close()
|
||||
return subscribers
|
||||
try:
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \r\n\r")
|
||||
t.write(b"show subscribers last-seen \r\n\r")
|
||||
time.sleep(0.01)
|
||||
read = t.read_very_eager()
|
||||
subscribers = read.rsplit(b"NAM")[1].split(b"\r\n")[2:-4]
|
||||
subscribers = [subscriber.decode().split() for subscriber in subscribers]
|
||||
t.close()
|
||||
return subscribers
|
||||
except:
|
||||
return []
|
||||
|
||||
|
||||
def add_subscriber(imsi, msisdn):
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \r\n\r")
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" create \r\n\r")
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update msisdn " +
|
||||
msisdn.encode() + b" \r\n\r")
|
||||
time.sleep(0.1)
|
||||
read = t.read_very_eager()
|
||||
t.close()
|
||||
if read.find(b"Subscriber already exists") != -1:
|
||||
return {"status": "error", "message": "Subscriber already exists"}
|
||||
if read.find(b"Not a valid IMSI") != -1:
|
||||
return {"status": "error", "message": "Not a valid IMSI"}
|
||||
if read.find(b"MSISDN invalid") != -1:
|
||||
return {"status": "error", "message": "MSISDN invalid"}
|
||||
return {
|
||||
"status": "success",
|
||||
"message": "Subscriber added for imsi " + imsi
|
||||
}
|
||||
try:
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \r\n\r")
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" create \r\n\r")
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update msisdn " +
|
||||
msisdn.encode() + b" \r\n\r")
|
||||
time.sleep(0.1)
|
||||
read = t.read_very_eager()
|
||||
t.close()
|
||||
if read.find(b"Subscriber already exists") != -1:
|
||||
return {"status": "error", "message": "Subscriber already exists"}
|
||||
if read.find(b"Not a valid IMSI") != -1:
|
||||
return {"status": "error", "message": "Not a valid IMSI"}
|
||||
if read.find(b"MSISDN invalid") != -1:
|
||||
return {"status": "error", "message": "MSISDN invalid"}
|
||||
return {
|
||||
"status": "success",
|
||||
"message": "Subscriber added for imsi " + imsi
|
||||
}
|
||||
except:
|
||||
return {"status": "error", "message": "Could not connect to OsmoHLR"}
|
||||
|
||||
|
||||
def remove_subscriber(imsi):
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \r\n\r")
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" delete \r\n\r")
|
||||
time.sleep(0.1)
|
||||
read = t.read_very_eager()
|
||||
t.close()
|
||||
if read.find(b"Subscriber does not exist") != -1:
|
||||
return {"status": "error", "message": "Subscriber does not exist"}
|
||||
return {
|
||||
"status": "success",
|
||||
"message": "Subscriber removed for imsi " + imsi
|
||||
}
|
||||
try:
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \r\n\r")
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" delete \r\n\r")
|
||||
time.sleep(0.1)
|
||||
read = t.read_very_eager()
|
||||
t.close()
|
||||
if read.find(b"Subscriber does not exist") != -1:
|
||||
return {"status": "error", "message": "Subscriber does not exist"}
|
||||
return {
|
||||
"status": "success",
|
||||
"message": "Subscriber removed for imsi " + imsi
|
||||
}
|
||||
except:
|
||||
return {"status": "error", "message": "Could not connect to OsmoHLR"}
|
||||
|
||||
|
||||
def get_subscriber_info(imsi):
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \r\n\r")
|
||||
t.write(b"show subscriber imsi " + imsi.encode() + b"\n")
|
||||
time.sleep(0.1)
|
||||
read = (t.read_very_eager().split(b"subscriber imsi " +
|
||||
imsi.encode())[1].split(b"\r\n")[1:-1])
|
||||
subscriber_info = [
|
||||
subscriber.decode().replace(": ", "=").replace(" ", "").replace(
|
||||
"(", "=").replace(")", "").split("=") for subscriber in read
|
||||
]
|
||||
t.close()
|
||||
return subscriber_info
|
||||
try:
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \r\n\r")
|
||||
t.write(b"show subscriber imsi " + imsi.encode() + b"\n")
|
||||
time.sleep(0.1)
|
||||
read = (t.read_very_eager().split(b"subscriber imsi " +
|
||||
imsi.encode())[1].split(b"\r\n")[1:-1])
|
||||
subscriber_info = [
|
||||
subscriber.decode().replace(": ", "=").replace(" ", "").replace(
|
||||
"(", "=").replace(")", "").split("=") for subscriber in read
|
||||
]
|
||||
t.close()
|
||||
return subscriber_info
|
||||
except:
|
||||
return []
|
||||
|
||||
|
||||
def update_subscriber_info(imsi, msisdn, imei, aud2g, ki, aud3g, k, op, opc):
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \n")
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update msisdn " +
|
||||
msisdn.encode() + b" \n")
|
||||
if imei == "":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update imei none \n")
|
||||
else:
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update imei " +
|
||||
imei.encode() + b"\n")
|
||||
if aud2g == "none":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud2g none \n")
|
||||
elif ki == "":
|
||||
return {"status": "error", "message": "KI is required"}
|
||||
else:
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud2g " +
|
||||
aud2g.encode() + b" ki " + ki.encode() + b"\n")
|
||||
if aud3g == "none":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud3g none \n")
|
||||
elif k == "":
|
||||
return {"status": "error", "message": "K is required"}
|
||||
elif aud3g == "xor":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud3g " +
|
||||
aud3g.encode() + b" k " + k.encode() + b"\n")
|
||||
elif op == "":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud3g " +
|
||||
aud3g.encode() + b" k " + k.encode() + b" opc " +
|
||||
opc.encode() + b"\n")
|
||||
elif opc == "":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud3g " +
|
||||
aud3g.encode() + b" k " + k.encode() + b" op " + op.encode() +
|
||||
b"\n")
|
||||
else:
|
||||
return {"status": "error", "message": "OP or OPC is required"}
|
||||
time.sleep(0.1)
|
||||
read = t.read_very_eager()
|
||||
print(read.decode())
|
||||
if read.find(b"MSISDN invalid") != -1:
|
||||
return {"status": "error", "message": "MSISDN invalid"}
|
||||
if read.find(b"IMEI invalid") != -1:
|
||||
return {"status": "error", "message": "IMEI invalid"}
|
||||
if read.find(b"Invalid value for KI") != -1:
|
||||
return {"status": "error", "message": "Invalid value for KI"}
|
||||
if read.find(b"Invalid value for K") != -1:
|
||||
return {"status": "error", "message": "Invalid value for K"}
|
||||
if read.find(b"cannot set 3G auth data") != -1:
|
||||
return {"status": "error", "message": "cannot set 3G auth data"}
|
||||
if read.find(b"cannot set 2G auth data") != -1:
|
||||
return {"status": "error", "message": "cannot set 2G auth data"}
|
||||
if read.find(b"Invalid value for OP") != -1:
|
||||
return {"status": "error", "message": "Invalid value for OP"}
|
||||
if read.find(b"Invalid value for OPC") != -1:
|
||||
return {"status": "error", "message": "Invalid value for OPC"}
|
||||
t.close()
|
||||
return {"status": "success", "message": "Subscriber updated"}
|
||||
try:
|
||||
t = telnetlib.Telnet("localhost", 4258)
|
||||
t.write(b"enable \n")
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update msisdn " +
|
||||
msisdn.encode() + b" \n")
|
||||
if imei == "":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update imei none \n")
|
||||
else:
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update imei " +
|
||||
imei.encode() + b"\n")
|
||||
if aud2g == "none":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud2g none \n")
|
||||
elif ki == "":
|
||||
return {"status": "error", "message": "KI is required"}
|
||||
else:
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud2g " +
|
||||
aud2g.encode() + b" ki " + ki.encode() + b"\n")
|
||||
if aud3g == "none":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud3g none \n")
|
||||
elif k == "":
|
||||
return {"status": "error", "message": "K is required"}
|
||||
elif aud3g == "xor":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud3g " +
|
||||
aud3g.encode() + b" k " + k.encode() + b"\n")
|
||||
elif op == "":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud3g " +
|
||||
aud3g.encode() + b" k " + k.encode() + b" opc " +
|
||||
opc.encode() + b"\n")
|
||||
elif opc == "":
|
||||
t.write(b"subscriber imsi " + imsi.encode() + b" update aud3g " +
|
||||
aud3g.encode() + b" k " + k.encode() + b" op " + op.encode() +
|
||||
b"\n")
|
||||
else:
|
||||
return {"status": "error", "message": "OP or OPC is required"}
|
||||
time.sleep(0.1)
|
||||
read = t.read_very_eager()
|
||||
if read.find(b"MSISDN invalid") != -1:
|
||||
return {"status": "error", "message": "MSISDN invalid"}
|
||||
if read.find(b"IMEI invalid") != -1:
|
||||
return {"status": "error", "message": "IMEI invalid"}
|
||||
if read.find(b"Invalid value for KI") != -1:
|
||||
return {"status": "error", "message": "Invalid value for KI"}
|
||||
if read.find(b"Invalid value for K") != -1:
|
||||
return {"status": "error", "message": "Invalid value for K"}
|
||||
if read.find(b"cannot set 3G auth data") != -1:
|
||||
return {"status": "error", "message": "cannot set 3G auth data"}
|
||||
if read.find(b"cannot set 2G auth data") != -1:
|
||||
return {"status": "error", "message": "cannot set 2G auth data"}
|
||||
if read.find(b"Invalid value for OP") != -1:
|
||||
return {"status": "error", "message": "Invalid value for OP"}
|
||||
if read.find(b"Invalid value for OPC") != -1:
|
||||
return {"status": "error", "message": "Invalid value for OPC"}
|
||||
t.close()
|
||||
return {"status": "success", "message": "Subscriber updated"}
|
||||
except:
|
||||
return {"status": "error", "message": "Could not connect to OsmoHLR"}
|
||||
|
|
82
install.sh
82
install.sh
|
@ -2,8 +2,7 @@
|
|||
|
||||
arguments=$@
|
||||
|
||||
unknown_os ()
|
||||
{
|
||||
unknown_os() {
|
||||
echo "Unfortunately, your operating system distribution and version are not supported by this script."
|
||||
echo
|
||||
echo "You can override the OS detection by setting os= and dist= prior to running this script."
|
||||
|
@ -13,9 +12,8 @@ unknown_os ()
|
|||
exit 1
|
||||
}
|
||||
|
||||
detect_os ()
|
||||
{
|
||||
if [[ ( -z "${os}" ) && ( -z "${dist}" ) ]]; then
|
||||
detect_os() {
|
||||
if [[ (-z "${os}") && (-z "${dist}") ]]; then
|
||||
# some systems dont have lsb-release yet have the lsb_release binary and
|
||||
# vice-versa
|
||||
if [ -e /etc/lsb-release ]; then
|
||||
|
@ -23,7 +21,7 @@ detect_os ()
|
|||
|
||||
if [ "${ID}" = "raspbian" ]; then
|
||||
os=${ID}
|
||||
dist=`cut --delimiter='.' -f1 /etc/debian_version`
|
||||
dist=$(cut --delimiter='.' -f1 /etc/debian_version)
|
||||
else
|
||||
os=${DISTRIB_ID}
|
||||
dist=${DISTRIB_CODENAME}
|
||||
|
@ -33,18 +31,18 @@ detect_os ()
|
|||
fi
|
||||
fi
|
||||
|
||||
elif [ `which lsb_release 2>/dev/null` ]; then
|
||||
dist=`lsb_release -c | cut -f2`
|
||||
os=`lsb_release -i | cut -f2 | awk '{ print tolower($1) }'`
|
||||
elif [ $(which lsb_release 2>/dev/null) ]; then
|
||||
dist=$(lsb_release -c | cut -f2)
|
||||
os=$(lsb_release -i | cut -f2 | awk '{ print tolower($1) }')
|
||||
|
||||
elif [ -e /etc/debian_version ]; then
|
||||
# some Debians have jessie/sid in their /etc/debian_version
|
||||
# while others have '6.0.7'
|
||||
os=`cat /etc/issue | head -1 | awk '{ print tolower($1) }'`
|
||||
os=$(cat /etc/issue | head -1 | awk '{ print tolower($1) }')
|
||||
if grep -q '/' /etc/debian_version; then
|
||||
dist=`cut --delimiter='/' -f1 /etc/debian_version`
|
||||
dist=$(cut --delimiter='/' -f1 /etc/debian_version)
|
||||
else
|
||||
dist=`cut --delimiter='.' -f1 /etc/debian_version`
|
||||
dist=$(cut --delimiter='.' -f1 /etc/debian_version)
|
||||
fi
|
||||
|
||||
else
|
||||
|
@ -57,13 +55,13 @@ detect_os ()
|
|||
fi
|
||||
|
||||
# remove whitespace from OS and dist name
|
||||
os="${os// /}"
|
||||
os="${os// /}"
|
||||
dist="${dist// /}"
|
||||
|
||||
echo "Detected operating system as $os/$dist."
|
||||
}
|
||||
|
||||
detect_version_id () {
|
||||
detect_version_id() {
|
||||
# detect version_id and round down float to integer
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
|
@ -77,34 +75,34 @@ detect_version_id () {
|
|||
|
||||
echo "Detected version id as $version_id"
|
||||
}
|
||||
set_working_dir ()
|
||||
{
|
||||
set_working_dir() {
|
||||
working_dir="$(cd -P "$(dirname -- "${BASH_SOURCE}")" >/dev/null 2>&1 && pwd)"
|
||||
|
||||
echo "Working dir is $working_dir"
|
||||
echo
|
||||
}
|
||||
|
||||
get_sudo_password ()
|
||||
{
|
||||
get_sudo_password() {
|
||||
# Ask for the administrator password upfront
|
||||
sudo -v
|
||||
|
||||
# Keep-alive: update existing sudo time stamp until the script has finished
|
||||
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
|
||||
while true; do
|
||||
sudo -n true
|
||||
sleep 60
|
||||
kill -0 "$$" || exit
|
||||
done 2>/dev/null &
|
||||
}
|
||||
|
||||
setup_dependencies ()
|
||||
{
|
||||
setup_dependencies() {
|
||||
echo
|
||||
echo "Installing dependencies..."
|
||||
if [ "${os,,}" = "arch" ]; then
|
||||
sudo pacman -S --noconfirm --needed build-essential libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev python3-venv libgirepository1.0-dev
|
||||
sudo pacman -S --noconfirm --needed base-devel libxml2 cairo libxslt curl lib32-libcurl-compat python-virtualenv gobject-introspection
|
||||
elif [ "${os,,}" = "centos" ] || [ "${os,,}" = "rhel" ]; then
|
||||
sudo yum -y -q install epel-release
|
||||
sudo yum -y -q install build-essential libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev python3-venv libgirepository1.0-dev
|
||||
sudo dnf install -y gcc gcc-c++ make libxml2-devel cairo-devel libxslt-devel libcurl-devel libicu-devel python3-venv gobject-introspection-devel
|
||||
elif [ "${os,,}" = "debian" ] || [ "${os,,}" = "ubuntu" ]; then
|
||||
sudo apt-get -y install build-essential libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev python3-venv libgirepository1.0-dev
|
||||
sudo apt-get -y install build-essential libxml2-dev libcairo2-dev libxslt-dev libcurl4-openssl-dev libicu-dev python3-venv libgirepository1.0-dev
|
||||
else
|
||||
echo "Dependencies cannot be installed on ${os}"
|
||||
exit 1
|
||||
|
@ -112,7 +110,7 @@ setup_dependencies ()
|
|||
echo
|
||||
}
|
||||
|
||||
setup_python_env () {
|
||||
setup_python_env() {
|
||||
echo
|
||||
if [ -d "${working_dir}/.env" ]; then
|
||||
echo "Virtual environment already exists. Deleting..."
|
||||
|
@ -125,16 +123,16 @@ setup_python_env () {
|
|||
echo "Python virtual env created."
|
||||
}
|
||||
|
||||
setup_dependencies_no_gui () {
|
||||
setup_dependencies_no_gui() {
|
||||
echo
|
||||
echo "Installing dependencies..."
|
||||
if [ "${os,,}" = "arch" ]; then
|
||||
sudo pacman -S --noconfirm --needed python3-venv
|
||||
elif [ "${os,,}" = "centos" ] || [ "${os,,}" = "rhel" ]; then
|
||||
sudo yum -y -q install epel-release
|
||||
sudo yum -y -q install python3-venv
|
||||
sudo yum -y -q install python3-venv
|
||||
elif [ "${os,,}" = "debian" ] || [ "${os,,}" = "ubuntu" ]; then
|
||||
sudo apt-get -y -qq install python3-venv
|
||||
sudo apt-get -y -qq install python3-venv
|
||||
else
|
||||
echo "Dependencies cannot be installed on ${os}"
|
||||
exit 1
|
||||
|
@ -142,7 +140,7 @@ setup_dependencies_no_gui () {
|
|||
echo
|
||||
}
|
||||
|
||||
setup_python_env_no_gui () {
|
||||
setup_python_env_no_gui() {
|
||||
echo
|
||||
if [ -d "${working_dir}/.env" ]; then
|
||||
echo "Virtual environment already exists. Deleting..."
|
||||
|
@ -155,15 +153,14 @@ setup_python_env_no_gui () {
|
|||
echo "Python virtual env created."
|
||||
}
|
||||
|
||||
create_desktop_file ()
|
||||
{
|
||||
create_desktop_file() {
|
||||
echo
|
||||
if [ -f "/usr/share/applications/osmo-gui.desktop" ]; then
|
||||
echo "Desktop file already exists. Deleting..."
|
||||
sudo rm -f "/usr/share/applications/osmo-gui.desktop"
|
||||
fi
|
||||
echo "Creating desktop file..."
|
||||
sudo cat > $working_dir/osmo-gui.desktop << EOF
|
||||
sudo cat >$working_dir/osmo-gui.desktop <<EOF
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Name=Osmocom
|
||||
|
@ -171,7 +168,7 @@ Comment=Open source mobile communications
|
|||
Exec=${working_dir}/osmo-gui
|
||||
Icon=${working_dir}/static/images/osmocom_icon.png
|
||||
Type=Application
|
||||
Categories=Development;HamRadio;Science;
|
||||
Categories=HamRadio;Science;
|
||||
Keywords=SDR;Radio;HAM;RF;
|
||||
MimeType=application/gnuradio-grc;
|
||||
Terminal=false
|
||||
|
@ -183,14 +180,13 @@ EOF
|
|||
echo "Desktop file created."
|
||||
}
|
||||
|
||||
create_program_file ()
|
||||
{
|
||||
create_program_file() {
|
||||
echo
|
||||
echo "Creating program..."
|
||||
if [ -f "${working_dir}/osmo-gui" ]; then
|
||||
rm "${working_dir}/osmo-gui"
|
||||
fi
|
||||
cat > ${working_dir}/osmo-gui << EOF
|
||||
cat >${working_dir}/osmo-gui <<EOF
|
||||
#!${working_dir}/.env/bin/python3
|
||||
import webview
|
||||
import subprocess
|
||||
|
@ -218,20 +214,18 @@ EOF
|
|||
echo "osmo-gui created."
|
||||
}
|
||||
|
||||
create_shortcut ()
|
||||
{
|
||||
create_shortcut() {
|
||||
echo "Creating shortcut..."
|
||||
if [ -f "/usr/bin/osmo-gui" ]; then
|
||||
echo "Shortcut already exists. Deleting..."
|
||||
sudo rm -rf "/usr/bin/osmo-gui"
|
||||
sudo rm -rf "/usr/bin/osmo-gui"
|
||||
echo "Creating new shortcut..."
|
||||
fi
|
||||
sudo ln -s ${working_dir}/osmo-gui /usr/bin/osmo-gui
|
||||
echo "Shortcut created."
|
||||
}
|
||||
|
||||
main ()
|
||||
{
|
||||
main() {
|
||||
detect_os
|
||||
detect_version_id
|
||||
set_working_dir
|
||||
|
@ -243,7 +237,7 @@ main ()
|
|||
echo "Press enter to continue or ctrl+c to exit."
|
||||
read -r
|
||||
get_sudo_password
|
||||
if [ $arguments = "--no-gui" ] > /dev/null 2>&1; then
|
||||
if [ $arguments = "--no-gui" ] >/dev/null 2>&1; then
|
||||
echo "Installing without GUI..."
|
||||
setup_dependencies_no_gui
|
||||
echo "-----------------------------------------------------"
|
||||
|
@ -279,4 +273,4 @@ main ()
|
|||
fi
|
||||
|
||||
}
|
||||
main
|
||||
main
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
asgiref==3.5.2
|
||||
Django==4.1
|
||||
gobject==0.1.0
|
||||
proxy-tools==0.1.0
|
||||
pycairo==1.21.0
|
||||
PyGObject==3.42.2
|
||||
PyQt5==5.15.7
|
||||
PyQt5-Qt5==5.15.2
|
||||
PyQt5-sip==12.11.0
|
||||
PyQtWebEngine==5.15.6
|
||||
PyQtWebEngine-Qt5==5.15.2
|
||||
pywebview==3.6.3
|
||||
sqlparse==0.4.2
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Name=Osmocom
|
||||
Comment=Open source mobile communications
|
||||
Exec=osmocom
|
||||
Icon=${SNAP}/meta/gui/osmocom.png
|
||||
Type=Application
|
||||
Categories=HamRadio;Science;
|
||||
Keywords=SDR;Radio;HAM;RF;
|
||||
MimeType=application/gnuradio-grc;
|
||||
Terminal=false
|
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
|
@ -0,0 +1,24 @@
|
|||
#!/snap/osmocom/current/bin/python3
|
||||
|
||||
import webview
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
django = subprocess.Popen(
|
||||
["/snap/osmocom/current/bin/python3",
|
||||
"/snap/osmocom/current/osmo-gui/manage.py",
|
||||
"runserver", "127.0.0.1:8900"], )
|
||||
time.sleep(0.5)
|
||||
webview.create_window(
|
||||
"Osmocom",
|
||||
"http://localhost:8900/hlr/",
|
||||
text_select= True,
|
||||
width=1366,
|
||||
height=768,
|
||||
min_size=(800, 600)
|
||||
)
|
||||
webview.start()
|
||||
django.terminate()
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
|
@ -0,0 +1,73 @@
|
|||
name: osmocom
|
||||
version: 1.0.0
|
||||
summary: A graphical user interface for the Osmocom project
|
||||
description: |
|
||||
This is the graphical user interface for the Osmocom project.
|
||||
This program is developed with Django framework.
|
||||
It is a web application that allows to manage the Osmocom network.
|
||||
However, it is not a complete web application.
|
||||
confinement: devmode
|
||||
base: core22
|
||||
grade: stable
|
||||
|
||||
parts:
|
||||
osmocom:
|
||||
plugin: python
|
||||
source: .
|
||||
|
||||
build-packages:
|
||||
- gcc # GNU Compiler Collection
|
||||
- pkg-config # manage compile and link flags for libraries
|
||||
- python3-dev # header files and a static library for Python (default)
|
||||
- build-essential # Informational list of build-essential packages
|
||||
- libxml2-dev # Development files for the GNOME XML library
|
||||
- libcurl4-openssl-dev # Development files and documentation for libcurl (OpenSSL flavour)
|
||||
- libicu-dev # Development files for International Components for Unicode
|
||||
|
||||
stage-packages:
|
||||
- gir1.2-gtk-3.0 # GTK+ graphical user interface library (runtime files)
|
||||
- gir1.2-webkit2-4.0 # WebKitGTK+ Web content engine library (runtime files)
|
||||
- gobject-introspection # Generate interface introspection data for GObject libraries
|
||||
- xapp # Xfce Application Library
|
||||
- libcanberra-gtk3-module # GTK+ 3.0 module for playing event sounds
|
||||
- libgl1-mesa-dri # free implementation of the OpenGL API -- DRI modules
|
||||
- libgl1-mesa-glx # free implementation of the OpenGL API -- GLX runtime
|
||||
- glib-networking # Network-related giomodules for GLib
|
||||
|
||||
python-packages:
|
||||
- django # The Web framework for perfectionists with deadlines.
|
||||
- pywebview # A lightweight cross-platform native wrapper around a webview component
|
||||
- pycairo # Python bindings for the cairo graphics library
|
||||
- pygobject # Python bindings for GObject
|
||||
|
||||
override-build: |
|
||||
mkdir -p $SNAPCRAFT_PART_INSTALL/osmo-gui
|
||||
cp -r * $SNAPCRAFT_PART_INSTALL/osmo-gui
|
||||
mv $SNAPCRAFT_PART_INSTALL/osmo-gui/snap/local/run-program $SNAPCRAFT_PART_INSTALL/run-program
|
||||
chmod +x $SNAPCRAFT_PART_INSTALL/run-program
|
||||
rm -rf $SNAPCRAFT_PART_INSTALL/osmo-gui/snap
|
||||
rm -rf $SNAPCRAFT_PART_INSTALL/osmo-gui/snapcraft.yaml
|
||||
rm -rf $SNAPCRAFT_PART_INSTALL/osmo-gui/.git
|
||||
rm -rf $SNAPCRAFT_PART_INSTALL/osmo-gui/.gitignore
|
||||
snapcraftctl build
|
||||
|
||||
layout:
|
||||
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0:
|
||||
bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0
|
||||
/usr/lib/dri:
|
||||
bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri
|
||||
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gio/modules:
|
||||
bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gio/modules
|
||||
/usr/share/glib-2.0/schemas:
|
||||
bind: $SNAP/usr/share/glib-2.0/schemas
|
||||
|
||||
apps:
|
||||
osmocom:
|
||||
command: run-program
|
||||
plugs: [network, x11, desktop, unity7, gsettings]
|
||||
environment:
|
||||
GI_TYPELIB_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/girepository-1.0
|
||||
GTK_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gtk-3.0
|
||||
GTK_EXE_PREFIX: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET
|
||||
GTK_DATA_PREFIX: $SNAP/usr/share
|
||||
LC_ALL: C.UTF-8
|
Loading…
Reference in New Issue