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} %define mybuildnumber %{?build_number}%{?!build_number:1}
Name: qubes-network-server Name: qubes-network-server
Version: 0.0.8 Version: 0.0.9
Release: %{mybuildnumber}%{?dist} Release: %{mybuildnumber}%{?dist}
Summary: Turn your Qubes OS into a network server Summary: Turn your Qubes OS into a network server
BuildArch: noarch BuildArch: noarch

View File

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

View File

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