Skip to content

Commit

Permalink
Merge branch 'jb44449_systemd_sandboxing' into 'master'
Browse files Browse the repository at this point in the history
Systemd sandboxing and connection sharing fixes

See merge request mer-core/usb-moded!56
  • Loading branch information
spiiroin committed Jan 29, 2020
2 parents dc3798b + 149dd17 commit 7347c35
Show file tree
Hide file tree
Showing 56 changed files with 2,161 additions and 1,378 deletions.
53 changes: 51 additions & 2 deletions Makefile.custom
Expand Up @@ -42,11 +42,17 @@ TARGETS_ALL += $(TARGETS_PLUGIN) $(TARGETS_SBIN) $(TARGETS_BIN)

TARGETS_ALL += udev-search

TARGETS_ALL += usb_moded.pc

# ----------------------------------------------------------------------------
# Top level targets
# ----------------------------------------------------------------------------

.PHONY: build install clean distclean mostlyclean
.PHONY: all doc build install clean distclean mostlyclean

all:: build

doc::

build:: $(TARGETS_ALL)

Expand Down Expand Up @@ -106,6 +112,7 @@ CPPFLAGS += -DCONNMAN
CPPFLAGS += -DAPP_SYNC
CPPFLAGS += -DUSE_MER_SSU
CPPFLAGS += -DMEEGOLOCK
CPPFLAGS += -DSAILFISH_ACCESS_CONTROL
CPPFLAGS += -DDEBUG

# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -143,6 +150,7 @@ PKG_NAMES += libkmod
PKG_NAMES += libsystemd
PKG_NAMES += ssu-sysinfo
PKG_NAMES += dsme
PKG_NAMES += sailfishaccesscontrol

maintenance = normalize clean distclean mostlyclean
maintenance += protos-post
Expand Down Expand Up @@ -195,6 +203,13 @@ usb_moded-OBJS += src/usb_moded-worker.o
usb_moded : $(usb_moded-OBJS)
$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)

# ----------------------------------------------------------------------------
# usb-moded-devel
# ----------------------------------------------------------------------------

usb_moded.pc: usb_moded.pc.in
sed -e 's:@VERSION@:$(VERSION):g' > $@ $<

# ----------------------------------------------------------------------------
# udev-search
# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -327,7 +342,6 @@ PROTO_CPPFLAGS += -DMEEGOLOCK
PROTO_CPPFLAGS += -DOFONO
PROTO_CPPFLAGS += -DSYSTEMD
PROTO_CPPFLAGS += -DUSE_MER_SSU
PROTO_CPPFLAGS += -DCONNMAN_WORKS_BETTER=1
PROTO_CPPFLAGS += -DVERBOSE_WAKELOCKING=1

