From dee181117139894db5c376f6e03659a010b78a79 Mon Sep 17 00:00:00 2001 From: Timothee 'TTimo' Besset <ttimo@valvesoftware.com> Date: Thu, 30 Jun 2022 17:00:32 +0200 Subject: [PATCH] redo the hackendeck service setup --- hackendeck/configure-hackendeck.py | 42 ++++++++++++++++++++++++++++++ hackendeck/steam-devkit-tool | 17 ++++++++++++ src/steamos-devkit-service.py | 0 3 files changed, 59 insertions(+) create mode 100755 hackendeck/configure-hackendeck.py create mode 100755 hackendeck/steam-devkit-tool mode change 100644 => 100755 src/steamos-devkit-service.py diff --git a/hackendeck/configure-hackendeck.py b/hackendeck/configure-hackendeck.py new file mode 100755 index 0000000..801eca9 --- /dev/null +++ b/hackendeck/configure-hackendeck.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +# Streamlining hackendeck setups + +import sys +import os +import subprocess +import logging + +KSSHASKPASS = '/usr/bin/ksshaskpass' +SSHD_CONFIG = '/etc/ssh/sshd_config' + +if __name__ == '__main__': + logging.basicConfig(format='%(message)s', level=logging.DEBUG) + logger = logging.getLogger(__name__) + + hackendeck = ( subprocess.run('grep -e "^ID=manjaro$" /etc/os-release', shell=True).returncode == 0 ) + if not hackendeck: + # plz send patches + logger.info('Only supported on Manjaro - please check documentation') + sys.exit(1) + + logger.info('======== Running hackendeck configuration checks ==========') + assert os.path.exists(KSSHASKPASS) + os.environ['SUDO_ASKPASS'] = KSSHASKPASS + # this goes pear shaped because of LD_* scout runtime + #need_tk = ( subprocess.run('pacman -Q tk', shell=True).returncode != 0 ) + need_tk = not os.path.exists('/usr/lib/libtk.so') + if need_tk: + logger.info('Installing Tk library') + subprocess.check_call('sudo -A pacman --noconfirm -S tk', shell=True) + logger.info('Tk library is installed') + need_patch_sshd = ( subprocess.run(f'grep -e "^PubkeyAcceptedAlgorithms" {SSHD_CONFIG}', shell=True).returncode != 0 ) + if need_patch_sshd: + logger.info('Patch sshd for old ssh-rsa hash') + subprocess.check_call('sudo -A bash -c \'echo -e "HostkeyAlgorithms +ssh-rsa\nPubkeyAcceptedAlgorithms +ssh-rsa\n" >> /etc/ssh/sshd_config\'', shell=True) + logger.info('sshd has been patched for old ssh-rsa hash') + enable_sshd = ( subprocess.run('systemctl status sshd 2>&1 >/dev/null', shell=True).returncode != 0 ) + if enable_sshd: + logger.info('sshd needs to be enabled') + subprocess.check_call('sudo -A systemctl enable --now sshd', shell=True) + logger.info('sshd is enabled') + logger.info('======== hackendeck configuration complete ==========') diff --git a/hackendeck/steam-devkit-tool b/hackendeck/steam-devkit-tool new file mode 100755 index 0000000..0f81841 --- /dev/null +++ b/hackendeck/steam-devkit-tool @@ -0,0 +1,17 @@ +#!/bin/bash + +set -o pipefail +shopt -s failglob +set -u + +# https://archived.forum.manjaro.org/t/tk-error-application-specific-initialization-failed-unknown-color-name-background/155675/2 +xrdb -load /dev/null + +GUI_FOLDER="$(cd $(dirname $0) && echo $PWD)" +BIN_FOLDER=$(realpath ${GUI_FOLDER}/../bin) +export PATH="${BIN_FOLDER}:$PATH" + +${BIN_FOLDER}/configure-hackendeck.py || exit 1 + +exec ${GUI_FOLDER}/steam-devkit-gui.pyz + diff --git a/src/steamos-devkit-service.py b/src/steamos-devkit-service.py old mode 100644 new mode 100755 -- GitLab