Browse Source

Moved initramfs output format's initramfs_install_overlay to a global lib/overlay/overlay-functions.in under the name of overlay_apply

karasz/new-early
Alejandro Mery 18 years ago
parent
commit
4e196129e5
3 changed files with 76 additions and 42 deletions
  1. +56
    -0
      lib/overlay/overlay-functions.in
  2. +15
    -0
      lib/overlay/parse-config
  3. +5
    -42
      target/share/initramfs.in

+ 56
- 0
lib/overlay/overlay-functions.in

@ -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
}

+ 15
- 0
lib/overlay/parse-config

@ -0,0 +1,15 @@
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: lib/overlay/parse-config
# Copyright (C) 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 ---
. "$base/lib/overlay/overlay-functions.in"

+ 5
- 42
target/share/initramfs.in

@ -12,6 +12,10 @@
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
# source overlay functions, to wrap overlay_apply behind initramfs_install_overlay
#
. "$base/lib/overlay/overlay-functions.in"
# functions
#
@ -31,50 +35,9 @@ initramfs_install_flist() {
tar -C "$rootfs" -xf-
}
# apply an overlay
initramfs_install_overlay() {
local overlaydir="$1" rootfs="$2"
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
}
# weak functions
#
initramfs_install_overlay() { overlay_apply "$@"; }
# should this package be extracted by flist or not?
# initramfs_install <pkg_name> <sandbox> <rootfs>

Loading…
Cancel
Save