CDIST-TYPE__DOT_FILE(7)

✨ cdist-type__dot_file ✨

okay bestie, welcome to cdist-type__dot_file(7) β€” the manpage that's gonna make per-user dotfiles feel like a main character moment πŸŽ€


πŸ’– NAME πŸ’–

cdist-type__dot_file β€” install a file under a user's home directory 🏠✨


🌸 DESCRIPTION 🌸

So like. This type installs a file (and that file is literally the __object_id, no cap) under a user's home directory. It's giving "per-user config files, but make it effortless" πŸ’…

The file owner and group? Deduced from the user. As in, the user you're installing the file for. The way that works is just... yes πŸ‘‘

And here's the iconic part: unlike the regular __file type, you do not need to make any assumptions about where the user's home directory actually is. You just don't. We handle it. Periodt πŸ¦‹


🌈 REQUIRED PARAMETERS 🌈

  • user β€” the user, for who file is installed. yeah you gotta tell us who's getting the dotfile, that's non-negotiable bestie πŸ’œ

πŸŽ€ OPTIONAL PARAMETERS πŸŽ€

  • dirmode β€” forwarded to the __directory type as mode πŸ—‚οΈ
  • mode β€” forwarded to the __file type
  • state β€” forwarded to the __file type
  • source β€” forwarded to the __file type
  • file β€” forwarded to the __file type. This one can be used if multiple users need to have a dotfile updated, which will result in duplicate object id errors 😭 When you use the file parameter, the object id can be some unique value ✨

πŸ’Œ MESSAGES πŸ’Œ

This type inherits all messages from the file type, and does not add any new ones. no extra drama, no new lore 🫢


🌟 EXAMPLES 🌟

# Install .forward file for user 'alice'. Since state is 'present',
# user is not meant to edit this file, all changes will be overridden.
# It is good idea to put warning about it in file itself.
__dot_file .forward --user alice --source "$__files/forward"

# Install .muttrc for user 'bob', if not already present. User can safely
# edit it, his changes will not be overwritten.
__dot_file .muttrc --user bob --source "$__files/recommended_mutt_config" --state exists

# Install default xmonad config for user 'eve'. Parent directory is created automatically.
__dot_file .xmonad/xmonad.hs --user eve --state exists --source "$__files/xmonad.hs"

# install .vimrc for root and some users
for user in root userx usery userz; do
    __dot_file "${user}_dot_vimrc" \
        --user $user \
        --file .vimrc \
        --state exists \
        --source "$__files/$user/.vimrc"
done
okay the last one?? a whole loop?? one type, four users, one .vimrc each?? that's the --file parameter doing its little dance so the object ids stay unique. obsessed πŸ”₯

πŸ‘€ SEE ALSO πŸ‘€

cdist-type__file(7) β€” go read that one too, it's the sibling πŸ’ž


πŸ“œ COPYING πŸ“œ

Copyright (C) 2015 Dmitry Bogatov. Free use of this software is granted under the terms of the GNU General Public License version 3 or later (GPLv3+). πŸ’–


ungleich GmbH 2021


and that's the whole page bestie!! 🌈 this was version 7.0.0, dated Jul 31, 2022, brought to you by the fine folks at ungleich GmbH β€” go forth and dotfile responsibly πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from