[arch-projects] [mkinitcpio PATCH] add_{file, symlink}: overwrite existing file
Dave Reisner
d at falconindy.com
Thu Nov 17 13:31:44 EST 2011
On Fri, Nov 18, 2011 at 03:41:58AM +1100, Tom Gundersen wrote:
> Now we fail silently if the file exists, which means there is no easy way to overwrite binaries.
>
> I think it makes the most sense to do the following:
> 1) add all the busybox stuff as a basic system;
> 2) overwrite some of the links with any binaries we add to base hook;
> 3) allow users to write their own hooks to overwrite even more stuff.
>
> This can now be done by this hook.
>
> [this should have been part of the previous patch serios, it got lost on the way, sorry about that.]
> Signed-off-by: Tom Gundersen <teg at jklm.no>
> ---
> functions | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/functions b/functions
> index ef4463e..54c1034 100644
> --- a/functions
> +++ b/functions
> @@ -82,7 +82,6 @@ _add_file() {
> # $3: mode
>
> (( $# == 3 )) || return $EINVAL
> - [[ -e "$BUILDROOT$1" ]] && return $EEXIST
>
> (( QUIET )) || plain "adding file: %s" "$1"
> command install -Dm$3 "$2" "$BUILDROOT$1"
> @@ -106,10 +105,9 @@ _add_symlink() {
> # $2: target of $1
>
> (( $# == 2 )) || return $EINVAL
> - [[ -L "$BUILDROOT$1" ]] && return $EEXIST
>
> (( QUIET )) || plain "adding symlink: %s -> %s" "$1" "$2"
> - ln -s "$2" "$BUILDROOT$1"
> + ln -sf "$2" "$BUILDROOT$1"
This will do the wrong thing when a symlink exists and points to a
directory. I think it's as simple as passing the -n flag to ln.
> }
>
> auto_modules() {
> --
> 1.7.7.3
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://mailman.archlinux.org/pipermail/arch-projects/attachments/20111117/102a90d4/attachment.asc>
More information about the arch-projects
mailing list