generated from stubbfel/nix-project-template
update
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
default = nixpkgsFor.${system}.stdenv.mkDerivation {
|
||||
name = name;
|
||||
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";
|
||||
};
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@ Describe "patch-manjaro-sway-mirror-for-arm.sh - Test Suite"
|
||||
The status should be success
|
||||
The contents of file "${target_file}" should equal "${test_content}"
|
||||
# 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\""
|
||||
End
|
||||
End
|
||||
|
||||
@@ -11,9 +11,6 @@ usage() {
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Default values
|
||||
dry_run=false
|
||||
|
||||
# Parse command-line options
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
@@ -52,6 +49,11 @@ while [ $# -gt 0 ]; do
|
||||
shift
|
||||
done
|
||||
|
||||
# Apply default values if required
|
||||
if [ -z "$dry_run" ]; then
|
||||
dry_run=false
|
||||
fi
|
||||
|
||||
if [ -z "$target_file" ]; then
|
||||
target_file="${MSMAP_TARGET_ROOT}/usr/bin/manjaro-sway-mirrors"
|
||||
fi
|
||||
@@ -66,7 +68,7 @@ if [ -z "$replace_pattern" ]; then
|
||||
replace_pattern='\$(pacman-mirrors -G \| sed \"s/^arm-//\")'
|
||||
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
|
||||
if $dry_run; then
|
||||
echo "$sed_command"
|
||||
|
||||
Reference in New Issue
Block a user