Skip to content

About

An authentic, modular, and safe way to deploy Linux configurations. This script acts as a professional Profile Manager that allows you to manage multiple dotfile setups, handles distribution-specific dependencies for Arch, Fedora, and openSUSE.

Resources

Stars

37 stars

Watchers

1 watching

Forks

Latest commit

 

History

67 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ML4W Dotfiles Installer

An authentic, modular, and safe way to deploy Linux configurations. This script acts as a professional Profile Manager that allows you to manage multiple dotfile setups, handles distribution-specific dependencies for Arch, Fedora, openSUSE, and Ubuntu, and uses an intelligent symlinking system with automated backups.

🛠 Installation and Documentation

You can find all installation options in the documentation of the ML4W Dotfiles Installer here:
https://ml4w.com/dotfiles-installer/

🚀 Key Features

  • Distro Agnostic: Detects your package manager (Pacman, DNF, Zypper, or APT) automatically.
  • Safe Sandbox: Dotfiles are first copied to a local folder before being symlinked to $HOME.
  • Proactive Symlinking: Automatically detects if a symlink points to a different ID and replaces it.
  • Automated Backups: Full profile snapshots and symlink backups organized by Project ID and Timestamp.
  • Developer Friendly: Supports local .dotinst files and local repository sources for rapid testing.
  • Test Mode: Verify package installation and setup logic without touching your files.
  • User Overrides: Support for individual user post.sh scripts per profile.
  • Clean Output: Package installation output is hidden and written to a logfile.

🛠 Installation

To install the installer script to your local system:

  1. Clone the repository.
git clone https://github.com/mylinuxforwork/ml4w-dotfiles-installer
  1. Run the installation:
cd ml4w-dotfiles-installer
make install
  1. Ensure your PATH includes local bins: Make sure ~/.local/bin is in your environment $PATH.

📖 Usage

Standard Installation (Remote)

To install a dotfiles profile using a remote URL:

ml4w-dotfiles-installer --install https://raw.githubusercontent.com/user/repo/main/profile.dotinst

Developer Installation (Local)

To test a local configuration file during development:

ml4w-dotfiles-installer --install ~/Projects/dotfiles/dev.dotinst

🧪 Test Mode (Setup Only)

Run the entire installation process—including package installation and pre/post scripts—without staging files or creating symlinks in your home directory. This is ideal for testing dependency logic on new distros:

ml4w-dotfiles-installer --install ~/Projects/dotfiles/dev.dotinst --testmode

📝 Logfile & Verbose Mode

The output of all package installations is hidden and written to a logfile, while a spinner shows the current progress. Each run creates a new logfile, and the last 10 are kept:

~/.local/state/ml4w-dotfiles-installer/logs/install-YYYYMMDD_HHMMSS.log

If a package fails to install, the installer continues and lists all failed packages at the end. Check the logfile for details. To show the installation output in the terminal as well, use --verbose:

ml4w-dotfiles-installer --install ~/Projects/dotfiles/dev.dotinst --verbose

🏗 For Content Creators: The .dotinst File

Remote Profile Example (Production)

{
  "name": "ML4W Hyprland Stable",
  "id": "com.ml4w.hyprland",
  "version": "2.10.1",
  "author": "Stephan Raabe",
  "homepage": "https://ml4w.com",
  "source": "https://github.com/mylinuxforwork/dotfiles.git",
  "subfolder": "dotfiles",
  "restore": [
    {
      "title": "Hyprland Settings",
      "source": ".config/hypr/settings.conf"
    }
  ]
}

Setup Scripts & Dependencies

The installer looks for an optional setup/ folder in the root of your dotfiles repository. All files are optional, and $distro is the detected distribution (arch, fedora, opensuse or ubuntu):

