Ejemplo n.º 1
0
    def run(self):
        if not platform.is_arch:
            return

        print_header("Setting up VNC")

        install_pkg("tigervnc", "lxde-gtk3")

        if file_exists("/etc/pam.d/tigervnc.pacnew"):
            move("/etc/pam.d/tigervnc.pacnew", "/etc/pam.d/tigervnc")

        link_files([
            [
                SCRIPT_DIR.joinpath("vncserver.users"),
                Path("/etc/tigervnc/vncserver.users"),
                True,
            ],
            [
                SCRIPT_DIR.joinpath("config"),
                Path.home().joinpath(".vnc", "config"),
                True,
            ],
        ])

        run_command("sudo systemctl enable vncserver@:1")
        run_command("sudo systemctl start vncserver@:1")
Ejemplo n.º 2
0
 def run(self):
     print_header("Setting up Vim")
     if not "plugged" in self.args:
         self.check_nvim_installed()
         self.link_config()
     self.download_vim_plugged()
     run_command("nvim +PlugInstall +qall")
Ejemplo n.º 3
0
    def run(self):
        if not platform.is_arch:
            return

        print_header("Setting up Pacman")
        link_file(SCRIPT_DIR.joinpath("pacman.conf"),
                  Path("/etc/pacman.conf"),
                  sudo=True)

        install_pkg("reflector", "arch-audit", "kernel-modules-hook")

        # Enable kernel module cleanup job
        run_command("sudo systemctl daemon-reload")
        run_command("sudo systemctl enable linux-modules-cleanup")

        # Hooks are symlinked individually to allow local hooks that are
        # not managed by this installer.
        with os.scandir(SCRIPT_DIR.joinpath("hooks")) as hooks:
            hook_dir = "/etc/pacman.d/hooks/"
            for item in hooks:
                link_file(item.path, Path(hook_dir + item.name), sudo=True)

        link_file(
            SCRIPT_DIR.joinpath("reflector.conf"),
            Path("/etc/xdg/reflector/reflector.conf"),
            sudo=True,
        )

        run_command("sudo systemctl enable reflector.timer")
        run_command("sudo systemctl start reflector.timer")
Ejemplo n.º 4
0
    def run(self):
        if not platform.is_linux:
            return

        print_header("Setting up Docker")
        self.install_docker()

        print_header("Setting up Docker Credential Store")
        self.setup_cred_store()
Ejemplo n.º 5
0
    def run(self):
        print_header("Setting up ZSH")

        self.link_zsh_configs()
        self.setup_oh_my_zsh()
        self.install_plugins()
        self.install_theme()
        self.setup_hooks()
        self.setup_autocomplete()
        self.setup_project_list()
Ejemplo n.º 6
0
    def run(self):
        if not platform.is_mac:
            return

        print_header("Setting up macOS Finder")
        # Setup Finder to show all files
        run_command("defaults write com.apple.finder AppleShowAllFiles YES", shell=True)
        run_command(
            "killall Finder /System/Library/CoreServices/Finder.app", shell=True
        )
Ejemplo n.º 7
0
    def run(self):
        print_header("Setting up Minicom")
        for file in ["dfl", "fast"]:
            link_file(
                Path(__file__).parent.joinpath(f".minirc.{file}"),
                Path.home().joinpath(f".minirc.{file}"),
            )
        install_pkg("minicom")

        if platform.is_linux:
            run_command("sudo usermod -a -G dialout $(whoami)", shell=True)
Ejemplo n.º 8
0
    def run(self):
        print_header("Setting up Go")

        if not command_exists("go"):
            print_error(
                "Golang is not installed, please install Go and run this installer again"
            )
            return

        self.ensure_gopaths_dirs()
        self.install_go_pkgs()

        add_to_path("go", GOPATH.joinpath("bin"))
