mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-26 22:29:45 +00:00
* Handle a case where reserved ids on the Web UI side are not actually reserved on the backend side * Better error handling when no device is found in list_devices * Better warning message * Tag message as error * Fix device_info * Get reserved ids from the server instead of storing a client side state, which caused front and backend to get out of sync in certain cases. * Initial implementation of sidecar configuration reading and writing * Use bytes for drive image creation internally * Add named drive section * Move header to base.html * Create the disk profile list page * Make lists of HDDs, CDRs, and Removable drives * Implement disk image + sidecar creation * Implement CD-ROM device sidecar creation method * Add more device configurations * Add disclaimer * Hide URL if none is provided * Make the web ui use the new protobuf parameter maps * Make daynaport attaching UI more flexible * Use the protobuf interface to create image files * Use new create image method for the sidecar flow as well * Move file deletion logic to protobuf commands; Refactor saving/loading config files * Update disk image creation * Fix error * Disk images the script makes are in Mac format * Add blurb about the risks with using Lido driver (issue#40) to the easyinstall script, while pushing less for using that feature. * Make shutdown and reboot async operations * More informative footer contents * Wordsmith the Mac drive options * Link to relevant section in the wiki * Added GET_IMAGE_FILES * Added default folder to GET_IMAGE_FILES * Renaming * Updated setting image folder * Lists available net interfaces as a drop down when attaching daynaport * Macs should use the hds image file ending * Fixed default image folder handling * Refer to device properties, instead of sidecars * Added NETWORK_INTERFACES_INFO * Filter "lo" * Use PF_INET in favor of PF_INET6 * Added network interfaces to server info * Drive property file ending defined in one place; Add handling of common urllib and file system exceptions. * Use protobuf interface to get network interface info * Use protobuf interface for list_files * Repeated field cleanup * Renaming * Added DEVICE_TYPES_INFO * Comment update * Added -y option to rasctl * Add the remaining recommended drive profiles provided by rpajarola * Fix typos * Add warnings to CD-ROM descriptions * Add more recommended Sun drives * Add capacity to name * Move footer into base.html * Handle removable drive insertion in the attach method (easy to do with protobuf) * Limit which arguments to pass to an image injection command * Cleanup * Sort image and config files alphabetically * Make compatible with updated protobuf interface * Sort drives alphabetically by name * Decriptive text for CD-ROM section * Better description * Hyperlink to disks page instead of button Co-authored-by: Uwe Seimet <Uwe.Seimet@seimet.de>
42 lines
933 B
Python
42 lines
933 B
Python
import subprocess
|
|
|
|
|
|
def rascsi_service(action):
|
|
# start/stop/restart
|
|
return (
|
|
subprocess.run(["sudo", "/bin/systemctl", action, "rascsi.service"]).returncode
|
|
== 0
|
|
)
|
|
|
|
|
|
def reboot_pi():
|
|
subprocess.Popen(["sudo", "reboot"])
|
|
return True
|
|
|
|
|
|
def shutdown_pi():
|
|
subprocess.Popen(["sudo", "shutdown", "-h", "now"])
|
|
return True
|
|
|
|
|
|
def running_env():
|
|
ra_git_version = (
|
|
subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True)
|
|
.stdout.decode("utf-8")
|
|
.strip()
|
|
)
|
|
pi_version = (
|
|
subprocess.run(["uname", "-a"], capture_output=True)
|
|
.stdout.decode("utf-8")
|
|
.strip()
|
|
)
|
|
return {"git": ra_git_version, "env": pi_version}
|
|
|
|
|
|
def is_bridge_setup():
|
|
process = subprocess.run(["brctl", "show"], capture_output=True)
|
|
output = process.stdout.decode("utf-8")
|
|
if "rascsi_bridge" in output:
|
|
return True
|
|
return False
|