Skip to main content

A powerful CLI tool to profile your OS by saving, applying, exporting, and importing system configurations as named profiles. Designed to manage dot files and service configurations in a centralized Git repository (local or remote), dotctl enables seamless system replication across machines. Supports pre/post hook scripts, making it ideal for setting up servers or desktops with consistent environments.

Project description

DotCtl

dotctl is a powerful CLI tool to manage, save, apply, export, and import system configurations as named profiles.
It helps centralize dotfiles and service configurations in Git repositories for seamless replication across systems.

Designed for developers and sysadmins, it supports pre/post hook scripts and is ideal for setting up consistent environments across desktops and servers.


๐Ÿ“š Table of Contents


๐Ÿš€ Features

  • ๐Ÿ“ฆ Profile Management โ€” Create, switch, save, remove, and apply system profiles.
  • ๐ŸŒ€ Pre/Post Hooks โ€” Run scripts before or after activating a profile (e.g., install packages, restart services).
  • ๐Ÿ”„ Git Integration โ€” Sync profiles with local or remote Git repositories.
  • ๐Ÿ“ Portable Configs โ€” Export/import profiles using .dtsv files for easy backups and sharing.
  • โš™๏ธ Custom Configs โ€” Define tracking rules via dotctl.yaml.

๐Ÿ“ Profile Config Structure (dotctl.yaml)

The dotctl.yml config file defines what files and directories to track, save, and export as part of a system profile. This enables seamless migration, sharing, and restoration of system configs and personalizationsโ€”perfect for dotfiles, apps, or entire setups like KDE.

๐Ÿง  Concept Overview

The config has two main sections:

  • save:
    Specifies config files or directories that should be version-controlled (typically small files like dotfiles).
    These are committed to Git and restored via dotctl apply.
  • export:
    For large or non-versioned files (like fonts, themes, or binaries) that shouldn't go into Git, but you still want to package and move using dotctl export/import.
    This is helpful in offline environments or when syncing across machines.

Each section can define any number of data blocks, and every block contains:

  • location: A base directory (like $HOME or $CONFIG_DIR).
  • entries: A list of files/directories to include relative to the location.

๐Ÿ— Available Path Keys

To simplify path definitions, these keys can be used in location:

Key Path
$HOME /home/<user>
$APP_DIR ~/.dotctl
$CONFIG_DIR ~/.config
$SHARE_DIR ~/.local/share
$BIN_DIR ~/.local/bin
$SYS_SHARE_DIR /usr/share
$SYS_CONFIG_DIR /etc

Use them to make profiles portable across systems.


โœ… Example: Minimal Config

save:
  configs:
    location: $HOME
    entries:
      - test.txt

export:
  share_folder:
    location: $HOME/.local/share
    entries: []
  home_folder:
    location: $HOME/
    entries: []

๐Ÿ’ป Real World: Full Ubuntu + KDE Config

save:
  configs:
    location: $CONFIG_DIR
    entries:
      - gtk-2.0
      - gtk-3.0
      - gtk-4.0
      - Kvantum
      - latte
      - dolphinrc
      - konsolerc
      - kcminputrc
      - kdeglobals
      - kglobalshortcutsrc
      - klipperrc
      - krunnerrc
      - kscreenlockerrc
      - ksmserverrc
      - kwinrc
      - kwinrulesrc
      - plasma-org.kde.plasma.desktop-appletsrc
      - plasmarc
      - plasmashellrc
      - gtkrc
      - gtkrc-2.0
      - lattedockrc
      - breezerc
      - oxygenrc
      - lightlyrc
      - ksplashrc
      - khotkeysrc
      - autostart

  app_layouts:
    location: $HOME/.local/share/kxmlgui5
    entries:
      - dolphin
      - konsole

  home_folder:
    location: $HOME/
    entries:
      - .zshrc
      - .p10k.zsh

  sddm_configs:
    location: $SYS_CONFIG_DIR
    entries:
      - sddm.conf.d

