This commit is contained in:
2023-06-08 12:36:39 +02:00
parent bde200bd5c
commit 02a414f9cb
3 changed files with 8 additions and 6 deletions

View File

@@ -26,7 +26,7 @@
default = nixpkgsFor.${system}.stdenv.mkDerivation { default = nixpkgsFor.${system}.stdenv.mkDerivation {
name = name; name = name;
src = self; src = self;
buildPhase = "echo nothing todo"; buildPhase = "makepkg -s";
installPhase = "mkdir -p $out/bin; install -t $out/bin src/patch-manjaro-sway-mirror-for-arm.sh"; installPhase = "mkdir -p $out/bin; install -t $out/bin src/patch-manjaro-sway-mirror-for-arm.sh";
}; };
}); });

View File

@@ -40,7 +40,7 @@ Describe "patch-manjaro-sway-mirror-for-arm.sh - Test Suite"
The status should be success The status should be success
The contents of file "${target_file}" should equal "${test_content}" The contents of file "${target_file}" should equal "${test_content}"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
The output should equal "sed -i \"s|\\\$(pacman-mirrors -G)|\\\$(pacman-mirrors -G \| sed \\\"s/^arm-//\\\")|g\" \"${target_file}\" The output should equal "sed -i 's|\\\$(pacman-mirrors -G)|\\\$(pacman-mirrors -G \| sed \\\"s/^arm-//\\\")|g' '${target_file}'
curl -s \"https://pkg.manjaro-sway.download/\$(pacman-mirrors -G | sed \"s/^arm-//\")/testing\"" curl -s \"https://pkg.manjaro-sway.download/\$(pacman-mirrors -G | sed \"s/^arm-//\")/testing\""
End End
End End

View File

@@ -11,9 +11,6 @@ usage() {
exit 0 exit 0
} }
# Default values
dry_run=false
# Parse command-line options # Parse command-line options
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
@@ -52,6 +49,11 @@ while [ $# -gt 0 ]; do
shift shift
done done
# Apply default values if required
if [ -z "$dry_run" ]; then
dry_run=false
fi
if [ -z "$target_file" ]; then if [ -z "$target_file" ]; then
target_file="${MSMAP_TARGET_ROOT}/usr/bin/manjaro-sway-mirrors" target_file="${MSMAP_TARGET_ROOT}/usr/bin/manjaro-sway-mirrors"
fi fi
@@ -66,7 +68,7 @@ if [ -z "$replace_pattern" ]; then
replace_pattern='\$(pacman-mirrors -G \| sed \"s/^arm-//\")' replace_pattern='\$(pacman-mirrors -G \| sed \"s/^arm-//\")'
fi fi
sed_command="sed -i \"s|${search_pattern}|${replace_pattern}|g\" \"${target_file}\"" sed_command="sed -i 's|${search_pattern}|${replace_pattern}|g' '${target_file}'"
# Perform the sed command # Perform the sed command
if $dry_run; then if $dry_run; then
echo "$sed_command" echo "$sed_command"