Skip to content

Commit 404d408

Browse files
authored
fix: enhance directory creation and ownership setup in install script
1 parent 453202f commit 404d408

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

.github/workflows/release.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: "Release dev container features"
22
on:
33
workflow_dispatch:
4-
push:
5-
branches:
6-
- main
74

85
jobs:
96
deploy:

src/mise/install.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,34 @@ check_packages curl ca-certificates apt-transport-https dirmngr gnupg2
138138
. /etc/os-release
139139
receive_gpg_keys $MISE_CLI_INSTALLER_GPG_KEY
140140

141+
# Get the directory part
142+
install_dir=$(dirname "$MISE_INSTALL_PATH")
143+
144+
# Create a list of directories to potentially create
145+
dirs_to_create=""
146+
current_dir="$install_dir"
147+
148+
# Build the list of non-existent parent directories
149+
while [ ! -d "$current_dir" ] && [ "$current_dir" != "/" ] && [ "$current_dir" != "." ]; do
150+
dirs_to_create="$current_dir $dirs_to_create"
151+
current_dir=$(dirname "$current_dir")
152+
done
153+
154+
# Create directories and set ownership
155+
if [ -n "$dirs_to_create" ]; then
156+
for dir in $dirs_to_create; do
157+
mkdir -p "$dir"
158+
chown "${_REMOTE_USER}:$(id -gn ${_REMOTE_USER} 2>/dev/null || echo ${_REMOTE_USER})" "$dir"
159+
echo "Created directory with correct ownership: $dir"
160+
done
161+
fi
162+
141163
# Run the mise CLI installer
142164
echo "Installing mise CLI..."
143165
curl -s https://mise.jdx.dev/install.sh.sig | gpg --decrypt | sh
144166

145167
chmod +x ${MISE_INSTALL_PATH}
146-
chown ${_REMOTE_USER} ${MISE_INSTALL_PATH}
168+
chown "${_REMOTE_USER}:$(id -gn ${_REMOTE_USER} 2>/dev/null || echo ${_REMOTE_USER})" "${MISE_INSTALL_PATH}"
147169

148170
install_mise_activate bash /etc/bash.bashrc
149171
install_mise_activate zsh /etc/zsh/zshrc

0 commit comments

Comments
 (0)