%.q : CPPFLAGS += $(PROTO_CPPFLAGS)
Expand All @@ -347,6 +361,25 @@ protos-post: $(patsubst %.c,%.p,$(ALL_SOURCES)) $(patsubst %.c,%.g,$(ALL_SOURCES
clean::
$(RM) protos-pre protos-post

# ----------------------------------------------------------------------------
# AUTOMATIC CALL GRAPHS
# ----------------------------------------------------------------------------

%.png : %.dot
dot -Tpng $< -o $@

CALLGRAPH_OPTIONS += -b modesetting_enter_dynamic_mode
CALLGRAPH_OPTIONS += -b modesetting_leave_dynamic_mode

flow.dot: $(wildcard src/*c)
callgraph.py > $@ $(CALLGRAPH_OPTIONS) $(CPPFLAGS) $^

mostlyclean::
$(RM) flow.dot

clean::
$(RM) flow.png

# ----------------------------------------------------------------------------
# REMOVE FLUFF LEFT BY MB2 BUILDS
# ----------------------------------------------------------------------------
Expand All @@ -369,3 +402,19 @@ include_trim_sources: $(patsubst %,%.trim,$(ALL_SOURCES))

distclean::
$(RM) *.trim */*.trim

# ----------------------------------------------------------------------------
# BUILD DOXYGEN DOCS
# ----------------------------------------------------------------------------

doc:: doxygen-build

doxygen-build: docs/usb_moded-doxygen.conf
cd docs && doxygen usb_moded-doxygen.conf 1>doxygen.out # stdout=noise

docs/usb_moded-doxygen.conf : docs/usb_moded-doxygen.conf.in
# no change required, use .in as is
install -m444 $< $@

clean::
rm -rf docs/html docs/usb_moded-doxygen.conf docs/doxygen.out
4 changes: 2 additions & 2 deletions docs/Makefile.am
Expand Up @@ -3,8 +3,8 @@ all: doc

doc:
rm -rf html/
doxygen usb_moded-doxygen.conf
doxygen usb_moded-doxygen.conf 1>doxygen.out # stdout=noise

clean-local:
-rm -rf html/
-rm -rf html/ doxygen.out

48 changes: 13 additions & 35 deletions rpm/usb-moded.spec
Expand Up @@ -2,7 +2,6 @@ Name: usb-moded
Version: 0.86.0+mer39
Release: 2
Summary: USB mode controller
Group: System/System Control
License: LGPLv2
URL: https://git.merproject.org/mer-core/usb-moded
Source0: %{name}-%{version}.tar.bz2
Expand Down Expand Up @@ -37,7 +36,6 @@ system bus.

%package devel
Summary: USB mode controller - development files
Group: Development/Libraries

%description devel
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -49,7 +47,6 @@ This package contains the files needed to program for usb_moded.

%package doc
Summary: USB mode controller - documentation
Group: Documentation

%description doc
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -61,7 +58,6 @@ This package contains the documentation.

%package developer-mode
Summary: USB mode controller - developer mode config
Group: Config

%description developer-mode
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -74,7 +70,6 @@ usb networking.

%package mtp-mode
Summary: USB mode controller - mtp mode config
Group: Config
Requires: buteo-mtp-qt5

%description mtp-mode
Expand All @@ -87,7 +82,6 @@ This package contains the mtp mode config.

%package mass-storage-mode
Summary: USB mode controller - mass-storage mode config
Group: Config

%description mass-storage-mode
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -99,7 +93,6 @@ This package contains the mass-storage mode config.

%package adb-mode
Summary: USB mode controller - android adb mode config
Group: Config

%description adb-mode
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -112,7 +105,6 @@ gadget driver.

%package diag-mode-android
Summary: USB mode controller - android diag mode config
Group: Config

%description diag-mode-android
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -125,7 +117,6 @@ gadget driver.

%package diag-mode-androidv5-qcom
Summary: USB mode controller - android v5 or newer diag mode config for qcom
Group: Config

%description diag-mode-androidv5-qcom
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -136,10 +127,8 @@ system bus.
This package contains the diag config for use with the android
gadget driver.


%package acm-mode-android
Summary: USB mode controller - android acm mode config
Group: Config

%description acm-mode-android
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -152,7 +141,6 @@ gadget driver.

%package developer-mode-android
Summary: USB mode controller - android developer mode config
Group: Config

%description developer-mode-android
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -165,7 +153,6 @@ the android gadget. This will provide usb networking.

%package mtp-mode-android
Summary: USB mode controller - android mtp mode config
Group: Config

%description mtp-mode-android
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -177,7 +164,6 @@ This package contains the mtp mode config.

%package mtp-mode-android-ffs
Summary: USB mode controller - droid mtp mode config
Group: Config

%description mtp-mode-android-ffs
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -191,7 +177,6 @@ via ffs.

%package pc-suite-mode-android
Summary: USB mode controller - android pc suite mode config
Group: Config

%description pc-suite-mode-android
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -203,7 +188,6 @@ This package contains the android pc suite mode config.

%package at-mode-android
Summary: USB mode controller - android at modem mode config
Group: Config

%description at-mode-android
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -215,20 +199,18 @@ This package contains the android at modem port mode config.

%package host-mode-jolla
Summary: USB mode controller - host mode switch for Jolla
Group: Config

%description host-mode-jolla
Usb_moded is a daemon to control the USB states. For this
it loads unloads the relevant usb gadget modules, keeps track
of the filesystem(s) and notifies about changes on the DBUS
system bus.

This package contains the config to switch the first Jolla phone
This package contains the config to switch the first Jolla phone
in host mode.

%package defaults
Summary: USB mode controller - default configuration
Group: Config
Summary: USB mode controller - default configuration
Provides: usb-moded-configs
Requires: usb-moded-developer-mode

Expand All @@ -238,8 +220,7 @@ basic functionality is provided (i.e. usb networking, ask and charging
modes)

%package defaults-android
Summary: USB mode controller - default configuration
Group: Config
Summary: USB mode controller - default configuration
Provides: usb-moded-configs
Requires: usb-moded-developer-mode-android

Expand All @@ -250,15 +231,13 @@ modes with the android gadget driver)

%package diagnostics-config
Summary: USB mode controller - config data for diagnostics mode
Group: Config

%description diagnostics-config
This package contains the diagnostics info needed to configure a
diagnotic mode

%package connection-sharing-android-config
Summary: USB mode controller - USB/cellular data connection sharing config
Group: Config

%description connection-sharing-android-config
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -271,7 +250,6 @@ connection over the USB with the android gadget driver.

%package connection-sharing-android-connman-config
Summary: USB mode controller - USB/cellular data connection sharing config
Group: Config

%description connection-sharing-android-connman-config
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -284,7 +262,6 @@ connection over the USB with the connman gadget driver.

%package mass-storage-android-config
Summary: USB mode controller - mass-storage config with android gadget
Group: Config

%description mass-storage-android-config
Usb_moded is a daemon to control the USB states. For this
Expand All @@ -297,7 +274,6 @@ with the android gadget driver.

%package vfat-android-config
Summary: USB mode controller - vfat config with tojblockd
Group: Config
Requires: tojblockd

%description vfat-android-config
Expand All @@ -311,15 +287,14 @@ emulation with tojblockd and nbd.

%package systemd-rescue-mode
Summary: USB mode controller - systemd rescue mode support
Group: Config

%Description systemd-rescue-mode
Usb_moded is a daemon to control the USB states. For this
it loads unloads the relevant usb gadget modules, keeps track
of the filesystem(s) and notifies about changes on the DBUS
system bus.

This package contains the configuration files for systemd to
This package contains the configuration files for systemd to
provide the rescue mode, so device does not get locked down
when the UI fails.

Expand All @@ -339,11 +314,14 @@ install -m 644 -D src/usb_moded-appsync-dbus.h %{buildroot}/%{_includedir}/%{nam
install -m 644 -D src/com.meego.usb_moded.xml %{buildroot}/%{_includedir}/%{name}/com.meego.usb_moded.xml
install -m 644 -D usb_moded.pc %{buildroot}/%{_libdir}/pkgconfig/usb_moded.pc
install -d %{buildroot}/%{_docdir}/%{name}-%{version}/html/
install -m 644 docs/html/* %{buildroot}/%{_docdir}/%{name}-%{version}/html/
if [ -f docs/html/index.html ]; then
install -m 644 docs/html/* %{buildroot}/%{_docdir}/%{name}-%{version}/html/
fi
install -m 644 docs/usb_moded-doc.txt %{buildroot}/%{_docdir}/%{name}-%{version}/
install -m 644 -D debian/manpage.1 %{buildroot}/%{_mandir}/man1/usb-moded.1
install -m 644 -D debian/usb_moded.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/usb_moded.conf
install -m 644 -D %{SOURCE1} %{buildroot}/%{_sysconfdir}/modprobe.d/usb_moded.conf
install -d %{buildroot}/%{_sysconfdir}
install -d %{buildroot}/%{_sysconfdir}/usb-moded
install -d %{buildroot}/%{_sysconfdir}/usb-moded/run
install -d %{buildroot}/%{_sysconfdir}/usb-moded/run-diag
Expand All @@ -356,9 +334,9 @@ install -m 644 -D config/run-diag/* %{buildroot}/%{_sysconfdir}/usb-moded/run-di
install -m 644 -D config/mass-storage-jolla.ini %{buildroot}/%{_sysconfdir}/usb-moded/
install -d %{buildroot}/%{_sharedstatedir}/usb-moded

ln -sf /run/usb-moded/udhcpd.conf %{buildroot}/%{_sysconfdir}/udhcpd.conf

touch %{buildroot}/%{_sysconfdir}/modprobe.d/g_ether.conf
touch %{buildroot}/%{_sysconfdir}/udhcpd.conf
#systemd stuff
install -d $RPM_BUILD_ROOT/lib/systemd/system/basic.target.wants/
install -m 644 -D systemd/%{name}.service %{buildroot}/lib/systemd/system/%{name}.service
Expand All @@ -385,16 +363,16 @@ systemctl daemon-reload || :
%dir %{_sysconfdir}/usb-moded
%dir %{_sysconfdir}/usb-moded/dyn-modes
%dir %{_sysconfdir}/usb-moded/run
%config %{_sysconfdir}/dbus-1/system.d/usb_moded.conf
%config %{_sysconfdir}/modprobe.d/usb_moded.conf
%{_sysconfdir}/udhcpd.conf
%{_sysconfdir}/dbus-1/system.d/usb_moded.conf
%{_sysconfdir}/modprobe.d/usb_moded.conf
%ghost %config %{_sysconfdir}/modprobe.d/g_ether.conf
%ghost %{_sysconfdir}/udhcpd.conf
%ghost %{_sysconfdir}/usb-moded/usb-moded.ini
%{_sbindir}/usb_moded
%{_sbindir}/usb_moded_util
/lib/systemd/system/%{name}.service
/lib/systemd/system/basic.target.wants/%{name}.service
%config %{_sysconfdir}/tmpfiles.d/usb-moded.conf
%{_sysconfdir}/tmpfiles.d/usb-moded.conf
%dir %{_sharedstatedir}/usb-moded
%ghost %{_sharedstatedir}/usb-moded/usb-moded.ini

Expand Down

0 comments on commit 7347c35

Please sign in to comment.