dotfiles/README.adoc
2021-01-29 17:24:16 +01:00

101 lines
2.9 KiB
Plaintext

= Dotfiles managed with chezmoi
See https://github.com/twpayne/chezmoi
== Initialization
#TODO how to handle a new linux system correctly.#
#TODO check new chezmoi version#
Test with `centos7-01`:
. put executable to HOME dir
. add public ssh key to gitea user
. initialize with `./chezmoi init sdroid@gitea.sdroid.uber.space:heavy/dotfiles.git`
. check what will happen with `./chezmoi diff`
. apply it with `./chezmoi apply`
After that a `bin` directory will exist (if not yet present before), move the executable to this dir to have it `PATH`.
.add to .bashrc
[source,bash]
----
# If not running interactively, don't do anything
# see https://stackoverflow.com/questions/12440287/scp-doesnt-work-when-echo-in-bashrc
[[ "$-" != *i* ]] && return
if [ -x ~/.bashrc.d/bashrc.init ]; then
. ~/.bashrc.d/bashrc.init
fi
----
=== AWS Systeme (Draft)
TODO: create user file for initialization at provisioning
. install go `sudo yum install -y golang golang-bin`
. install git `sudo yum install -y git-all`
. install _chezmoi_ from git repo (see below)
. check GOPATH and adjust if necessary
. initialize with `chezmoi init https://gitea.sdroid.uber.space/heavy/dotfiles.git` (Use 'heavy' as user).
. check what will happen with `chezmoi diff`
. TODO: vi .config/chezmoi/chezmoi.toml (Template is not correct)
. apply it with `chezmoi apply`
.chezmoi installation
[source,console]
cd $(mktemp -d)
git clone --depth=1 https://github.com/twpayne/chezmoi.git
cd chezmoi
go install
==== New User
Better try modifications with a new user to keep the defaul user accessible to the system.
See below links to proceed.
* https://aws.amazon.com/de/premiumsupport/knowledge-center/new-user-accounts-linux-instance/
* https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#retrieving-the-public-key
=== Uberspace
Alternative way to include .sshrc by detecting SSH connection.
[source,bash]
----
# User specific aliases and functions
# test if the prompt var is not set
# See https://unix.stackexchange.com/questions/154395/running-scp-when-bashrc-of-remote-machine-includes-source-command
if [ -z "$PS1" ]; then
# prompt var is not set, so this is *not* an interactive shell
return
fi
if [ -f ~/.sshrc ] && [ -z "$SSH_CLIENT" ]; then
echo "Not a ssh connection"
else
echo "ssh client is present: $SSH_CLIENT"
. ~/.sshrc
fi
----
=== cygwin
When using cygwin, the `chezmoi` executable has defaults for Windows.
That means the default HOME dir is the Windows `%USERPROFILE%` directory.
To provide the managed files to the cygwin path `/home/user` the target directory has to be adjusted while calling `chezmoi`.
[source,console]
----
H:\>chezmoi apply -D C:\cygwin64\home\user
H:\>chezmoi -D C:\cygwin64\home\user managed
C:\cygwin64\home\user\.gitconfig
C:\cygwin64\home\user\.solarize_colors
C:\cygwin64\home\user\.solarize_colors_base
C:\cygwin64\home\user\.sshrc
C:\cygwin64\home\user\.vimrc
C:\cygwin64\home\user\bin
----