From 9d4a2ea280fefba763c954926e328ac9c08552a9 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 28 Dec 2010 21:56:55 +0000 Subject: [PATCH] Weitergemacht git-svn-id: http://svn.brehm-online.com/svn/my-stuff/initramfs/trunk@163 ec8d2aa5-1599-4edb-8739-2b3a1bc399aa --- create_initramfs.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 create_initramfs.sh diff --git a/create_initramfs.sh b/create_initramfs.sh new file mode 100755 index 0000000..78747ec --- /dev/null +++ b/create_initramfs.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +set -e +set -x + +USER=frank + +echo_action() { + action="$1" + shift + printf " %-8s %s\n" "$action" "$*" +} + +KERNEL_VERSION=$1 +if [ -z "${KERNEL_VERSION}" ] ; then + KERNEL_VERSION=$( uname -r ) +fi + +case $KERNEL_VERSION in + 2.6.*-gentoo*) + TARG="-gentoo-2.6" + ;; + 2.6*) + TARG="-2.6" + ;; + *) + TARG="" + ;; +esac + +TARG_LAST=${TARG}-last + +echo "Creating initramfs ..." +cd $( dirname $0 ) || exit 1 + +uid=$( id -u ) +username=$( id -un ) +gid=$( id -g ) +groupname=$( id -gn ) + +if [ "${uid}" = "0" ] ; then + python makeinitramfs.py +else + su -c "python makeinitramfs.py" +fi + +if [ ! -f initramfs ] ; then + echo "File 'initramfs' not found." >&2 + exit 5 +fi + +if [ "${uid}" = "0" ] ; then + chown ${USER} initramfs +else + su -c "chown ${username}:${groupname} initramfs" +fi + + +# vim: ts=4 expandtab -- 2.39.5