add install step

Signed-off-by: Xe Iaso <me@christine.website>
This commit is contained in:
Cadey Ratio 2022-05-09 19:01:42 +00:00
parent 5aa1f61f1d
commit 4ae233dbcf
3 changed files with 28 additions and 13 deletions

16
deck_install.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
echo "installing tailscale" | logger
systemctl stop tailscaled.service ||:
systemd-sysext unmerge ||:
mkdir -p /etc/extensions/tailscale
mkdir -p /home/deck/.local/share/tailscale/steamos
wget -O /home/deck/.local/share/tailscale/steamos/tailscale_sysext_1.24.2.tar.gz https://xena.greedo.xeserv.us/pkg/ts-sysext/tailscale_sysext_1.24.2.tar.gz
tar xzf /home/deck/.local/share/tailscale/steamos/tailscale_sysext_1.24.2.tar.gz -C /etc/extensions/tailscale
systemd-sysext merge
systemctl start tailscaled.service

View File

@ -16,7 +16,7 @@ class Plugin:
result = subprocess.run(["/bin/sh", "-c", "systemctl status tailscaled.service | grep active"], stdout=subprocess.PIPE)
return result.stdout.decode("utf-8").split(": ")[1].strip()
async def _install_state(self):
async def install_state(self):
sysext = subprocess.run(["/usr/bin/systemd-sysext", "list", "--json=short"], stdout=subprocess.PIPE)
sysexts = json.loads(sysext.stdout.decode("utf-8"))
@ -31,10 +31,8 @@ class Plugin:
return "impossible state"
async def install_state(self, *args):
result = await self._install_state()
await self.log("status: " + result)
return result
async def install(self, *args):
subprocess.run(["/home/deck/homebrew/plugins/tailscale/deck_install.sh"])
# Asyncio-compatible long-running code, executed in a task when the plugin is loaded
async def _main(self):

View File

@ -17,21 +17,18 @@
return call_plugin_method("install_state", {});
}
async function doInstall() {
return call_plugin_method("install", {});
}
async function getStatus() {
await log("getting status");
let status = document.getElementById("status");
let installStatus = await getInstallState();
let status = document.getElementById("status");
status.innerText = `${installStatus}`;
}
async function onReady() {
log("test hi here what's up");
}
log("log message");
</script>
</head>
<body onload="onReady()">
<h2 id="heading">Hello World</h2>
<div class="gamepaddialog_Field_eKmEX gamepaddialog_WithFirstRow_2bDqk gamepaddialog_InlineWrapShiftsChildrenBelow_3LCXh gamepaddialog_WithBottomSeparator_3YKpU gamepaddialog_ExtraPaddingOnChildrenBelow_3nLNL gamepaddialog_StandardPadding_xIITX gamepaddialog_HighlightOnFocus_2HFrm Panel Focusable"
style="--indent-level:0;">
<div class="gamepaddialog_FieldLabelRow_2VcTl">
@ -40,6 +37,10 @@
class="DialogButton _DialogLayout Secondary gamepaddialog_Button_cXzBZ Focusable" onclick="getStatus()"
tabindex="0">🔄</button></div>
</div>
<div class="gamepaddialog_FieldChildren_2rhav"><button type="button"
class="DialogButton _DialogLayout Secondary gamepaddialog_Button_cXzBZ Focusable" onclick="doInstall()"
tabindex="0">Install</button></div>
</div>
</body>
</html>