Add __changed_files, __removed_files

This commit is contained in:
0x1eef 2023-04-17 20:46:29 -03:00
parent b96a45f2e2
commit f564153aae

View file

@ -1,5 +1,19 @@
#!/bin/sh #!/bin/sh
__changed_files() {
rev=$1
echo $(
git diff --name-only --diff-filter=AM $rev..HEAD | \
cut -d / -f1 -f2 | \
uniq
)
}
__removed_files() {
rev=$1
echo $(git diff --name-only --diff-filter=D $rev..HEAD)
}
install() { install() {
ports_dir=$1 ports_dir=$1
portzap_dir=$2 portzap_dir=$2
@ -9,13 +23,13 @@ install() {
cd $portzap_dir cd $portzap_dir
if [ -e "$portzap_file" ]; then if [ -e "$portzap_file" ]; then
rev=$(cat $portzap_file) rev=$(cat $portzap_file)
nw_files=$(git diff --name-only --diff-filter=AM $rev..HEAD | cut -d / -f1 -f2 | uniq) ch_files=$(eval __changed_files "$rev")
rm_files=$(git diff --name-only --diff-filter=D $rev..HEAD) rm_files=$(eval __removed_files "$rev")
for file in $rm_files; do for file in $rm_files; do
echo RM $ports_dir/$file echo RM $ports_dir/$file
rm $ports_dir/$file rm $ports_dir/$file
done done
for file in $nw_files; do for file in $ch_files; do
if [ -f "$file" ]; then if [ -f "$file" ]; then
echo $file echo $file
$libexec_dir/install-file $ports_dir $file $libexec_dir/install-file $ports_dir $file