sync.sh script is the primary tool for synchronizing dotfiles from the repository to your system. It uses the custom stot wrapper to create symbolic links and copy files to their appropriate locations.
Overview
Location:~/dotfiles/sync.sh
Purpose: Synchronizes all dotfiles by creating symbolic links from ~/dotfiles/ to their target locations in the home directory and system directories.
Dependencies:
stotcommand (automatically bootstrapped)echo_separatecommand (for formatted output)
Usage
Standard Sync
X11 Configuration Sync
Script Source
Script Breakdown
Bootstrap Section
Bootstrap Section
stot command is available before running the sync.- Checks if
~/.local/bin/stotexists - If not, creates a symbolic link from
~/dotfiles/bin/stot - This makes
stotcommand available for the rest of the script
X11 Configuration (Optional)
X11 Configuration (Optional)
sh sync.sh xPurpose: Syncs X Window System configuration files.Files:- X session initialization (
.xinitrc,.xprofile) - Xorg server configuration (keyboard, mouse, main config)
Home Directory Files
Home Directory Files
-l flag)Target: ~/ (home directory root)Files:- NVIDIA settings
- Display layout script
- X resources
- Zsh configuration
Application Configurations
Application Configurations
~/.config/Pattern:Special Configuration Files
Special Configuration Files
Custom Scripts
Custom Scripts
bin/ directoryResult:$PATH.System Files (Root Required)
System Files (Root Required)
-c flag) with sudo privilegesTarget: Root directories (/boot/, /etc/, /usr/, /srv/)Warning: These operations require root access and modify system files.Sync Order
The script syncs files in this order:- Bootstrap - Ensure
stotis available - X11 - (Optional) X Window System config
- Home - User home directory files
- Config - Application configurations in
.config/ - Special - Non-standard config file locations
- Scripts - Custom commands in
bin/ - Boot - Bootloader configuration
- System - System-wide configuration files
- Resources - System resources
- Services - Service data files
Operation Modes
Link Mode (-l)
Command: stot -l SOURCE [TARGET]
Behavior:
- Creates symbolic links from dotfiles to target location
- Default target:
~/<SOURCE> - Preserves file structure
- Changes in dotfiles automatically reflected in system
Copy Mode (-c)
Command: stot -c SOURCE [TARGET]
Behavior:
- Copies files to system directories
- Requires sudo for
/etc/,/boot/, etc. - Default target:
/<SOURCE> - Creates independent copy (not linked)
Output Format
The script usesecho_separate to create formatted section headers:
|:ok |- Successful operation|:error |- Failed operation
ln | 📄 |- Symbolic link (file)ln | 📁 |- Symbolic link (directory)cp | 📄 |- Copy (file)
Error Handling
Thestot command handles common errors:
Missing Source File
Missing Source File
Permission Denied
Permission Denied
Directory Not Found
Directory Not Found
stot automatically creates parent directoriesBest Practices
Before First Run
- Backup existing configs
- Review sync.sh contents
- Check file paths match your system
- Test with dry run if possible
After Changes
- Edit files in
~/dotfiles/ - Changes auto-reflect (symlinks)
- Commit to git repository
- Re-run sync.sh on new machines
System Files
- Use copy mode (
-c) for/etc/ - Require sudo privileges
- Test changes carefully
- Keep backups of originals
Customization
- Edit sync.sh to add/remove files
- Follow existing patterns
- Use
stot -hfor help - Test on non-critical system first
Common Use Cases
New System Setup
Update Existing Configuration
Sync System Files After Changes
Advanced Usage
Custom Sync Script
You can create a custom sync script for specific configurations:Selective Sync
Dependencies
The sync script requires:
- Bash or Zsh shell
stotcommand (auto-bootstrapped)echo_separatecommand- GNU coreutils (
ln,mkdir,rm) sudofor system file operations
Troubleshooting
Command Not Found: stot
Command Not Found: stot
Problem:
stot command not in PATHSolution:Permission Denied on System Files
Permission Denied on System Files
Problem: Cannot copy to
/etc/, /boot/, etc.Solution:Broken Symlinks
Broken Symlinks
Problem: Links pointing to wrong locationSolution:
Firefox Profile Path
Firefox Profile Path
Problem: Firefox profile path doesn’t matchSolution:
See Also
- Command Reference - Documentation for
stotcommand - Directory Structure - Detailed directory breakdown
- Installation Guide - Initial setup instructions