Change environment variables to positional arguments in bash script #25

Merged
sb10q merged 1 commits from esavkin/artiq-extrapkg:func-args into master 2024-09-30 13:56:19 +08:00
1 changed files with 9 additions and 7 deletions
Showing only changes of commit f0e2486d6c - Show all commits

View File

@ -24,7 +24,9 @@ pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf --cachedir $MSYS2DIR/
--sync --print-format "%l %n" mingw-w64-clang-x86_64-qt-installer-framework > $MSYS2DIR/qt_ifw_packages.txt --sync --print-format "%l %n" mingw-w64-clang-x86_64-qt-installer-framework > $MSYS2DIR/qt_ifw_packages.txt
function generate_nix_packages_from_pacman() { function generate_nix_packages_from_pacman() {
echo "{ pkgs } : [" > $OUT local in=$1
local out=$2
echo "{ pkgs } : [" > $out
while IFS= read -r line; do while IFS= read -r line; do
read -r url package <<< "$line" read -r url package <<< "$line"
hash=$(nix-prefetch-url $url --name $package) hash=$(nix-prefetch-url $url --name $package)
@ -33,11 +35,11 @@ function generate_nix_packages_from_pacman() {
url = \"$url\"; url = \"$url\";
name = \"$package\"; name = \"$package\";
sha256 = \"$hash\"; sha256 = \"$hash\";
})" >> $OUT })" >> $out
done < $IN done < $in
echo "]" >> $OUT echo "]" >> $out
} }
IN=$MSYS2DIR/packages.txt OUT=msys2_packages.nix generate_nix_packages_from_pacman generate_nix_packages_from_pacman $MSYS2DIR/packages.txt msys2_packages.nix
IN=$MSYS2DIR/qt_ifw_packages.txt OUT=msys2_qt_ifw_packages.nix generate_nix_packages_from_pacman generate_nix_packages_from_pacman $MSYS2DIR/qt_ifw_packages.txt msys2_qt_ifw_packages.nix
IN=$MSYS2DIR/artiq_dependency_packages.txt OUT=artiq_dependency_packages.nix generate_nix_packages_from_pacman generate_nix_packages_from_pacman $MSYS2DIR/artiq_dependency_packages.txt artiq_dependency_packages.nix