@@ -28,18 +28,24 @@ echo "cd $CLONE_DIR" >> "/home/${ACTUAL_USER}/.zshrc"
2828# --- 2. Set Permissions ---
2929
3030# Function to fix ownership and permissions for a directory
31- fix_dir_permissions () {
31+ copy_fix_dir_permissions () {
3232 local dir_path=$1
3333 echo " Fixing permissions for ${dir_path} ..."
34+ mkdir -p " ${dir_path} "
35+ local original_path=" ${dir_path} _original"
36+ cp -a " ${original_path} /." " ${dir_path} /"
3437 chown -R ${ACTUAL_USER} :${ACTUAL_USER} " ${dir_path} "
3538 find " ${dir_path} " -type d -exec chmod 700 {} +
3639 find " ${dir_path} " -type f -exec chmod 600 {} +
3740}
3841
3942# Function to fix ownership for a file
40- fix_file_owner () {
43+ copy_fix_file_owner () {
4144 local file_path=$1
4245 echo " Fixing ownership for ${file_path} ..."
46+ mkdir -p " dirname(${file_path} )"
47+ local original_path=" ${file_path} _original"
48+ cp " ${original_path} " " ${file_path} "
4349 chown ${ACTUAL_USER} :${ACTUAL_USER} " ${file_path} "
4450}
4551
@@ -48,11 +54,10 @@ echo "Setting permissions for user '${ACTUAL_USER}' on '${CLONE_DIR}'..."
4854chown -R ${ACTUAL_USER} :${ACTUAL_USER} " ${CLONE_DIR} "
4955
5056# Fix permissions for mounted directories and files
51- fix_dir_permissions " /home/${ACTUAL_USER} /.ssh"
52- fix_dir_permissions " /home/${ACTUAL_USER} /.gnupg"
53- fix_dir_permissions " /home/${ACTUAL_USER} /.gemini"
54- fix_dir_permissions " /home/${ACTUAL_USER} /shared_srv"
55- fix_file_owner " /home/${ACTUAL_USER} /.gitconfig"
57+ copy_fix_dir_permissions " /home/${ACTUAL_USER} /.ssh"
58+ copy_fix_dir_permissions " /home/${ACTUAL_USER} /.gnupg"
59+ copy_fix_dir_permissions " /home/${ACTUAL_USER} /.gemini"
60+ copy_fix_file_owner " /home/${ACTUAL_USER} /.gitconfig"
5661
5762# --- 3. Set User Password ---
5863# Check if the ACTUAL_PASSWORD environment variable is provided
0 commit comments