diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 19afa71d..ef1643aa 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -117,3 +117,10 @@ endif() # Copy the Helper install(DIRECTORY "../build/linux/helper" DESTINATION "${BUILD_BUNDLE_DIR}" USE_SOURCE_PERMISSIONS) + +# Copy Linux support files +install(DIRECTORY "../resources/linux/linux_support" DESTINATION "${BUILD_BUNDLE_DIR}" USE_SOURCE_PERMISSIONS) +install(FILES "../resources/linux/README.adoc" DESTINATION "${BUILD_BUNDLE_DIR}") +install(FILES "../resources/linux/desktop_integration.sh" + DESTINATION "${BUILD_BUNDLE_DIR}" + PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) \ No newline at end of file diff --git a/resources/README.adoc b/resources/linux/README.adoc similarity index 62% rename from resources/README.adoc rename to resources/linux/README.adoc index 560b6f02..ff583471 100644 --- a/resources/README.adoc +++ b/resources/linux/README.adoc @@ -1,5 +1,6 @@ == Instructions for Linux +=== Basic usage To run Yubico Authenticator, execute the authenticator binary by double clicking or running it from command line: ./authenticator @@ -11,4 +12,9 @@ On Ubuntu: Note that the QR scanning feature requires gnome-screenshot when using Wayland. - sudo apt install gnome-screenshot \ No newline at end of file + sudo apt install gnome-screenshot + +=== Integration with desktop environments +Execute following command to integrate Yubico Authenticator to your environment: + + desktop_integration.sh --install diff --git a/resources/linux/desktop_integration.sh b/resources/linux/desktop_integration.sh new file mode 100755 index 00000000..dc58d54a --- /dev/null +++ b/resources/linux/desktop_integration.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +# +# Copyright (C) 2022 Yubico. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +VERSION="6.0.0" +PRODUCT_NAME="Yubico Authenticator $VERSION" + +DESKTOP_FILENAME="com.yubico.authenticator.desktop" +DESKTOP_FILE="${HOME}/.local/share/applications/${DESKTOP_FILENAME}" + +EXEC_PATH=$(pwd) + +help() { + echo "Integrate Yubico Authenticator 6.0 with common desktop environments." + echo + echo "Usage: -i | --install -- install desktop file" + echo " -u | --uninstall -- uninstall desktop file" + echo " -h | --help -- show usage" +} + +install() { + cat "./linux_support/${DESKTOP_FILENAME}" | sed -e "s|@EXEC_PATH|${EXEC_PATH}|g" >"${DESKTOP_FILE}" + echo "Created file: ${DESKTOP_FILE}" +} + +uninstall() { + rm "${DESKTOP_FILE}" + echo "Removed: ${DESKTOP_FILE}" +} + +while [[ "$#" -gt 0 ]]; do + case $1 in + -i | --install) + install + exit 0 + ;; + -u | --uninstall) + uninstall + exit 0 + ;; + -h | --help) + help + exit 0 + ;; + *) + echo "Unknown parameter passed: $1" + help + exit 1 + ;; + esac + shift +done + +help diff --git a/resources/com.yubico.authenticator.desktop b/resources/linux/linux_support/com.yubico.authenticator.desktop similarity index 62% rename from resources/com.yubico.authenticator.desktop rename to resources/linux/linux_support/com.yubico.authenticator.desktop index 50b142e8..8d21e5ba 100644 --- a/resources/com.yubico.authenticator.desktop +++ b/resources/linux/linux_support/com.yubico.authenticator.desktop @@ -1,8 +1,8 @@ [Desktop Entry] Name=Yubico Authenticator GenericName=Yubico Authenticator -Exec=authenticator -Icon=com.yubico.yubioath +Exec="@EXEC_PATH/authenticator" +Icon=@EXEC_PATH/linux_support/com.yubico.yubioath.png Type=Application Categories=Utility; Keywords=Yubico;Authenticator; diff --git a/resources/linux/linux_support/com.yubico.yubioath.png b/resources/linux/linux_support/com.yubico.yubioath.png new file mode 100644 index 00000000..148ba27a Binary files /dev/null and b/resources/linux/linux_support/com.yubico.yubioath.png differ