Skip to content

Commit

Permalink
feat: clone quickemu into ~/.local/share/quickemu and symlink binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardotglobal committed Oct 8, 2023
1 parent 6242117 commit 851a67d
Showing 1 changed file with 32 additions and 36 deletions.
68 changes: 32 additions & 36 deletions scripts/install_quickemu
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,46 @@ import shutil
import sys


def clone_repo():
print("📦 Cloning quickemu...")
def _(c: str):
"""Execute the command `c` and print it"""
print("> " + c)
os.system(c)

print("> git clone --filter=blob:none https://github.com/quickemu-project/quickemu /tmp/quickemu")
os.system("git clone --filter=blob:none https://github.com/quickemu-project/quickemu /tmp/quickemu")

print("> mkdir -p ~/.local/bin")
os.system("mkdir -p ~/.local/bin")
def clone_repo():
if os.path.exists(os.path.expanduser("~/.local/share/quickemu")):
print("📦 quickemu is already installed. Updating...")
update_quickemu()
return

print("> mv /tmp/quickemu/quickemu ~/.local/bin")
os.system("mv /tmp/quickemu/quickemu ~/.local/bin")
print("📦 Cloning quickemu...")

print("> mv /tmp/quickemu/macrecovery ~/.local/bin")
os.system("mv /tmp/quickemu/macrecovery ~/.local/bin")
_("git clone --filter=blob:none https://github.com/quickemu-project/quickemu ~/.local/share/quickemu")
_("mkdir -p ~/.local/bin")
_("ln -s ~/.local/share/quickemu/quickemu ~/.local/bin/quickemu")
_("ln -s ~/.local/share/quickemu/macrecovery ~/.local/bin/macrecovery")
_("ln -s ~/.local/share/quickemu/quickget ~/.local/bin/quickget")
_("ln -s ~/.local/share/quickemu/windowskey ~/.local/bin/windowskey")

print("> mv /tmp/quickemu/quickget ~/.local/bin")
os.system("mv /tmp/quickemu/quickget ~/.local/bin")
print("Installation complete.")
print("⚠️ Make sure ~/.local/bin is in your PATH.")

print("> mv /tmp/quickemu/windowskey ~/.local/bin")
os.system("mv /tmp/quickemu/windowskey ~/.local/bin")

print("> rm -rf /tmp/quickemu")
os.system("rm -rf /tmp/quickemu")
def update_quickemu():
print("📦 Updating quickemu...")

print("Installation complete.")
_("cd ~/.local/share/quickemu")
_("git pull")

print("Update complete.")
print("⚠️ Make sure ~/.local/bin is in your PATH.")


def install_fedora():
print("📦 Installing dependencies...")

cmd = "sudo dnf install qemu bash coreutils edk2-tools grep jq lsb procps python3 genisoimage usbutils util-linux " \
"sed spice-gtk-tools swtpm wget xdg-user-dirs xrandr unzip socat -y"
print("> " + cmd)
os.system(cmd)
_("sudo dnf install qemu bash coreutils edk2-tools grep jq lsb procps python3 genisoimage usbutils"
+ " util-linux sed spice-gtk-tools swtpm wget xdg-user-dirs xrandr unzip socat -y")

clone_repo()

Expand All @@ -50,13 +55,9 @@ def install_fedora():
def install_deb():
print("📦 Installing dependencies...")

print("> sudo apt update")
os.system("sudo apt update")

cmd = "sudo apt install qemu bash coreutils ovmf grep jq lsb-base procps python3 genisoimage usbutils util-linux " \
"sed spice-client-gtk libtss2-tcti-swtpm0 wget xdg-user-dirs zsync unzip socat -y"
print("> " + cmd)
os.system(cmd)
_("sudo apt update")
_("sudo apt install qemu bash coreutils ovmf grep jq lsb-base procps python3 genisoimage usbutils"
+ " util-linux sed spice-client-gtk libtss2-tcti-swtpm0 wget xdg-user-dirs zsync unzip socat -y")

clone_repo()

Expand All @@ -66,14 +67,9 @@ def install_deb():
def install_ubuntu():
print("⚠️ Adding ppa...")

print("> sudo apt-add-repository ppa:flexiondotorg/quickemu")
os.system("sudo apt-add-repository ppa:flexiondotorg/quickemu")

print("> sudo apt update")
os.system("sudo apt update")

print("> sudo apt install quickemu -y")
os.system("sudo apt install quickemu -y")
_("sudo apt-add-repository ppa:flexiondotorg/quickemu")
_("sudo apt update")
_("sudo apt install quickemu -y")

sys.exit(0)

Expand Down

0 comments on commit 851a67d

Please sign in to comment.