setup/
├── preflight.sh              # Runs on all distributions
├── preflight-$distro.sh      # Runs only on the matching distribution
├── dependencies/
│   ├── packages              # Packages for all distributions
│   └── packages-$distro      # Distribution-specific packages
├── packages/
│   ├── packages              # Initial installation only: all distributions
│   └── packages-$distro      # Initial installation only: distribution-specific
├── post.sh                   # Runs on all distributions
└── post-$distro.sh           # Runs only on the matching distribution

Execution order:

  1. preflight.sh → preflight-$distro.sh
  2. dependencies/packages → dependencies/packages-$distro
  3. packages/packages → packages/packages-$distro (initial installation only)
  4. post.sh → post-$distro.sh
  5. User post.sh (see Personal Overrides)

Dependencies are checked and installed on every run, including updates. Use them for packages the dotfiles need to work. Packages in packages/ are installed only on the initial installation and skipped on updates (when the profile already exists in the target directory). Use them for suggested applications such as a browser or editor, so users can uninstall or replace them without an update reinstalling them.

General scripts always run before their distribution-specific counterparts, so a distro script can adjust or override what the general script did. All scripts are sourced, so variables and functions defined in a general script are available in the distro script.

Setup scripts run with visible output. To hide the output of a command and write it to the installer logfile instead, use run_logged (with an optional spinner title):

ensure_sudo   # ask for the sudo password up front, before the output is hidden
run_logged --title "Installing yay..." makepkg -si --noconfirm

Tip: Keep preflight.sh limited to checks, backups and prompts. Anything that installs software (e.g. an AUR helper or extra repositories) belongs in preflight-$distro.sh.


🛠 Advanced Customization

1. Personal Overrides (User post.sh)

Users can define their own personal post-installation steps that run after the repository's standard scripts. This allows for system-specific tweaks (like enabling local services or setting hardware-specific drivers) without modifying the original dotfiles.

To add an override:

  1. Create the profile config folder: mkdir -p ~/.config/ml4w-dotfiles-installer/[PROFILE_ID]
  2. Create your script: nano ~/.config/ml4w-dotfiles-installer/[PROFILE_ID]/post.sh
  3. Make it executable: chmod +x ~/.config/ml4w-dotfiles-installer/[PROFILE_ID]/post.sh

The installer will detect this script and run it at the very end of the setup logic.

2. Blacklist (File Preservation)

The blacklist allows you to prevent specific files in a profile from being overwritten during an update. This is useful for configuration files you want to manage manually or keep strictly local.

Example: To prevent the installer from overwriting your local monitor setup or a specific theme file, add them to ~/.config/ml4w-dotfiles-installer/[PROFILE_ID]/blacklist:

# Blacklist Example
.config/hypr/conf/monitors.conf
.config/waybar/style.css
# You can also blacklist entire directories
.config/my-private-app/

Files listed here will be skipped during the staging process, preserving your local versions.


🔄 Restore & Update Logic

  1. Automatic Profile Backup: Before updates, your profile folder is backed up to ~/.mydotfiles/backups/profile-updates/[PROJECT_ID]/[TIMESTAMP].
  2. Selective Restoration: Interactive menu via gum to select which custom configurations to keep.
  3. Intelligent Merge: Selected items are merged into the new source before deployment.

🛡 Safety & Backups

The installer uses a highly organized backup system. All backups are stored in the backups folder of the dotfiles directory (~/.mydotfiles by default, or the directory set with --target):

  1. Symlink Backups: If a file or folder in $HOME or $HOME/.config is replaced by a symlink, it is moved to ~/.mydotfiles/backups/[PROJECT_ID]/[TIMESTAMP].
  2. Active Replacement: If the installer detects an existing symlink pointing to a different project ID, it proactively recreates the link to point to the currently active profile.

🤝 Contributing

The logic is separated into utils.sh and colors.sh. Feel free to add new utility functions or installation modules.

About

An authentic, modular, and safe way to deploy Linux configurations. This script acts as a professional Profile Manager that allows you to manage multiple dotfile setups, handles distribution-specific dependencies for Arch, Fedora, and openSUSE.

Resources

Stars

37 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages