Only update permissions on copied files.

pull/10/head
Joshua Potter 2023-11-28 09:17:09 -07:00
parent b74e72d092
commit c5bceaa1d0
4 changed files with 12 additions and 10 deletions

View File

@ -42,7 +42,7 @@ trap cleanup EXIT
# Copy template contents over to the intermediate build directory. # Copy template contents over to the intermediate build directory.
cp -r template/* "$BUILD" cp -r template/* "$BUILD"
# Explicitly set permissions on all the new files. # Explicitly set permissions on all copied files.
find "$BUILD" -type f -execdir chmod 644 {} + find "$BUILD" -type f -execdir chmod 644 {} +
find "$BUILD" -type d -execdir chmod 755 {} + find "$BUILD" -type d -execdir chmod 755 {} +
chmod 755 "$BUILD"/.githooks/pre-commit chmod 755 "$BUILD"/.githooks/pre-commit

View File

@ -42,25 +42,27 @@ trap cleanup EXIT
# Copy template contents over to the intermediate build directory. # Copy template contents over to the intermediate build directory.
cp -r template/* "$BUILD" cp -r template/* "$BUILD"
# Explicitly set permissions on all copied files.
find "$BUILD" -type f -execdir chmod 644 {} +
find "$BUILD" -type d -execdir chmod 755 {} +
# Generate a new project with the specified name using `mix`. Generate in a # Generate a new project with the specified name using `mix`. Generate in a
# subdirectory to avoid interaction and potential overwriting of files. # subdirectory to avoid interactive conflict resolution.
nix develop "$BUILD" --command bash -c "mix new $BUILD/project --app '$APP'" nix develop "$BUILD" --command bash -c "mix new $BUILD/project --app '$APP'"
# Copy the generated files into the intermediate build directory. Also overwrite # Copy the generated files into the intermediate build directory.
# the generated README in favor of that defined in our template.
mv -f "$BUILD"/project/* "$BUILD" mv -f "$BUILD"/project/* "$BUILD"
rmdir "$BUILD"/project rmdir "$BUILD"/project
# Overwrite the generated README in favor of that defined in our template.
cp template/README.md "$BUILD" cp template/README.md "$BUILD"
chmod 644 "$BUILD"/README.md
# Replace the template name found in the flake.nix file. The mix generator would # Replace the template name found in the flake.nix file. The mix generator would
# fail if $APP did not consist of just lowercase ASCII letters, numbers, or # fail if $APP did not consist of just lowercase ASCII letters, numbers, or
# underscores. Thus $APP is safe to interpolate into the following command. # underscores. Thus $APP is safe to interpolate into the following command.
sed -i "s/<APP_NAME>/$APP/g" "$BUILD/flake.nix" sed -i "s/<APP_NAME>/$APP/g" "$BUILD/flake.nix"
# Explicitly set permissions on all the new files.
find "$BUILD" -type f -execdir chmod 644 {} +
find "$BUILD" -type d -execdir chmod 755 {} +
# ============================================================ # ============================================================
# EPILOGUE # EPILOGUE
# ============================================================ # ============================================================

View File

@ -42,7 +42,7 @@ trap cleanup EXIT
# Copy template contents over to the intermediate build directory. # Copy template contents over to the intermediate build directory.
cp -r template/* "$BUILD" cp -r template/* "$BUILD"
# Explicitly set permissions on all the new files. # Explicitly set permissions on all copied files.
find "$BUILD" -type f -execdir chmod 644 {} + find "$BUILD" -type f -execdir chmod 644 {} +
find "$BUILD" -type d -execdir chmod 755 {} + find "$BUILD" -type d -execdir chmod 755 {} +
chmod 755 "$BUILD"/.githooks/pre-commit chmod 755 "$BUILD"/.githooks/pre-commit

View File

@ -42,7 +42,7 @@ trap cleanup EXIT
# Copy template contents over to the intermediate build directory. # Copy template contents over to the intermediate build directory.
cp -r template/* "$BUILD" cp -r template/* "$BUILD"
# Explicitly set permissions on all the new files. # Explicitly set permissions on all copied files.
find "$BUILD" -type f -execdir chmod 644 {} + find "$BUILD" -type f -execdir chmod 644 {} +
# ============================================================ # ============================================================