export:
  home_folder:
    location: $HOME/
    entries:
      - .fonts
      - .themes
      - .icons
      - .wallpapers
      - .conky
      - .zsh
      - .bin
      - bin

  share_folder:
    location: $SHARE_DIR
    entries:
      - plasma
      - kwin
      - konsole
      - fonts
      - kfontinst
      - color-schemes
      - aurorae
      - icons
      - wallpapers

  root_share_folder:
    location: $SYS_SHARE_DIR
    entries:
      - plasma
      - kwin
      - konsole
      - fonts
      - kfontinst
      - color-schemes
      - aurorae
      - icons
      - wallpapers
      - Kvantum
      - themes

  sddm:
    location: $SYS_SHARE_DIR/sddm
    entries:
      - themes

๐Ÿ“ฆ Profile Usage Flow (e.g., nginx)

For a service like nginx, your profile might:

  • save: files like /etc/nginx/nginx.conf, /etc/nginx/sites-*
  • Include a pre-hook to install nginx (apt-get install -y nginx)
  • Use a post-hook to reload the service (systemctl reload nginx)

๐Ÿ”„ Profile Workflow Diagram

This diagram shows the typical lifecycle of using a dotctl profile, from saving configs to applying them on another machine:

Profile Workflow Diagram

            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
            โ”‚  dotctl.yml  โ”‚
            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚  `save` Section    โ”‚  โ—„โ”€โ”€โ”€โ”€ Config Files
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚  dotctl save       โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ–ผ
         Push to Git Repository
                  โ”‚
                  โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚  Transfer to New PC โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚  dotctl apply    โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚
     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚ Pre-hook (e.g. install)โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ–ผ
     Apply saved config files
                 โ”‚
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Post-hook (e.g. restart/reload)โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

                 โ”‚
                 โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚     dotctl export   โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ–ผ
          Create `.dtsv` file
                 โ”‚
        Transfer `.dtsv` file
                 โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚     dotctl import   โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“Š Profile Block Table

Section Field Description
save location Base path of the tracked files (can use key like $CONFIG_DIR)
entries List of files/folders to track under that location
export location Base path of export files (e.g., large assets not suited for Git)
entries List of assets or binaries to package in .dtsv

๐Ÿ” Example Workflow Table

Action Command Description
Save configs dotctl save Pulls files defined in save and stores in repo
Export assets dotctl export Package large, non-Git assets into .dtsv file
Transfer assets scp profile.dtsv ... Manually copy to another machine
Import assets dotctl import Unpack .dtsv on another system
Apply profile dotctl apply Pull from repo, run pre/post hooks, and apply saved configs

๐Ÿ”ง Installation

pip install dotctl

๐Ÿ“˜ Usage

dotctl [OPTIONS] <COMMAND> [ARGS]

Run dotctl -h for global help or dotctl <COMMAND> -h for command-specific help.


๐Ÿ› ๏ธ Commands

๐Ÿ“ init

Initialize a new profile.

dotctl init [-h] [-u <git-url>] [-p <profile>] [-c <config-path>] [-e <env>]

Examples:

dotctl init -e kde
dotctl init -u https://github.com/user880/dots.git -p mydesktop
dotctl init -c ./my_custom_config.yaml

Options:

  • -e, --env โ€“ Target environment (e.g., kde, gnome, server).
  • -u, --url โ€“ Git URL to clone profile from.
  • -p, --profile โ€“ Activate this profile after init.
  • -c, --config โ€“ Path to custom YAML config.

๐Ÿ’พ save

Save current system state to the active profile.

dotctl save [-h] [-p <password>] [--skip-sudo] [profile]

Examples:

dotctl save
dotctl save my_web_server --skip-sudo
dotctl save my_web_server -p mYsecretp@ssw0rd

Options:

  • --skip-sudo โ€“ Ignore restricted resources.
  • -p, --password โ€“ Password for restricted resources.

๐Ÿ“‹ list / ls

List all profiles.

dotctl list [-h] [--details] [--fetch]

Examples:

dotctl list
dotctl list --details
dotctl list --fetch

Options:

  • --details โ€“ Show extended info.
  • --fetch โ€“ Refresh remote data.

๐Ÿ”€ switch / sw

Switch to another profile.

dotctl switch [-h] [--fetch] [profile]

Examples:

dotctl switch MyProfile
dotctl sw MyProfile --fetch

Options:

  • --fetch โ€“ Refresh profile info before switching.

๐Ÿ†• create / new

Create a new, empty profile.

dotctl create [-h] [--fetch] [-c <path>] [-e <env>] profile

