Fix deploy on debian. Bump version.

This commit is contained in:
Manuel Amador (Rudd-O) 2018-11-18 09:08:23 +00:00
parent 922e3180f3
commit e25b341d7c
3 changed files with 17 additions and 12 deletions

View File

@ -3,7 +3,7 @@
%define mybuildnumber %{?build_number}%{?!build_number:1}
Name: qubes-network-server
Version: 0.0.8
Version: 0.0.9
Release: %{mybuildnumber}%{?dist}
Summary: Turn your Qubes OS into a network server
BuildArch: noarch

View File

@ -430,7 +430,7 @@ class QubesVm(OriginalQubesVm):
%s
EOF
chmod +x "$tmp"
"$tmp" deploy
"$tmp" deploy 2>&1
"""
) % open(appvm_firewall_path).read()

View File

@ -7,8 +7,9 @@ import shutil
import subprocess
import sys
UNITPATH = "/usr/lib/systemd/system/qubes-appvm-firewall.service"
DEPPATH = "/run/fortress/qubes-appvm-firewall"
NAME = "qubes-appvm-firewall"
UNITDIRS = ["/usr/lib/systemd/system", "/lib/systemd/system"]
DEPDIR = "/run/fortress"
KEY = '/qubes-fortress-iptables-rules'
CHAIN = 'FORTRESS-INPUT'
@ -161,10 +162,11 @@ class Table(object):
return t
def deploy():
if not os.path.isdir(os.path.dirname(DEPPATH)):
os.makedirs(os.path.dirname(DEPPATH))
shutil.copyfile(__file__, DEPPATH)
os.chmod(DEPPATH, 0755)
deppath = os.path.join(DEPDIR, NAME)
if not os.path.isdir(DEPDIR):
os.makedirs(DEPDIR)
shutil.copyfile(__file__, deppath)
os.chmod(deppath, 0755)
service = '''[Unit]
Description=Qubes AppVM firewall updater
After=qubes-iptables.service qubes-firewall.service
@ -173,11 +175,14 @@ Before=qubes-network.service network.target
[Service]
Type=simple
ExecStart=%s main
''' % DEPPATH
if not os.path.isfile(UNITPATH) or open(UNITPATH, "rb").read() != service:
open(UNITPATH, "wb").write(service)
''' % deppath
for unitdir in UNITDIRS:
if os.path.isdir(unitdir): break
unitpath = os.path.join(unitdir, NAME + ".service")
if not os.path.isfile(unitpath) or open(unitpath, "rb").read() != service:
open(unitpath, "wb").write(service)
subprocess.check_call(['systemctl', '--system', 'daemon-reload'])
subprocess.check_call(['systemctl', 'restart', os.path.basename(UNITPATH)])
subprocess.check_call(['systemctl', 'restart', os.path.basename(unitpath)])
def main():