|
|
|
@ -0,0 +1,56 @@ |
|
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
|
|
# |
|
|
|
# Filename: lib/overlay/overlay-functions.in |
|
|
|
# Copyright (C) 2007 - 2008 The OpenSDE Project |
|
|
|
# |
|
|
|
# More information can be found in the files COPYING and README. |
|
|
|
# |
|
|
|
# This program is free software; you can redistribute it and/or modify |
|
|
|
# it under the terms of the GNU General Public License as published by |
|
|
|
# the Free Software Foundation; version 2 of the License. A copy of the |
|
|
|
# GNU General Public License can be found in the file COPYING. |
|
|
|
# --- SDE-COPYRIGHT-NOTE-END --- |
|
|
|
|
|
|
|
# apply an overlay dir |
|
|
|
overlay_apply() { |
|
|
|
local overlaydir="$1" rootfs="${2:-$root}" |
|
|
|
local file= source= target= ext= |
|
|
|
local type= mode= ref= targetdir= |
|
|
|
|
|
|
|
for file in $overlaydir/*; do |
|
|
|
source="${file##*/}" |
|
|
|
ext="${file##*.}" |
|
|
|
|
|
|
|
case "$ext" in |
|
|
|
sh|exec|txt|patch|ln) |
|
|
|
case "$ext" in |
|
|
|
sh|exec) type='exec'; mode=0755 ;; |
|
|
|
*) type="$ext"; mode=0644 ;; |
|
|
|
esac |
|
|
|
target="$( echo ${source%.$ext} | tr '_%' '/_' )" |
|
|
|
targetdir="$rootfs/$target"; targetdir="${targetdir%/*}" |
|
|
|
;; |
|
|
|
*) continue ;; |
|
|
|
esac |
|
|
|
|
|
|
|
case "$type" in |
|
|
|
exec|txt) |
|
|
|
echo_status "injecting $target ($type)" |
|
|
|
mkdir -p "$targetdir" |
|
|
|
[ ! -e "$rootfs/$target" ] || rm -f "$rootfs/$target" |
|
|
|
cp -f "$file" "$rootfs/$target" |
|
|
|
chmod $mode "$rootfs/$target" |
|
|
|
;; |
|
|
|
ln) ref=$( cat "$file" ) |
|
|
|
echo_status "injecting $target -> $ref" |
|
|
|
mkdir -p "$targetdir" |
|
|
|
ln -snf "$ref" "$rootfs/$target" |
|
|
|
;; |
|
|
|
patch) |
|
|
|
echo_status "$(patch -p1 -d "${rootfs}" 2>&1 < $file )" |
|
|
|
;; |
|
|
|
esac |
|
|
|
done |
|
|
|
} |
|
|
|
|