View previous topic :: View next topic |
Author |
Message |
nichao n00b
Joined: 24 Nov 2002 Posts: 17 Location: Germany
|
Posted: Sun Nov 24, 2002 10:33 am Post subject: Script: Change USE flags according to ebuild to be merged |
|
|
Well, I was searching for a script/program to change the USE flags of an ebuild - and that means only the USE flags it has specified in the .ebuild - interactively before merging it. Unfortunately, I didn't find one, so I had to do a little shell script by myself
It might really suck, but here is it - I placed it as /usr/sbin/cemerge (custom emerge):
Code: |
#!/bin/sh
# Change USE flags according to the ebuild to be merged
# and emerge it afterwards.
# --- BEGINNING OF USER SETTINGS ---
# Set your favourite editor
EDITOR=$EDITOR
# Set this to your PORTDIR_OVERLAY setting in make.conf
PO=/usr/portage.local
# Set temporary directory
TEMP=/tmp
# --- END OF USER SETTINGS ---
DIR=`emerge -s ^$1$ | grep \*.*$1 | head -n1 | sed -e 's/*\ //' | tr -d '[:space:]'`
if [ "$DIR" == "" ]
then
echo ""
echo "The specified ebuild does not exist."
echo ""
exit
fi
VERSION=`emerge -s ^$1$ | grep "Latest version available:" | head -n1 | sed -e 's/Latest\ version\ available\://' | tr -d '[:space:]'`
EBUILD=$PO/$DIR/$1-$VERSION.ebuild
if [ ! -f "$EBUILD" ]
then
EBUILD=/usr/portage/$DIR/$1-$VERSION.ebuild
if [ ! -f "$EBUILD" ]
then
echo ""
echo "FATAL ERROR: I can't find the ebuild!"
echo ""
exit
fi
fi
USEFLAGS=`cat $EBUILD | grep IUSE | head -n1 | sed -e 's/IUSE/USE/'`
if [ "$USEFLAGS" == "" ]
then
echo ""
echo "NOTICE: There are no USE flags to be set or available USE flags are not defined in the ebuild."
echo ""
emerge $1
exit
fi
if [ -f /tmp/$1-$VERSION.use_flags.temp ]
then
rm /tmp/$1-$VERSION.use_flags.temp
fi
echo $USEFLAGS >> /tmp/$1-$VERSION.use_flags.temp
$EDITOR /tmp/$1-$VERSION.use_flags.temp
FLAGS=`cat /tmp/$1-$VERSION.use_flags.temp | grep USE= | head -n1`
if [ -f /tmp/$1-$VERSION.use_flags.temp ]
then
rm /tmp/$1-$VERSION.use_flags.temp
fi
FLAGS=`echo "$FLAGS" | sed -e 's/USE=//'`
export USE=$FLAGS
emerge $1
# EOF. |
Maybe someone finds it useful.. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|