Ejemplo n.º 9
0
    def run(self):
        print_header("Setting up GPG")

        add_zsh_hook(Hook.POST, "10-gpg", SCRIPT_DIR.joinpath("setuphook.zsh"))
        add_fish_hook(Hook.POST, "10-gpg",
                      SCRIPT_DIR.joinpath("setuphook.fish"))

        if file_exists(INSTALLED_CANARY) and "force" not in self.args:
            print_line("GPG already setup")
            return

        # Use macOS binary location for consistancy
        if not file_exists("/usr/local/bin/gpg2"):
            link_file("/usr/bin/gpg2", "/usr/local/bin/gpg2", sudo=True)

        self.install_pkgs()

        os.makedirs(GNUPG_DIR, exist_ok=True)
        link_file(SCRIPT_DIR.joinpath("gpg.conf"),
                  GNUPG_DIR.joinpath("gpg.conf"))

        if platform.is_mac:
            link_file(
                SCRIPT_DIR.joinpath("gpg-agent.conf"),
                GNUPG_DIR.joinpath("gpg-agent.conf"),
            )
        else:
            remove(GNUPG_DIR.joinpath("gpg-agent.conf"))

        run_command_no_out(f"chmod -R og-rwx {str(GNUPG_DIR)}")

        gpg_key = settings["gpg"]["key"]
        print_line(f"GPG Key: {gpg_key}")

        # Import my public key and trust it ultimately
        if "nokey" not in self.args:
            run_command(f"gpg2 --recv-keys {gpg_key}")
            trust_key = f"{gpg_key}:6:"
            run_command(f"echo '{trust_key}' | gpg2 --import-ownertrust",
                        shell=True)

        if platform.is_fedora and file_exists(
                "/etc/xdg/autostart/gnome-keyring-ssh.desktop"):
            run_command(
                "sudo mv -f /etc/xdg/autostart/gnome-keyring-ssh.desktop /etc/xdg/autostart/gnome-keyring-ssh.desktop.inactive"
            )

        # Idempotency
        run_command('rm -f "$HOME/.gnupg/.dotfile-installed.*"', shell=True)
        run_command(f"touch {str(INSTALLED_CANARY)}")
Ejemplo n.º 10
0
    def run(self):
        print_header("Install fonts")
        os.makedirs(FONT_LIBRARY, exist_ok=True)

        reload_font = False
        for font in settings["fonts"]:
            reload_font = (
                install_font(font["remote"], FONT_LIBRARY.joinpath(font["name"]))
                or reload_font
            )

        if reload_font:
            print_line("Rescanning font caches")
            run_command("fc-cache -r")
Ejemplo n.º 11
0
    def run(self):
        if platform.is_mac:
            return

        print_header("Setting up Firefox profile")

        profiles = ConfigParser()
        profiles.read(MOZILLA_DIR.joinpath("profiles.ini"))

        default_profile = ""
        for k, v in profiles.items():
            if v.get("Default", fallback=0) == "1":
                default_profile = v
                break

        profile_dir = MOZILLA_DIR.joinpath(default_profile.get("Path"))
        link_file(SCRIPT_DIR.joinpath("user.js"), profile_dir.joinpath("user.js"))
Ejemplo n.º 12
0
    def run(self):
        print_header("Setting up Generic Configs")

        link_file(SCRIPT_DIR.joinpath("scripts"),
                  HOME_DIR.joinpath(".scripts"))

        with os.scandir(SCRIPT_DIR.joinpath("config")) as configs:
            config_dir = HOME_DIR.joinpath(".config")
            for item in configs:
                if item.is_dir():
                    link_file(item.path, config_dir.joinpath(item.name))

        if not platform.is_mac:
            run_command("systemctl --user daemon-reload")
            run_command("systemctl --user enable newsboat.timer")
            run_command("systemctl --user enable random_wallpaper.timer")
            if platform.is_arch:
                run_command("systemctl --user enable pacupdate.timer")

        self.exec_installer("configs/home", "home")
Ejemplo n.º 13
0
    def run(self):
        global SETTINGS_PATH, EXE_NAME
        vscodium = "vscodium" in self.args
        print_header("Setting up VSCodium")

        SETTINGS_PATH = get_settings_path(not vscodium)
        EXE_NAME = get_exe_name(not vscodium)

        if platform.is_mac:
            add_to_path(
                "vscode",
                "/Applications/Visual Studio Code.app/Contents/Resources/app/bin",
            )
            add_to_path(
                "vscode",
                "/Applications/VSCodium.app/Contents/Resources/app/bin")

        try:
            self.install_code()
        except InstallException:
            return

        self.link_files()
        self.install_extensions()
Ejemplo n.º 14
0
    def run(self):
        print_header("Setting up Fish")

        self.link_fish_configs()
        self.install_plugins()
        self.setup_hooks()
Ejemplo n.º 15
0
 def run(self):
     print_header("Installing extra package manager")
     if platform.is_mac:
         install_homebrew(force=True)
     elif platform.is_arch:
         install_aur_helper(force=True)
Ejemplo n.º 16
0
    def run(self):
        print_header("Setting up profile")
        link_config(".profile")

        print_header("Setting up tmux")
        link_config(".tmux.conf")

        print_header("Setting up makepkg")
        link_config(".makepkg.conf")

        print_header("Setting up Git")
        link_config(".gitconfig")
        link_config(".gitignore")
        link_config(".gitmessage")

        print_header("Setting up ncmpcpp")
        link_config(".ncmpcpp/bindings")
        link_config(".ncmpcpp/config")

        print_header("Setting up Calcurse")
        link_config(".calcurse/conf")
        link_config(".calcurse/keys")
Ejemplo n.º 17
0
 def run(self):
     print_header("Installing system packages")
     if platform.is_mac:
         self.install_mac_pkgs()
     else:
         self.install_linux_pkgs()