Skip to content

Commit

Permalink
Merge pull request #474 from mariux64/fix-uselocalpkg-symlink-replace…
Browse files Browse the repository at this point in the history
…ment

usrlocalpackage: Fix package type change
  • Loading branch information
donald authored Jul 2, 2025
2 parents 5f25850 + 5cf4e2f commit 73ea855
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions usrlocalpkg/admin/makebin
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ sub scandir {
sub create_file {
my ($fn,$content)=@_;
warn "create $fn\n";
-l $fn && unlink($fn) or die "$fn: $!\n";
open my $o,'>',$fn or die "$fn: $!\n";
print $o $content;
}
Expand All @@ -69,7 +70,7 @@ sub slurp_file {

sub create_file_if_changed {
my ($fn,$content)=@_;
if (-e $fn) {
if (!-l $fn && -e $fn) {
return if slurp_file($fn) eq $content;
unlink $fn or die "$fn: $!\n";
}
Expand All @@ -78,7 +79,7 @@ sub create_file_if_changed {

sub create_file_if_changed_x {
my ($fn,$content)=@_;
if (-e $fn) {
if (!-l $fn && -e $fn) {
return if slurp_file($fn) eq $content;
unlink $fn or die "$fn: $!\n";
}
Expand Down Expand Up @@ -123,7 +124,7 @@ sub create_profiles {
for my $fn (keys %WANT_SRC) {
my $src="$LIBSRC/$fn";
my $dst="$LIBDIR/$fn";
if (!-e $dst || (-M $dst > -M $src)) {
if (-l $dst || !-e $dst || (-M $dst > -M $src)) {
create_file($dst,slurp_file($src));
}
delete $HAVE{$fn};
Expand Down

0 comments on commit 73ea855

Please sign in to comment.