This repository has been archived on 2024-10-13. You can view files and clone it, but cannot push or open issues or pull requests.
nix-packages/scripts/update-composer.sh

26 lines
619 B
Bash
Raw Permalink Normal View History

2023-04-24 09:22:50 +00:00
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p php.packages.composer git
SOURCE=$1
WRITE_PATH=$(realpath $2)
SOURCE_EXTRACTED=$(mktemp -du)
cp -r $SOURCE $SOURCE_EXTRACTED
chmod -R +w $SOURCE_EXTRACTED
cd $SOURCE_EXTRACTED
rm composer.lock
composer update
rm -rf vendor
$(nix-build -E 'let composer2nix = builtins.fetchGit {url = "https://git.chir.rs/darkkirb/composer2nix.git"; }; in import composer2nix')/bin/composer2nix
cp composer-env.nix php-packages.nix $WRITE_PATH
rm result
git diff --no-index $SOURCE $SOURCE_EXTRACTED | sed "s,$SOURCE,,g" | sed "s,$SOURCE_EXTRACTED,,g" > $WRITE_PATH/update.patch