mirror of
https://github.com/vanilla-wiiu/vanilla.git
synced 2026-10-28 09:43:51 +00:00
implement optional polkit script
This commit is contained in:
1 parent
ca4c71b37e
commit
54efc5564a
8 files changed
+121
-53
No files matched your search
@@ -25,11 +25,6 @@ OPTION(VANILLA_BUILD_TESTS "Build unit tests for Vanilla" OFF)
|
||||
OPTION(VANILLA_BUILD_PIPE "Build vanilla-pipe for connecting to Wii U (Linux only)" ${LINUX})
|
||||
OPTION(VANILLA_BUILD_VENDORED "Build Vanilla with \"vendored\" third-party libraries" ${vendored_default})
|
||||
|
||||
if (LINUX)
|
||||
OPTION(VANILLA_INSTALL_POLKIT_TEMPLATE "Install Polkit action as a template for further installation later" OFF)
|
||||
OPTION(VANILLA_INSTALL_POLKIT_RULE "Install Polkit rule to allow vanilla-pipe as root without password" OFF)
|
||||
endif()
|
||||
|
||||
add_subdirectory(lib)
|
||||
if (VANILLA_BUILD_PIPE)
|
||||
add_subdirectory(pipe)
|
||||
|
||||
@@ -10,6 +10,16 @@ This is a **work-in-progress** software clone of the Wii U gamepad for Linux (in
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## What devices are supported?
|
||||
|
||||
- (Steam Deck)[https://github.com/vanilla-wiiu/vanilla/wiki/Linux-Setup-Guide]
|
||||
- (Nintendo Switch)[https://github.com/vanilla-wiiu/vanilla/wiki/Linux-Setup-Guide]
|
||||
- (Android)[https://github.com/vanilla-wiiu/vanilla/wiki/Android-Setup-Guide]
|
||||
- (Linux)[https://github.com/vanilla-wiiu/vanilla/wiki/Linux-Setup-Guide]
|
||||
- (Windows)[https://github.com/vanilla-wiiu/vanilla/wiki/Windows-Setup-Guide]
|
||||
- (Raspberry Pi)[https://github.com/vanilla-wiiu/vanilla/wiki/Linux-Setup-Guide]
|
||||
- *iOS* - Coming soon
|
||||
|
||||
## What Wi-Fi adapter should I use?
|
||||
|
||||
At a minimum, you will need an adapter that supports 802.11n 5GHz. Newer standards (e.g. 802.11ac) are backwards compatible and should work as long as they can run at 5GHz.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FROM debian:bookworm
|
||||
|
||||
ARG ARCH=amd64
|
||||
ARG ARCH=x86_64
|
||||
ENV ARCH=${ARCH}
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
@@ -8,7 +8,7 @@ ENV TZ=Etc/UTC
|
||||
|
||||
RUN if [ "${ARCH}" = "aarch64" ]; then export DEBARCH="arm64"; export DEBGCC="gcc-aarch64-linux-gnu"; \
|
||||
elif [ "${ARCH}" = "x86_64" ]; then export DEBARCH="amd64"; export DEBGCC="gcc"; \
|
||||
else export DEBARCH="${ARCH}"; fi \
|
||||
else export DEBARCH="${ARCH}"; export DEBGCC="gcc"; fi \
|
||||
&& dpkg --add-architecture $DEBARCH \
|
||||
&& apt -y update \
|
||||
&& apt -y install $DEBGCC ninja-build nasm git wget pkg-config make \
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "This tool will install Vanilla's files to /usr for system-wide usage."
|
||||
echo ""
|
||||
echo "Do you wish to install a polkit rule to allow vanilla-pipe to run as administrator without entering a password?"
|
||||
echo ""
|
||||
echo ""
|
||||
@@ -69,14 +69,6 @@ target_link_libraries(vanilla-pipe PRIVATE
|
||||
install(IMPORTED_RUNTIME_ARTIFACTS wpa_supplicant)
|
||||
|
||||
# Handle polkit files
|
||||
if (NOT VANILLA_INSTALL_POLKIT_TEMPLATE)
|
||||
set(PIPE_BIN ${CMAKE_INSTALL_PREFIX})
|
||||
configure_file("polkit/com.mattkc.vanilla.policy.in" "com.mattkc.vanilla.policy" @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/com.mattkc.vanilla.policy" DESTINATION "share/polkit-1/actions")
|
||||
else()
|
||||
install(FILES "polkit/com.mattkc.vanilla.policy.in" DESTINATION "share/polkit-1/actions")
|
||||
endif()
|
||||
|
||||
if (VANILLA_INSTALL_POLKIT_RULE)
|
||||
install(FILES "polkit/com.mattkc.vanilla.rules" DESTINATION "share/polkit-1/rules.d")
|
||||
if (LINUX)
|
||||
install(FILES "polkit/vanilla-polkit-install.sh" DESTINATION bin)
|
||||
endif()
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>MattKC</vendor>
|
||||
<vendor_url>https://mattkc.com</vendor_url>
|
||||
<action id="com.mattkc.vanilla">
|
||||
<description>Run Vanilla Pipe as root</description>
|
||||
<message>Authentication is required to run Vanilla Pipe as root</message>
|
||||
<defaults>
|
||||
<allow_any>auth_admin</allow_any>
|
||||
<allow_inactive>auth_admin</allow_inactive>
|
||||
<allow_active>auth_admin</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">@PIPE_BIN@</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
</policyconfig>
|
||||
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* Allow all users to run vanilla-pipe as root without having to enter a password
|
||||
*
|
||||
* This provides convenience, especially on platforms more suited for touch
|
||||
* controls, however it could be dangerous to allow a program unrestricted
|
||||
* administrator access, so it should be used with caution.
|
||||
*/
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (action.id == "com.mattkc.vanilla") {
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
});
|
||||
Executable
+107
@@ -0,0 +1,107 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then
|
||||
echo "$0 must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
echo "vanilla-pipe Polkit Install Script"
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
echo "This script will install a Polkit action and rule that will allow vanilla-pipe"
|
||||
echo "to run as root without entering a password."
|
||||
echo ""
|
||||
echo "This makes usage of Vanilla much more convenient, especially on touch-based"
|
||||
echo "devices such as the Nintendo Switch and Steam Deck, however THERE ARE INHERENT"
|
||||
echo "RISKS TO ALLOWING A PROGRAM TO RUN AS ROOT WITHOUT USER INTERVENTION. WE MAKE"
|
||||
echo "NO SAFETY GUARANTEES IF YOU CHOOSE TO CONTINUE WITH THIS PROCESS."
|
||||
echo ""
|
||||
read -p "If you understand the risks and wish to continue, type \"I agree\": " agree
|
||||
|
||||
if [ "${agree,,}" != "i agree" ]
|
||||
then
|
||||
echo "Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Continuing..."
|
||||
|
||||
while [ 1 ]
|
||||
do
|
||||
read -p "Enter the absolute path of vanilla-pipe (e.g. /usr/bin/vanilla-pipe): " path
|
||||
|
||||
if [ -z "${path}" ]
|
||||
then
|
||||
read -p "Do you wish to exit? [yn] " exit_confirm
|
||||
if [ "${exit_confirm,,}" = "y" ]
|
||||
then
|
||||
exit 1
|
||||
else
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "${path}" ]
|
||||
then
|
||||
echo "File \"${path}\" does not exist"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ ${path:0:1} != "/" ]
|
||||
then
|
||||
echo "Path \"${path}\" does not appear to be an absolute path"
|
||||
continue
|
||||
fi
|
||||
|
||||
read -p "vanilla-pipe will be located at \"$path\", is that correct? [yn] " confirm
|
||||
if [ "${confirm,,}" = "y" ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
POLKIT_ACTION_DST="/usr/share/polkit-1/actions/com.mattkc.vanilla.policy"
|
||||
POLKIT_RULE_DST="/usr/share/polkit-1/rules.d/com.mattkc.vanilla.rules"
|
||||
echo ""
|
||||
|
||||
POLICY_TEMPLATE='<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>MattKC</vendor>
|
||||
<vendor_url>https://mattkc.com</vendor_url>
|
||||
<action id="com.mattkc.vanilla">
|
||||
<description>Run Vanilla Pipe as root</description>
|
||||
<message>Authentication is required to run Vanilla Pipe as root</message>
|
||||
<defaults>
|
||||
<allow_any>auth_admin</allow_any>
|
||||
<allow_inactive>auth_admin</allow_inactive>
|
||||
<allow_active>auth_admin</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">@PIPE_BIN@</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
</policyconfig>'
|
||||
|
||||
RULES_TEMPLATE='/**
|
||||
* Allow all users to run vanilla-pipe as root without having to enter a password
|
||||
*
|
||||
* This provides convenience, especially on platforms more suited for touch
|
||||
* controls, however it could be dangerous to allow a program unrestricted
|
||||
* administrator access, so it should be used with caution.
|
||||
*/
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (action.id == "com.mattkc.vanilla") {
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
});'
|
||||
|
||||
echo "Installing Polkit action to ${POLKIT_ACTION_DST}"
|
||||
echo "$POLICY_TEMPLATE" | sed "s|@PIPE_BIN@|${path}|g" > "${POLKIT_ACTION_DST}"
|
||||
|
||||
echo "Installing Polkit rule to ${POLKIT_RULE_DST}"
|
||||
echo "$RULES_TEMPLATE" > "${POLKIT_RULE_DST}"
|
||||
|
||||
echo ""
|
||||
echo "Installation done. If you wish to undo this, simply remove the two files"
|
||||
echo "listed above."
|
||||
Reference in new issue
Block a user