Inital packaging
This commit is contained in:
113
usr/share/alvr/alvr_fw_config.sh
Normal file
113
usr/share/alvr/alvr_fw_config.sh
Normal file
@@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env bash
|
||||
# Basic script to add / remove firewall configuration for ALVR
|
||||
# Usage: ./alvr_fw_config.sh add|remove
|
||||
# Exit codes:
|
||||
# 1 - Invalid command
|
||||
# 2 - Invalid action
|
||||
# 3 - Failed to copy UFW configuration
|
||||
# 99 - Firewall not found
|
||||
# 126 - pkexec failed - Request dismissed
|
||||
|
||||
firewalld_cfg() {
|
||||
# Iterate around each active zone
|
||||
for zone in $(firewall-cmd --get-active-zones | grep -P --only-matching '^[\w/-]+'); do
|
||||
if [ "${1}" == 'add' ]; then
|
||||
# If running or permanent alvr service is missing, add it
|
||||
if ! firewall-cmd --zone="${zone}" --list-services | grep 'alvr' >/dev/null 2>&1; then
|
||||
firewall-cmd --zone="${zone}" --add-service='alvr'
|
||||
fi
|
||||
if ! firewall-cmd --zone="${zone}" --list-services --permanent | grep 'alvr' >/dev/null 2>&1; then
|
||||
firewall-cmd --zone="${zone}" --add-service='alvr' --permanent
|
||||
fi
|
||||
elif [ "${1}" == 'remove' ]; then
|
||||
# If running or persistent alvr service exists, remove it
|
||||
if firewall-cmd --zone="${zone}" --list-services | grep 'alvr' >/dev/null 2>&1; then
|
||||
firewall-cmd --zone="${zone}" --remove-service='alvr'
|
||||
fi
|
||||
if firewall-cmd --zone="${zone}" --list-services --permanent | grep 'alvr' >/dev/null 2>&1; then
|
||||
firewall-cmd --zone="${zone}" --remove-service='alvr' --permanent
|
||||
fi
|
||||
else
|
||||
exit 2
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
ufw_cfg() {
|
||||
# Try and install the application file
|
||||
if ! ufw app info 'alvr'; then
|
||||
# Pull application file from local build first if the script lives inside it
|
||||
if [ -f "$(dirname "$(realpath "${0}")")/ufw-alvr" ]; then
|
||||
cp "$(dirname "$(realpath "${0}")")/ufw-alvr" '/etc/ufw/applications.d/'
|
||||
elif [ -f '/usr/share/alvr/ufw-alvr' ]; then
|
||||
cp '/usr/share/alvr/ufw-alvr' '/etc/ufw/applications.d/'
|
||||
else
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${1}" == 'add' ] && ! ufw status | grep 'alvr' >/dev/null 2>&1; then
|
||||
ufw allow 'alvr'
|
||||
elif [ "${1}" == 'remove' ] && ufw status | grep 'alvr' >/dev/null 2>&1; then
|
||||
ufw delete allow 'alvr'
|
||||
else
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
iptables_cfg() {
|
||||
first_port_match_count=$(iptables -S | grep -c '9943')
|
||||
second_port_match_count=$(iptables -S | grep -c '9944')
|
||||
if [ "${1}" == 'add' ]; then
|
||||
if [ "$first_port_match_count" == "0" ] || [ "$second_port_match_count" == "0" ]; then
|
||||
if [ ! -d '/etc/iptables' ]; then
|
||||
mkdir '/etc/iptables'
|
||||
fi
|
||||
|
||||
iptables -I OUTPUT -p tcp --sport 9943 -j ACCEPT
|
||||
iptables -I INPUT -p tcp --dport 9943 -j ACCEPT
|
||||
iptables -I OUTPUT -p udp --sport 9943 -j ACCEPT
|
||||
iptables -I INPUT -p udp --dport 9943 -j ACCEPT
|
||||
iptables -I OUTPUT -p tcp --sport 9944 -j ACCEPT
|
||||
iptables -I INPUT -p tcp --dport 9944 -j ACCEPT
|
||||
iptables -I OUTPUT -p udp --sport 9944 -j ACCEPT
|
||||
iptables -I INPUT -p udp --dport 9944 -j ACCEPT
|
||||
iptables-save >/etc/iptables/rules.v4
|
||||
fi
|
||||
elif [ "${1}" == 'remove' ]; then
|
||||
if [ "$first_port_match_count" == "4" ] || [ "$second_port_match_count" == "4" ]; then
|
||||
iptables -D OUTPUT -p tcp --sport 9943 -j ACCEPT
|
||||
iptables -D INPUT -p tcp --dport 9943 -j ACCEPT
|
||||
iptables -D OUTPUT -p udp --sport 9943 -j ACCEPT
|
||||
iptables -D INPUT -p udp --dport 9943 -j ACCEPT
|
||||
iptables -D OUTPUT -p tcp --sport 9944 -j ACCEPT
|
||||
iptables -D INPUT -p tcp --dport 9944 -j ACCEPT
|
||||
iptables -D OUTPUT -p udp --sport 9944 -j ACCEPT
|
||||
iptables -D INPUT -p udp --dport 9944 -j ACCEPT
|
||||
iptables-save >/etc/iptables/rules.v4
|
||||
fi
|
||||
else
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
# If we're not root use pkexec for GUI prompt
|
||||
if [ "${USER}" == 'root' ]; then
|
||||
# Check if firewall-cmd exists and firewalld is running
|
||||
if which firewall-cmd >/dev/null 2>&1 && firewall-cmd --state >/dev/null 2>&1; then
|
||||
firewalld_cfg "${1,,}"
|
||||
# Check if ufw exists and is running
|
||||
elif which ufw >/dev/null 2>&1 && ! ufw status | grep 'Status: inactive' >/dev/null 2>&1; then
|
||||
ufw_cfg "${1,,}"
|
||||
elif which iptables >/dev/null 2>&1; then
|
||||
iptables_cfg "${1,,}"
|
||||
else
|
||||
exit 99
|
||||
fi
|
||||
else
|
||||
pkexec "$(realpath "${0}")" "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
main "${@}"
|
||||
11
usr/share/applications/alvr.desktop
Normal file
11
usr/share/applications/alvr.desktop
Normal file
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Name=ALVR
|
||||
GenericName=Game
|
||||
Comment=ALVR is an open source remote VR display which allows playing SteamVR games on a standalone headset such as Gear VR or Oculus Go/Quest.
|
||||
Exec=alvr_dashboard
|
||||
Icon=alvr
|
||||
Categories=Game;
|
||||
StartupNotify=true
|
||||
StartupWMClass=alvr.dashboard
|
||||
97
usr/share/icons/hicolor/scalable/apps/alvr.svg
Normal file
97
usr/share/icons/hicolor/scalable/apps/alvr.svg
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="934.25092"
|
||||
height="934.29956"
|
||||
viewBox="0 0 247.18722 247.20021"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
xml:space="preserve"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"><title
|
||||
id="title20">ALVR Logo</title><defs
|
||||
id="defs1"><linearGradient
|
||||
id="linearGradient20"><stop
|
||||
style="stop-color:#3ed2e3;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop19" /><stop
|
||||
style="stop-color:#279ed4;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop20" /></linearGradient><linearGradient
|
||||
id="linearGradient17"><stop
|
||||
style="stop-color:#3ed2e3;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop16" /><stop
|
||||
style="stop-color:#2192d1;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop17" /></linearGradient><linearGradient
|
||||
id="linearGradient5"><stop
|
||||
style="stop-color:#3ed2e3;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5" /><stop
|
||||
style="stop-color:#1d89cf;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop6" /></linearGradient><linearGradient
|
||||
xlink:href="#linearGradient5"
|
||||
id="linearGradient6"
|
||||
x1="307.78638"
|
||||
y1="144.12395"
|
||||
x2="554.95905"
|
||||
y2="144.12395"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(11.986501,-0.45167211)" /><linearGradient
|
||||
xlink:href="#linearGradient17"
|
||||
id="linearGradient15"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="307.78638"
|
||||
y1="144.12395"
|
||||
x2="554.95905"
|
||||
y2="144.12395"
|
||||
gradientTransform="matrix(0.73927686,0,0,0.73927686,124.45536,37.124776)" /><linearGradient
|
||||
xlink:href="#linearGradient20"
|
||||
id="linearGradient16"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.48821952,0,0,0.48821952,232.75465,73.308151)"
|
||||
x1="307.78638"
|
||||
y1="144.12395"
|
||||
x2="554.95905"
|
||||
y2="144.12395" /><clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath5"><path
|
||||
style="fill:none;fill-opacity:1;stroke-width:15.875;stroke-dasharray:none"
|
||||
d="m 339.01043,47.371294 48.90352,43.318594 -19.59953,44.325122 18.16699,46.9631 -45.21416,41.34902 2.16559,43.94798 223.52133,-0.006 0.006,-247.194152 -215.10728,0.144791 z"
|
||||
id="path6" /></clipPath></defs><metadata
|
||||
id="metadata1"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>ALVR Logo</dc:title><dc:date>01/12/24</dc:date><dc:creator><cc:Agent><dc:title>Issac Dowling</dc:title></cc:Agent></dc:creator><dc:publisher><cc:Agent><dc:title>ALVR</dc:title></cc:Agent></dc:publisher></cc:Work></rdf:RDF></metadata><rect
|
||||
style="display:inline;opacity:1;fill:#000000;fill-opacity:0;stroke:none;stroke-width:93.5937;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect20"
|
||||
height="285.82809"
|
||||
x="1.9722117"
|
||||
y="-18.865053"
|
||||
ry="0"
|
||||
width="243.39352" /><g
|
||||
id="g22"
|
||||
clip-path="url(#clipPath5)"
|
||||
style="display:inline"
|
||||
transform="translate(-319.77289,-20.074958)"><circle
|
||||
style="display:inline;opacity:1;fill:none;stroke:url(#linearGradient6);stroke-width:16.4055;stroke-dasharray:none"
|
||||
id="path5"
|
||||
cx="443.35922"
|
||||
cy="143.67227"
|
||||
r="115.38358" /><circle
|
||||
style="opacity:1;fill:none;stroke:url(#linearGradient15);stroke-width:15.875;stroke-dasharray:none"
|
||||
id="circle15"
|
||||
cx="443.35922"
|
||||
cy="143.67227"
|
||||
r="85.300415" /><circle
|
||||
style="opacity:1;fill:none;stroke:url(#linearGradient16);stroke-width:15.5123;stroke-dasharray:none"
|
||||
id="circle16"
|
||||
cx="443.35922"
|
||||
cy="143.67227"
|
||||
r="56.33252" /></g></svg>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
Reference in New Issue
Block a user