Merge remote-tracking branch 'qubesos/pr/157'

* qubesos/pr/157:
  qubes-updates-proxy: make ShellCheck happy
  Use exec to ease systemd handling the tinyproxy process
  Handle tinyproxy path changed in upstream
This commit is contained in:
Marek Marczykowski-Górecki 2019-04-19 04:27:00 +02:00
commit 0aae0c189c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
6 changed files with 21 additions and 7 deletions

View File

@ -315,6 +315,7 @@ install-common: install-doc
install -D -m 0644 misc/marker-vm $(DESTDIR)/usr/share/qubes/marker-vm install -D -m 0644 misc/marker-vm $(DESTDIR)/usr/share/qubes/marker-vm
cut -f 1,2 -d . version >> $(DESTDIR)/usr/share/qubes/marker-vm cut -f 1,2 -d . version >> $(DESTDIR)/usr/share/qubes/marker-vm
install -m 0755 misc/tinyproxy-wrapper $(DESTDIR)/usr/lib/qubes/tinyproxy-wrapper
install -d $(DESTDIR)/var/run/qubes install -d $(DESTDIR)/var/run/qubes
install -d $(DESTDIR)/rw install -d $(DESTDIR)/rw

View File

@ -136,6 +136,7 @@ usr/lib/qubes/upgrades-installed-check
usr/lib/qubes/upgrades-status-notify usr/lib/qubes/upgrades-status-notify
usr/lib/qubes/vm-file-editor usr/lib/qubes/vm-file-editor
usr/lib/qubes/xdg-icon usr/lib/qubes/xdg-icon
usr/lib/qubes/tinyproxy-wrapper
usr/lib/systemd/user/pulseaudio.service.d/30_qubes.conf usr/lib/systemd/user/pulseaudio.service.d/30_qubes.conf
usr/lib/systemd/user/pulseaudio.socket.d/30_qubes.conf usr/lib/systemd/user/pulseaudio.socket.d/30_qubes.conf
usr/share/glib-2.0/schemas/* usr/share/glib-2.0/schemas/*

12
misc/tinyproxy-wrapper Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
if [ -e /usr/sbin/tinyproxy ]; then
echo "Found tinyproxy at /usr/sbin/tinyproxy"
exec /usr/sbin/tinyproxy "$@"
elif [ -e /usr/bin/tinyproxy ]; then
echo "Found tinyproxy at /usr/bin/tinyproxy"
exec /usr/bin/tinyproxy "$@"
else
echo "tinyproxy not found"
exit 1
fi

View File

@ -645,6 +645,7 @@ rm -f %{name}-%{version}
/usr/lib/qubes/upgrades-status-notify /usr/lib/qubes/upgrades-status-notify
/usr/lib/qubes/qubes-sync-clock /usr/lib/qubes/qubes-sync-clock
/usr/lib/qubes/resize-rootfs /usr/lib/qubes/resize-rootfs
/usr/lib/qubes/tinyproxy-wrapper
/usr/lib/yum-plugins/yum-qubes-hooks.py* /usr/lib/yum-plugins/yum-qubes-hooks.py*
/usr/lib/dracut/dracut.conf.d/30-qubes.conf /usr/lib/dracut/dracut.conf.d/30-qubes.conf
%dir /usr/lib/qubes/init %dir /usr/lib/qubes/init

View File

@ -28,8 +28,8 @@
# Check that networking is up. # Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0 [ "$NETWORKING" = "no" ] && exit 0
exec="/usr/sbin/tinyproxy" exec="$(command -v tinyproxy)"
prog=$(basename $exec) prog=$(basename "$exec")
config="/etc/tinyproxy/tinyproxy-updates.conf" config="/etc/tinyproxy/tinyproxy-updates.conf"
pidfile="/var/run/tinyproxy-updates/tinyproxy.pid" pidfile="/var/run/tinyproxy-updates/tinyproxy.pid"
@ -46,14 +46,14 @@ start() {
exit 0 exit 0
fi fi
[ -x $exec ] || exit 5 [ -x "$exec" ] || exit 5
[ -f $config ] || exit 6 [ -f $config ] || exit 6
# setup network redirection # setup network redirection
/sbin/iptables -I INPUT -i vif+ -p tcp --dport 8082 -j ACCEPT /sbin/iptables -I INPUT -i vif+ -p tcp --dport 8082 -j ACCEPT
/sbin/iptables -t nat -A PR-QBS-SERVICES -i vif+ -d 10.137.255.254 -p tcp --dport 8082 -j REDIRECT /sbin/iptables -t nat -A PR-QBS-SERVICES -i vif+ -d 10.137.255.254 -p tcp --dport 8082 -j REDIRECT
echo -n $"Starting $prog (as Qubes updates proxy): " echo -n $"Starting $prog (as Qubes updates proxy): "
daemon $exec -c $config daemon "$exec" -c $config
retval=$? retval=$?
echo echo
[ $retval -eq 0 ] && touch $lockfile [ $retval -eq 0 ] && touch $lockfile

View File

@ -1,12 +1,11 @@
[Unit] [Unit]
Description=Qubes updates proxy (tinyproxy) Description=Qubes updates proxy (tinyproxy)
ConditionPathExists=|/var/run/qubes-service/qubes-yum-proxy
ConditionPathExists=|/var/run/qubes-service/qubes-updates-proxy ConditionPathExists=|/var/run/qubes-service/qubes-updates-proxy
After=qubes-iptables.service After=qubes-iptables.service
[Service] [Service]
ExecStartPre=/usr/lib/qubes/iptables-updates-proxy start ExecStartPre=/usr/lib/qubes/iptables-updates-proxy start
ExecStart=/usr/sbin/tinyproxy -d -c /etc/tinyproxy/tinyproxy-updates.conf ExecStart=/usr/lib/qubes/tinyproxy-wrapper -d -c /etc/tinyproxy/tinyproxy-updates.conf
ExecStopPost=/usr/lib/qubes/iptables-updates-proxy stop ExecStopPost=/usr/lib/qubes/iptables-updates-proxy stop
Restart=on-failure Restart=on-failure
RestartSec=5s RestartSec=5s