Skip to content

Commit

Permalink
Merge pull request #158 from microsoft/removextraargs
Browse files Browse the repository at this point in the history
Simplify running systemd services from development environment
  • Loading branch information
abeltrano authored Feb 21, 2024
2 parents fc3b95d + dfc421a commit 9bc57dc
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 11 deletions.
43 changes: 37 additions & 6 deletions src/linux/external/hostap/systemd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,56 @@

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/hostapd.example.conf
${CMAKE_CURRENT_BINARY_DIR}/hostapd.example.conf
${CMAKE_CURRENT_SOURCE_DIR}/hostapd-example.conf.in
${CMAKE_CURRENT_BINARY_DIR}/hostapd-example.conf
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/[email protected]
${CMAKE_CURRENT_BINARY_DIR}/[email protected]
${CMAKE_CURRENT_SOURCE_DIR}/[email protected]
${CMAKE_CURRENT_BINARY_DIR}/[email protected]
@ONLY
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/[email protected]
${CMAKE_CURRENT_BINARY_DIR}/[email protected]
@ONLY
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/[email protected]
${CMAKE_CURRENT_BINARY_DIR}/[email protected]
@ONLY
)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/hostapd.example.conf
${CMAKE_CURRENT_BINARY_DIR}/hostapd-example.conf
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/hostapd
COMPONENT hostapd
)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/[email protected]
${CMAKE_CURRENT_BINARY_DIR}/[email protected]
CONFIGURATIONS Release
DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/system
RENAME [email protected]
COMPONENT hostapd
)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/[email protected]
CONFIGURATIONS Debug RelWithDebInfo MinSizeRel
DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/system
RENAME [email protected]
COMPONENT hostapd
)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/[email protected]
CONFIGURATIONS Debug RelWithDebInfo MinSizeRel
DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/system
COMPONENT hostapd
)
13 changes: 13 additions & 0 deletions src/linux/external/hostap/systemd/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Hostapd Daemon
Requires=sys-subsystem-net-devices-%i.device hostapd-genconfig@%i.service
After=sys-subsystem-net-devices-%i.device hostapd-genconfig@%i.service
AssertPathExists=@CMAKE_INSTALL_FULL_SYSCONFDIR@/hostapd/hostapd-%i.conf

[Service]
Type=simple
Restart=on-failure
ExecStart=@CMAKE_INSTALL_FULL_SBINDIR@/hostapd -i %i @CMAKE_INSTALL_FULL_SYSCONFDIR@/hostapd/hostapd-%i.conf

[Install]
WantedBy=default.target
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
# To use this with the provided systemd service unit template [email protected],
# (eg. via 'systemctl enable hostapd@wlan0'), copy this file to
# /etc/hostapd/hostapd-<interface>.conf. For example, to use it with wlan0, copy this file to
# /etc/hostapd/hostapd-wlan0.conf.
#
# /etc/hostapd/hostapd-wlan0.conf and specify the desired SSID after the 'ssid' property below.
#

driver=nl80211
ctrl_interface=${CMAKE_INSTALL_FULL_RUNSTATEDIR}/hostapd
ssid=wificontrollertest
ssid=
hw_mode=g
channel=1
auth_algs=3
Expand Down
9 changes: 9 additions & 0 deletions src/linux/external/hostap/systemd/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Generate default hostapd configuration file
AssertPathExists=@CMAKE_INSTALL_FULL_SYSCONFDIR@/hostapd/hostapd-example.conf

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/bin/cp @CMAKE_INSTALL_FULL_SYSCONFDIR@/hostapd/hostapd-example.conf @CMAKE_INSTALL_FULL_SYSCONFDIR@/hostapd/hostapd-%i.conf
ExecStart=/usr/bin/sed -i 's/ssid=/ssid=%l-ap-%i/' @CMAKE_INSTALL_FULL_SYSCONFDIR@/hostapd/hostapd-%i.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
Description=Hostapd Daemon
Requires=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
AssertPathExists=@CMAKE_INSTALL_FULL_SYSCONFDIR@/hostapd/hostapd-%i.conf

[Service]
Type=simple
Restart=on-failure
ExecStart=@CMAKE_INSTALL_FULL_SBINDIR@/hostapd ${HOSTAPD_XTRA_ARGS} -i %i @CMAKE_INSTALL_FULL_SYSCONFDIR@/hostapd/hostapd-%i.conf
ExecStart=@CMAKE_INSTALL_FULL_SBINDIR@/hostapd -i %i @CMAKE_INSTALL_FULL_SYSCONFDIR@/hostapd/hostapd-%i.conf

[Install]
WantedBy=default.target
2 changes: 1 addition & 1 deletion src/linux/server/systemd/netremote-server.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ After=network-online.target
[Service]
Type=simple
Restart=on-failure
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/netremote-server ${NETREMOTE_SERVER_XTRA_ARGS}
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/netremote-server

[Install]
WantedBy=default.target

0 comments on commit 9bc57dc

Please sign in to comment.