]> xn--ix-yja.es Git - alex.git/commitdiff
Install distrobox
authoralex <alex@pdp7.net>
Sun, 20 Aug 2023 10:37:23 +0000 (10:37 +0000)
committeralex <alex@pdp7.net>
Sun, 20 Aug 2023 10:37:23 +0000 (10:37 +0000)
* Also refactor home_dir variable

workstation/setup.py

index 76d1c5c24d54e6c1166facfaf1f03180079fb0c0..ee82449159292f737cfb82923cd0e701282aa15b 100755 (executable)
@@ -12,7 +12,9 @@ def _(t):
 print("Installing some packages...")
 subprocess.run(["sudo", "dnf", "install", "-y", "rclone", "fuse", "git", "podman-docker", "wget"], check=True)
 
-if not (pathlib.Path.home() / ".config" / "rclone" / "rclone.conf").exists():
+home = pathlib.Path.home()
+
+if not (home / ".config" / "rclone" / "rclone.conf").exists():
     print(_("""
         Visit https://nextcloud.pdp7.net/nextcloud/index.php/settings/user/security , create an app password
     """))
@@ -20,10 +22,10 @@ if not (pathlib.Path.home() / ".config" / "rclone" / "rclone.conf").exists():
     subprocess.run(["rclone", "config", "create", "nextcloud", "webdav", "url=https://nextcloud.pdp7.net/nextcloud/remote.php/dav/files/alex/", "vendor=nextcloud", "user=alex", "--all"], check=True)
 
 
-(pathlib.Path.home() / "Nextcloud").mkdir(exist_ok=True)
+(home / "Nextcloud").mkdir(exist_ok=True)
 
 
-nextcloud_service_path = pathlib.Path.home() / ".config" / "systemd" / "user" / "nextcloud.service"
+nextcloud_service_path = home / ".config" / "systemd" / "user" / "nextcloud.service"
 nextcloud_service_path.parent.mkdir(parents=True, exist_ok=True)
 
 
@@ -40,11 +42,11 @@ with open(nextcloud_service_path, "w", encoding="utf8") as f:
 
 subprocess.run(["systemctl", "--user", "enable", "--now", "nextcloud"], check=True)
 
-if not (pathlib.Path.home() / ".ssh").exists():
+if not (home / ".ssh").exists():
     subprocess.run(["ln", "-s", "Nextcloud/_ssh", ".ssh"], check=True)
 
 
-dotfiles_dir = pathlib.Path.home() / "Nextcloud" / "dotfiles"
+dotfiles_dir = home / "Nextcloud" / "dotfiles"
 
 for dotfile in dotfiles_dir.glob("*"):
     relative_dotfile = dotfile.relative_to(dotfiles_dir)
@@ -53,11 +55,13 @@ for dotfile in dotfiles_dir.glob("*"):
         subprocess.run(["ln", "-s", dotfile, replaced_dotfile], check=True)
 
 
-(pathlib.Path.home() / ".local" / "bin").mkdir(exist_ok=True, parents=True)
+(home / ".local" / "bin").mkdir(exist_ok=True, parents=True)
+
+(home / "git").mkdir(exist_ok=True, parents=True)
 
-subprocess.run(["wget", "https://github.com/alexpdp7/cmdainer/releases/latest/download/cmdainer-linux", "-O", "/home/alex/.local/bin/cmdainer"], check=True)
-subprocess.run(["chmod", "+x", "/home/alex/.local/bin/cmdainer"], check=True)
+distrobox_dir = home / "git" / "distrobox"
 
-if not shutil.which("cmdainer"):
-    subprocess.run(["cmdainer", "add-wrapper", "workstation", "/bin/bash", "quay.io/alexpdp7/workstation:latest"], check=True)
+if not distrobox_dir.exists():
+    subprocess.run(["git", "clone", "https://github.com/89luca89/distrobox.git", distrobox_dir], check=True)
 
+subprocess.run([distrobox_dir / "install"], check=True)