Examples:

# Create a new profile from current active profile.
dotctl create myserver

# Create a empty new profile from a specific environment.
dotctl create -e kde

# Create a empty new profile from a custom config.
dotctl create -c ./my_custom_config.yaml

Options:

  • --fetch โ€“ Sync with remote before creating.
  • -c, --config โ€“ Path to custom YAML config.
  • -e, --env โ€“ Target environment (e.g., kde, gnome, server).

โŒ remove / rm / delete / del

Remove a profile locally and/or remotely.

dotctl remove [-h] [-y] [--fetch] <profile>

Examples:

dotctl rm MyProfile
dotctl del MyProfile --fetch
dotctl del MyProfile -y

Options:

  • --fetch โ€“ Refresh data before removal.
  • -y, --no-confirm โ€“ Skip confirmation prompt.

๐Ÿงช apply

Apply a saved profile.

dotctl apply [-h] [-p <password>] [--skip-sudo] [--skip-hooks] [--skip-pre-hooks] [--skip-post-hooks] [--ignore-hook-errors] [--hooks-timeout <timeout>] [profile]

Examples:

dotctl apply
dotctl apply mydesktop --skip-hooks
dotctl apply mydesktop --hooks-timeout 10
dotctl apply MyProfile --skip-pre-hooks --ignore-hook-errors

Options:

  • --skip-sudo โ€“ Ignore restricted resources.
  • --skip-hooks โ€“ Skip all hooks.
  • --skip-pre-hooks โ€“ Skip only pre-hooks.
  • --skip-post-hooks โ€“ Skip only post-hooks.
  • --ignore-hook-errors โ€“ Donโ€™t abort if hooks fail.
  • --hooks-timeout โ€“ Timeout in seconds for hooks.
  • -p, --password โ€“ Password for restricted actions.

๐Ÿ“ค export

Export a profile to .dtsv.

dotctl export [-h] [-p <password>] [--skip-sudo] [profile]

Examples:

dotctl export
dotctl export my_web_server --skip-sudo
dotctl export my_web_server -p mYsecretp@ssw0rd

Options:

  • --skip-sudo, -p same as above.

๐Ÿ“ฅ import

Import a .dtsv profile.

dotctl import [-h] [-p <password>] [--skip-sudo] <file.dtsv>

Examples:

dotctl import my_web_server.dtsv
dotctl import /data/backup/web.dtsv --skip-sudo

Options:

  • --skip-sudo, -p same as above.

๐Ÿ”ฅ wipe

Remove all local profiles.

dotctl wipe [-h] [-y]

Examples:

dotctl wipe
dotctl wipe -y

Options:

  • -y, --no-confirm โ€“ Do not prompt before wiping.

๐Ÿง‘โ€๐Ÿ’ป Development & Publishing

Setup Development Environment

python -m venv venv
source venv/bin/activate  # Linux/macOS
venv\Scripts\activate     # Windows

pip install -r requirements.txt

Test the new code

cd src
python -m dotctl.main --help
python -m dotctl.main new my_profile
python -m dotctl.main save
python -m dotctl.main apply

Build the Package

python -m build

Publish to TestPyPI

twine upload --repository testpypi dist/*

Publish to PyPI

twine upload --repository pypi dist/*

๐Ÿ™‹ Contact

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dotctl-1.0.7.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dotctl-1.0.7-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file dotctl-1.0.7.tar.gz.

File metadata

  • Download URL: dotctl-1.0.7.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for dotctl-1.0.7.tar.gz
Algorithm Hash digest
SHA256 5fc9ebb638344d6da78d3fdd85722e61a7ae3401cd6ad5353243d8b5842917dc
MD5 6bbc5205683f041b0a7d8989a4ea0880
BLAKE2b-256 5bfaff7fd1530782dacb5071bc9047fdf14a9c584c7f9e614a8270fe61d55a92

See more details on using hashes here.

File details

Details for the file dotctl-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: dotctl-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 33.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for dotctl-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ba2792466c8ba79410a4186d87bc806010c064d62cc652e3c02708bf9057d7c3
MD5 6867db8ea7b4aa15be49e6f45077a476
BLAKE2b-256 7e964eaea6f49ae8b4ee77063e0641e4fd4f6a4c0e34bb95cf0200f8385b8a99

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page