-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SteamOS as a supported platform (#121)
* Update readme * Rename core go module path * Add steamos platform * Add steamos build tasks * Add steamos udev rules * Add deploy-steamos task to Taskfile * Refactor Steam library scanning into reusable utility function * Refactor platform methods to use anonymous parameters * Refactor service handling and configuration structure * Update SteamOS launch command and add Zaparoo service file * Added module blacklist for acr122 * Remove acr122_pcsc * Refactor service handling and update configuration files * Add install and uninstall commands for SteamOS service * Fix zaparoo.service to run tapto without -daemon flag * Switch to xdg for paths and update dependency versions * Refactor install logic and update systemd service configuration * Update service template to use dynamic paths for exec and working dir * Add optical_drive reader and clean up dependencies * Remove sudo from steam launch
- Loading branch information
1 parent
d23b263
commit be6c98d
Showing
70 changed files
with
875 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Allow user (deck) access to NFC readers | ||
|
||
# CH340 serial devices (PN532 V2, ESP32, DIY Reader, etc.) | ||
SUBSYSTEMS=="usb", ATTRS{idProduct}=="7523", ATTRS{idVendor}=="1a86", MODE="0660", GROUP="deck" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
blacklist pn533 | ||
blacklist pn533_usb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[Unit] | ||
Description=Zaparoo Core service | ||
|
||
[Service] | ||
Type=exec | ||
Restart=on-failure | ||
RestartSec=5 | ||
StandardError=syslog | ||
User=deck | ||
Group=deck | ||
WorkingDirectory=%%WORKING%% | ||
ExecStart=%%EXEC%% | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package main | ||
|
||
import ( | ||
_ "embed" | ||
"github.com/ZaparooProject/zaparoo-core/pkg/config" | ||
"os" | ||
"os/exec" | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
// TODO: allow updating if files have changed | ||
|
||
//go:embed conf/zaparoo.service | ||
var serviceFile string | ||
|
||
//go:embed conf/blacklist-zaparoo.conf | ||
var modprobeFile string | ||
|
||
//go:embed conf/60-zaparoo.rules | ||
var udevFile string | ||
|
||
const ( | ||
servicePath = "/etc/systemd/system/zaparoo.service" | ||
modprobePath = "/etc/modprobe.d/blacklist-zaparoo.conf" | ||
udevPath = "/etc/udev/rules.d/60-zaparoo.rules" | ||
) | ||
|
||
func install() error { | ||
// install and prep systemd service | ||
if _, err := os.Stat(servicePath); os.IsNotExist(err) { | ||
exe, err := os.Executable() | ||
if err != nil { | ||
exe = "/home/deck/zaparoo/" + config.AppName | ||
} | ||
serviceFile = strings.ReplaceAll(serviceFile, "%%EXEC%%", exe) | ||
serviceFile = strings.ReplaceAll(serviceFile, "%%WORKING%%", filepath.Dir(exe)) | ||
|
||
err = os.WriteFile(servicePath, []byte(serviceFile), 0644) | ||
if err != nil { | ||
return err | ||
} | ||
err = exec.Command("systemctl", "daemon-reload").Run() | ||
if err != nil { | ||
return err | ||
} | ||
err = exec.Command("systemctl", "enable", "zaparoo").Run() | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
// install udev rules and refresh | ||
if _, err := os.Stat(udevPath); os.IsNotExist(err) { | ||
err = os.WriteFile(udevPath, []byte(udevFile), 0644) | ||
if err != nil { | ||
return err | ||
} | ||
err = exec.Command("udevadm", "control", "--reload-rules").Run() | ||
if err != nil { | ||
return err | ||
} | ||
err = exec.Command("udevadm", "trigger").Run() | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
// install modprobe blacklist | ||
if _, err := os.Stat(modprobePath); os.IsNotExist(err) { | ||
err = os.WriteFile(modprobePath, []byte(modprobeFile), 0644) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func uninstall() error { | ||
if _, err := os.Stat(servicePath); !os.IsNotExist(err) { | ||
err = exec.Command("systemctl", "disable", "zaparoo").Run() | ||
if err != nil { | ||
return err | ||
} | ||
err = exec.Command("systemctl", "stop", "zaparoo").Run() | ||
if err != nil { | ||
return err | ||
} | ||
err = exec.Command("systemctl", "daemon-reload").Run() | ||
if err != nil { | ||
return err | ||
} | ||
err = os.Remove(servicePath) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
if _, err := os.Stat(modprobePath); !os.IsNotExist(err) { | ||
err = os.Remove(modprobePath) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
if _, err := os.Stat(udevPath); !os.IsNotExist(err) { | ||
err = os.Remove(udevPath) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.