-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdistroboxInterface.py
66 lines (36 loc) · 1.63 KB
/
distroboxInterface.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import subprocess
import multiprocessing
import os
import guestAppWatchdog
#sys.argv[1] = File Source
guestAppsDir = "/usr/share/applications/"
#sys.argv[2] = File Destination
localGuestAppsDir = "/home/user/Projects/LinuxAppBox/GuestAppFiles/"
#sys.argv[3] = File Extension
fileExtenstion = ".desktop"
#TODO
#Take distrobox input with all possible vars
#command Distrobox to create guest.
#used by GUI and start up scrips
#GUI has defauls and also custom input
#scripts install a basic image as INIT is working as hoped
# Input can be
#--init-hooks <command>
#--pre-init-hooks <command>
def distroboxCreateImage(imageURI, name, init, preInitHooks, initHooks, volume, additionalFlags):
subprocess.run(f"distrobox-create --image {imageURI} {init} --pull --yes --name {name} {preInitHooks} {initHooks} {volume} {additionalFlags}", shell=True)
def distroboxCreateClone(srcPath, name, init, preInitHooks, initHooks, volume, additionalFlags):
subprocess.run(f"distrobox-create --clone {srcPath} {init} --pull --yes --name {name} {initHooks} {volume} {additionalFlags}", shell=True)
def distroboxRemoveImage(name):
subprocess.run(f"distrobox-rm {name} --yes --force", shell=True)
def distroboxEnter(command, args):
subprocess.run(f"distrobox-enter {args} {name}", shell=True)
def distroboxList():
subprocess.run(f"distrobox-list", shell=True)
def distroboxList(name):
subprocess.run(f"distrobox-stop {name} --yes", shell=True)
def execute(command):
subprocess.run(f"{command}", shell=True)
#distroboxCreate("docker.io/debian:latest", "debian", "","","","","")
#distroboxRemoveImage("rock")
#distroboxEnter("","debian")