From b2f3de7f94a4d28f5e1e5bd0e5f5a1153aa501c0 Mon Sep 17 00:00:00 2001 From: "Carlos Eduardo Sanchez Torres (sanchezcarlosjr)" <24639141+sanchezcarlosjr@users.noreply.github.com> Date: Fri, 12 Apr 2024 20:18:03 -0700 Subject: [PATCH 1/5] feat: declare and export the original user path @mmorenoregalado proposes to maintain consistency among different nodes and sessions through https://github.com/CodelyTV/dotly/pull/172/commits/8dc02e47f3c98bcc5328d6f785d33a2de7867380 and https://github.com/CodelyTV/dotly/pull/172, which generates a side-effect for users and adds a possible code smell in the future because it introduces an if-else pattern based on a condition that users may not expect. Also it doesn't allow the user to employ other environment variables, so we apply the template engine ideas and differentiate the application of Bash expansion. --- installer | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/installer b/installer index dc284abf..3d106074 100755 --- a/installer +++ b/installer @@ -67,9 +67,10 @@ _w "~ │ 🚀 Welcome to the ${green}dotly${normal} installer! │ ~" _w " └────────────────────────────────────┘" _w _q "Where do you want your dotfiles to be located? (default ~/.dotfiles)" "DOTFILES_PATH" -DOTFILES_PATH="${DOTFILES_PATH:-$HOME/.dotfiles}" -DOTFILES_PATH="$(eval echo "$DOTFILES_PATH")" +UNEXPANDED_DOTFILES_PATH="${DOTFILES_PATH:-\$HOME/.dotfiles}" +DOTFILES_PATH="$(eval echo "$UNEXPANDED_DOTFILES_PATH")" export DOTFILES_PATH="$DOTFILES_PATH" +export UNEXPANDED_DOTFILES_PATH="$UNEXPANDED_DOTFILES_PATH" dotly_inner_path="modules/dotly" export DOTLY_PATH="$DOTFILES_PATH/$dotly_inner_path" From 9fb1180d3a118021e0dbeea0ce625295be4ab099 Mon Sep 17 00:00:00 2001 From: "Carlos Eduardo Sanchez Torres (sanchezcarlosjr)" <24639141+sanchezcarlosjr@users.noreply.github.com> Date: Fri, 12 Apr 2024 20:23:07 -0700 Subject: [PATCH 2/5] feat: apply templating with unexpanded path The shell will expand the path during the user session. --- scripts/dotfiles/create | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/dotfiles/create b/scripts/dotfiles/create index 01010030..d139f071 100755 --- a/scripts/dotfiles/create +++ b/scripts/dotfiles/create @@ -12,9 +12,9 @@ source "$DOTLY_PATH/scripts/core/_main.sh" docs::parse "$@" dotfiles::apply_templating() { - sed -i -e "s|XXX_DOTFILES_PATH_XXX|$DOTFILES_PATH|g" "$DOTFILES_PATH/bin/sdot" - sed -i -e "s|XXX_DOTFILES_PATH_XXX|$DOTFILES_PATH|g" "$DOTFILES_PATH/shell/bash/.bashrc" - sed -i -e "s|XXX_DOTFILES_PATH_XXX|$DOTFILES_PATH|g" "$DOTFILES_PATH/shell/zsh/.zshenv" + sed -i -e "s|XXX_DOTFILES_PATH_XXX|$UNEXPANDED_DOTFILES_PATH|g" "$DOTFILES_PATH/bin/sdot" + sed -i -e "s|XXX_DOTFILES_PATH_XXX|$UNEXPANDED_DOTFILES_PATH|g" "$DOTFILES_PATH/shell/bash/.bashrc" + sed -i -e "s|XXX_DOTFILES_PATH_XXX|$UNEXPANDED_DOTFILES_PATH|g" "$DOTFILES_PATH/shell/zsh/.zshenv" } if [ ! -d "$DOTFILES_PATH/shell" ]; then From b306a83931af442c0d103f278e1f46d5ba9ea432 Mon Sep 17 00:00:00 2001 From: "Carlos Eduardo Sanchez Torres (sanchezcarlosjr)" <24639141+sanchezcarlosjr@users.noreply.github.com> Date: Sat, 13 Apr 2024 15:26:51 -0700 Subject: [PATCH 3/5] fix: the installer fails to install python3 We rely on pure apt instead of dotly mechanisms. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aaf1b2b0..b9052238 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ docker run -e TERM -e COLORTERM -e LC_ALL=C.UTF-8 -w /root -it --rm alpine sh -u ```bash docker run -e TERM -e COLORTERM -w /root -it --rm ubuntu sh -uec ' apt-get update - apt-get install -y curl build-essential sudo + apt-get install -y curl build-essential sudo python3 g++ su -c bash -c "$(curl -fsSL https://raw.githubusercontent.com/CodelyTV/dotly/HEAD/installer)" su -c zsh' ``` From 5889be2c656aca607b7459aa4af67e1baf5d6728 Mon Sep 17 00:00:00 2001 From: "Carlos Eduardo Sanchez Torres (sanchezcarlosjr)" <24639141+sanchezcarlosjr@users.noreply.github.com> Date: Sat, 13 Apr 2024 15:37:16 -0700 Subject: [PATCH 4/5] feat: support arch linux on docker --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index b9052238..3fe78649 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,18 @@ docker run -e TERM -e COLORTERM -w /root -it --rm ubuntu sh -uec ' ``` + +
+Arch Linux: + +```bash +docker run -e TERM -e COLORTERM -w /root -it --rm archlinux sh -uec ' + pacman -Sy curl base-devel sudo python3 git + su -c bash -c "$(curl -fsSL https://raw.githubusercontent.com/CodelyTV/dotly/HEAD/installer)" + su -c zsh' +``` +
+ ## Restore your Dotfiles manually * Install git From 0db2698ead65e1f5a0def543371a86d4ddc00ae9 Mon Sep 17 00:00:00 2001 From: "Carlos Eduardo Sanchez Torres (sanchezcarlosjr)" <24639141+sanchezcarlosjr@users.noreply.github.com> Date: Sat, 13 Apr 2024 16:08:14 -0700 Subject: [PATCH 5/5] docs: describe how to restore with Docker --- dotfiles_template/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dotfiles_template/README.md b/dotfiles_template/README.md index b6a0d68d..ac3bb95b 100644 --- a/dotfiles_template/README.md +++ b/dotfiles_template/README.md @@ -27,3 +27,17 @@ bash <(curl -s https://raw.githubusercontent.com/CodelyTV/dotly/HEAD/restorer) You need to know your GitHub username, repository and install ssh key if your repository is private. It also supports other git repos, but you need to know your git repository url. + +## Restore your Dotfiles on Docker +
+Using Debian: + +```bash +docker run -e TERM -e COLORTERM -w /root -it --rm debian sh -uec ' + apt-get update + export USER="__GITHUB_USER__" + apt-get install -y curl build-essential sudo python3 git g++ + su -c bash -c "$(curl -fsSL https://raw.githubusercontent.com/CodelyTV/dotly/HEAD/restorer)" + su -c zsh' +``` +