summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoromega <marco.biasco@gmail.com>2009-08-19 10:43:08 +0200
committeromega <marco.biasco@gmail.com>2009-08-19 10:43:08 +0200
commita65987c08feba909ea01f88e430788fa78792b0b (patch)
treeb02f9b7e25f784de75c3e8319d95a97bbb50c1bd
parentaf1f69d01cf36df4e36968b377aef2a775fdbbd4 (diff)
downloadscripts-a65987c08feba909ea01f88e430788fa78792b0b.tar.gz
scripts-a65987c08feba909ea01f88e430788fa78792b0b.tar.bz2
Applied spinner.patch
-rwxr-xr-xgit-compiz198
-rw-r--r--po/en.po2
2 files changed, 128 insertions, 72 deletions
diff --git a/git-compiz b/git-compiz
index c9f8959..37499a2 100755
--- a/git-compiz
+++ b/git-compiz
@@ -16,6 +16,9 @@
#########################################################################################################################################
####### DO NOT EDIT THIS FILE ! #########################################################################################################
#########################################################################################################################################
+SPPID=0
+
+trap "kill $SPPID" EXIT
## Locales
# check if locale file to import exist, then import them, else set default locale (english)
@@ -45,7 +48,8 @@ fi
test -f $0.local && source $0.local
-LOG_FILE=/tmp/`echo $0 | sed -e s,./,,`-$$.log
+#LOG_FILE=/tmp/`echo $0 | sed -e s,./,,`-$$.log
+LOGDIR=$(mktemp -d /tmp/git-compiz.XXXXXXXX)
## Check arch for libdir
ARCH=`uname -m`
@@ -180,6 +184,7 @@ exit 0
## Fix Gnome-WM
gwm_fix()
{
+LOG_FILE=/dev/null
if [ -f /etc/SuSE-release ]; then
echo $ERROR_GWM_SUSE
exit 2
@@ -325,20 +330,20 @@ printinfo()
OTHER_ARGS="`echo $@ | sed -e s:$1\ :: `"
case $1 in
space)
- echo "_____________________________________________________" | tee -a $LOG_FILE
- echo | tee -a $LOG_FILE
+ echo "_____________________________________________________"
+ echo
;;
info)
- echo -n " * $OTHER_ARGS" | tee -a $LOG_FILE
+ echo -n " * $OTHER_ARGS"
;;
trail)
- echo "...........$OTHER_ARGS" | tee -a $LOG_FILE
+ echo "...........$OTHER_ARGS"
;;
error)
- echo " -> $OTHER_ARGS" | tee -a $LOG_FILE
+ echo " -> $OTHER_ARGS"
;;
warning)
- echo " WARNING: $OTHER_ARGS" | tee -a $LOG_FILE
+ echo " WARNING: $OTHER_ARGS"
;;
esac
}
@@ -350,7 +355,7 @@ printinfo info $INFO_CHECK_DEP;
printinfo echo
# If any dependencies fail, alert the user
-if [ -z "`(for onedep in tee svn git make python cmake; do [ -f $(which $onedep) ] || echo "FAIL"; done ) | grep FAIL`" ]; then
+if (for onedep in tee svn git make python cmake; do (which $onedep &>/dev/null) || break ; done ); then
printinfo trail $INFO_OK
printinfo space
else
@@ -366,7 +371,7 @@ check_internet_status()
{
if [ "$SKIP_UPDATE" != "true" ]; then
printinfo info $INFO_INTERNET_STATUS;
- if ! logcmd ping -c 2 google.com; then
+ if ! ping -c 2 google.com &>/dev/null; then
printinfo trail $INFO_ERROR
return 1;
fi
@@ -378,17 +383,39 @@ fi
## Asks if we want to bail out.
bail_ask()
{
-logcmd echo "$1"
-logcmd echo -n $INFO_ABORT
+echo "$1"
+echo -n $INFO_ABORT
read -p " [Y/n]: " -n1 continue;
if [ "$(echo $continue | tr [:upper:] [:lower:])" = "y" -o "$continue" = "" ]; then
- logcmd echo
+ echo
exit 3;
fi
-logcmd echo
+echo
printinfo space
}
+# Our Nice little spinner
+spinner()
+{
+MESSAGE=$@
+if [ x$DEBUG == "false" ]; then
+ until test -f $LOGDIR/stop; do
+ echo -en "\r | $MESSAGE"
+ sleep 0.1
+ echo -en "\r / $MESSAGE"
+ sleep 0.1
+ echo -en "\r - $MESSAGE"
+ sleep 0.1
+ echo -en "\r \\ $MESSAGE"
+ sleep 0.1
+ done
+ echo -e "\r * $MESSAGE"
+else
+ echo " * $MESSAGE"
+fi
+rm $LOGDIR/stop
+}
+
## Checks if a local directory for $1 exist (last part of it),
## if it does; attempts to git pull, otherwise git clone.
# TODO: Extend this to support svn, bzr, hg or any others (should be flexible)
@@ -400,10 +427,10 @@ if (echo $1 | grep -q '%writeto%'); then
else
b=`echo $1 | sed 's/.*\///g'`
fi
-logcmd echo ">> $b <<"
-logcmd echo
+echo ">> $b <<"
+echo
-test -f branches/$BRANCH || logcmd echo "${ERROR_BRANCH//%s/branches/$BRANCH}"
+test -f branches/$BRANCH || echo "${ERROR_BRANCH//%s/branches/$BRANCH}"
# Get the branch
CURRENT_ITEM=$b source branches/$BRANCH
@@ -414,27 +441,29 @@ if [ -d $b -o -d $b-http ]; then
# Revert any patched files
if (find . 2>/dev/null | grep -q '\.orig'); then
printinfo info $INFO_REVERT_PATCH;
- logcmd echo
+ echo
for orig in `find . -name '*.orig'`; do
mv $orig `echo $orig | sed 's,.orig,,'` >/dev/null
done
fi
if [ "$SKIP_UPDATE" != "true" -a "$UNDO_LAST_UPDATE" != "yes" -a -z "`echo $b | grep -e tar.bz2 -e tar.gz -e zip`" ]; then
- printinfo info "${INFO_UPDATE//%s/$b}";
- logcmd echo
+ spinner "${INFO_UPDATE//%s/$b}" &
+ SPPID=$!
git pull | grep -q "Already up-to-date."
test=`echo $?`
+ touch $LOGDIR/stop
+ sleep 0.4
if (! (echo $GIT_BRANCH | grep -qie HEAD -qie master)) && \
(git show-branch $GIT_BRANCH &>/dev/null) && \
[ x$SWITCH_BRANCH == x"force" ]; then
printinfo info "${INFO_SWITCH//%s/'$(echo $GIT_BRANCH | sed 's|.*/||g')'}";
- logcmd echo
- logcmd git checkout -b $(echo $GIT_BRANCH | sed 's|.*/||g') --track $GIT_BRANCH
+ echo
+ git checkout -b $(echo $GIT_BRANCH | sed 's|.*/||g') --track $GIT_BRANCH
fi
cd $here
elif [ "$UNDO_LAST_UPDATE" == "yes" -a -z "`echo $b | grep -e tar.bz2 -e tar.gz -e zip`" ]; then
printinfo info "${INFO_UNDO//%s/$b}";
- logcmd echo
+ echo
git reset --hard HEAD^ &>/dev/null
test=1
else test=0
@@ -443,21 +472,21 @@ if [ -d $b -o -d $b-http ]; then
else
if ! (echo $b | grep -qe zip -qe tar.gz -qe tar.bz2); then
printinfo info "${INFO_CLONE//%s/$b}";
- logcmd echo
+ echo
git clone $2$1
cd $b
if (! (echo $GIT_BRANCH | grep -qie HEAD -qie master)) && \
(git show-branch $GIT_BRANCH &>/dev/null); then
printinfo info "${INFO_SWITCH//%s/'$(echo $GIT_BRANCH | sed 's|.*/||g')'}";
- logcmd echo
- logcmd git checkout -b $(echo $GIT_BRANCH | sed 's|.*/||g') --track $GIT_BRANCH
+ echo
+ git checkout -b $(echo $GIT_BRANCH | sed 's|.*/||g') --track $GIT_BRANCH
fi
cd $here
test=1
else
# download via wget
printinfo info "${INFO_DOWNLOAD//%s/$b}";
- logcmd echo
+ echo
if (echo $1 | grep -q '%writeto%'); then
wget -O $b -nv `echo $1 | sed 's|%writeto%.*||'`
else
@@ -465,16 +494,16 @@ else
fi
# extract
printinfo info "${INFO_EXTRACT//%s/$b}";
- logcmd echo
+ echo
(echo $b | grep -qe tar.bz2 -qe tar.gz -qe zip) && \
mkdir $b-http && cd $b-http && \
(if (echo $b | grep -q tar.bz2); then
- logcmd tar -xjf $OLDPWD/$b
+ tar -xjf $OLDPWD/$b
elif (echo $b | grep -q tar.gz); then
- logcmd tar -xzf $OLDPWD/$b
+ tar -xzf $OLDPWD/$b
elif (echo $b | grep -q zip); then
- logcmd unzip $OLDPWD/$b
+ unzip $OLDPWD/$b
fi) && \
[ -d "$(ls)" ] && export USELESSDIR=$(ls) && mv $USELESSDIR/* ./ && rmdir $USELESSDIR
@@ -497,12 +526,13 @@ printinfo space
# $1 == Git object currently being handled
build_patch()
{
+LOG_FILE="$LOGDIR/patch-$1.log"
# CPWD is taken from build_wrapper
for mypatch in $PATCHES; do
# If it exists in a format we can use, apply it
if [ -f $mypatch -a x`cat $mypatch | grep GIT_OBJECT | sed 's,GIT_OBJECT=,,'` == x"$1" ]; then
printinfo info "${INFO_APPLY//%s/`basename $mypatch`}";
- logcmd echo
+ echo
cd $1
# Use --backup here so they can be reverted later on
logcmd patch --backup -p1 <$CPWD/$mypatch
@@ -515,15 +545,19 @@ done
# $1 == Git object currently being handled
build_clean()
{
+LOG_FILE="$LOGDIR/clean-$1.log"
# CPWD is taken from build_wrapper
cd $1
-printinfo info $INFO_CLEAN;
-logcmd echo
+spinner $INFO_CLEAN &
+SPPID=$!
if [ -d build -a -f CMakeLists.txt ]; then
root rm -rf build
fi
logcmd make clean
-if [ $? -ne 0 ]; then
+EXST=$?
+touch $LOGDIR/stop
+sleep 0.4
+if [ $EXST -ne 0 ]; then
printinfo warning $WARNING_CLEAN;
cd $CPWD
return 1
@@ -538,12 +572,16 @@ cd $CPWD
# $2 == autogen arguments
build_autoconf()
{
+LOG_FILE="$LOGDIR/conf-$1.log"
# CPWD is taken from build_wrapper
cd $1
-printinfo info $INFO_CONFIGURE;
-logcmd echo
+spinner $INFO_CONFIGURE &
+SPPID=$!
logcmd env PKG_CONFIG_PATH=$DESTDIR$PREFIX/$LIBDIR/pkgconfig:$DESTDIR$PREFIX/share/pkgconfig:$PKG_CONFIG_PATH ./autogen.sh $2
-if [ $? -ne 0 ]; then
+EXST=$?
+touch $LOGDIR/stop
+sleep 0.4
+if [ $EXST -ne 0 ]; then
printinfo error $ERROR_AUTOGEN;
printinfo space
cd $CPWD
@@ -557,10 +595,11 @@ cd $CPWD
# $2 == cmake arguments
build_cmake()
{
+LOG_FILE="$LOGDIR/conf-$1.log"
# CPWD is taken from build_wrapper
cd $1
-printinfo info $INFO_CONFIGURE;
-logcmd echo
+spinner $INFO_CONFIGURE &
+SPPID=$!
test -d build || mkdir build
cd build
if [ $LIBDIR == "lib64" ]; then
@@ -570,7 +609,10 @@ else
logcmd env PKG_CONFIG_PATH=$DESTDIR$PREFIX/$LIBDIR/pkgconfig:$DESTDIR$PREFIX/share/pkgconfig:$PKG_CONFIG_PATH \
cmake -D CMAKE_INSTALL_PREFIX=$PREFIX $2 $CPWD/$1
fi
-if [ $? -ne 0 ]; then
+EXST=$?
+touch $LOGDIR/stop
+sleep 0.4
+if [ $EXST -ne 0 ]; then
printinfo error $ERROR_CMAKE;
printinfo space
cd $CPWD
@@ -585,6 +627,7 @@ cd $CPWD
# $2 == autoconf/cmake
build_make()
{
+LOG_FILE="$LOGDIR/make-$1.log"
# CPWD is taken from build_wrapper
cd $1
if [ x$2 == x"cmake" ]; then
@@ -593,18 +636,23 @@ if [ x$2 == x"cmake" ]; then
cd build
fi
if [ x$NOBUILD != x"yes" ]; then
- printinfo info $INFO_COMPILE
- logcmd echo
- logcmd env PKG_CONFIG_PATH=$DESTDIR$PREFIX/$LIBDIR/pkgconfig:$DESTDIR$PREFIX/share/pkgconfig:$PKG_CONFIG_PATH make -j$JOBS
- if [ $? -ne 0 ]; then
+ spinner $INFO_COMPILE &
+ SPPID=$!
+ logcmd env PKG_CONFIG_PATH=$DESTDIR$PREFIX/$LIBDIR/pkgconfig:$DESTDIR$PREFIX/share/pkgconfig:$PKG_CONFIG_PATH make -j$JOBS
+ EXST=$?
+ touch $LOGDIR/stop
+ sleep 0.4
+ if [ $EXST -ne 0 ]; then
printinfo error $ERROR_MAKE;
printinfo space
cd $CPWD
return 1
fi
fi
-printinfo info $INFO_INSTALL;
-logcmd echo
+
+LOG_FILE="$LOGDIR/install-$1.log"
+spinner $INFO_INSTALL &
+SPPID=$!
if [ -f autogen.sh ] || [ x$2 == x"cmake" ]; then
root env BUILD_GLOBAL=true \
PKG_CONFIG_PATH=$DESTDIR$PREFIX/$LIBDIR/pkgconfig:$DESTDIR$PREFIX/share/pkgconfig:$PKG_CONFIG_PATH \
@@ -625,7 +673,10 @@ else
DATADIR=\"$DESTDIR$PREFIX/share/compiz\" \
} install
fi
-if [ $? -ne 0 ]; then
+EXST=$?
+touch $LOGDIR/stop
+sleep 0.4
+if [ $EXST -ne 0 ]; then
printinfo error $ERROR_SUDO_MAKE;
printinfo space
cd $CPWD
@@ -646,7 +697,7 @@ CPWD=$PWD
if [ "$SKIP_INSTALL" == "true" -o $test -ne 1 ] && [ "$FORCE_REBUILT" != "true" \
-a -z "`(for dir in $FORCE_REBUILT; do [ $dir != $1 ] || echo "yes"; done) | grep yes`" ]; then
printinfo info "${INFO_SKIP//%s/$1}";
- logcmd echo
+ echo
printinfo space
return;
fi
@@ -672,7 +723,7 @@ export PKG_CONFIG_PATH=$DESTDIR$PREFIX/$LIBDIR/pkgconfig:$DESTDIR$PREFIX/share/p
if [ -f $1/setup.py ]; then
cd $1
printinfo info $INFO_INSTALL;
- logcmd echo
+ echo
root python setup.py install ${DESTDIR:+ --root=$DESTDIR} --prefix=$PREFIX
printinfo space
cd $CPWD
@@ -695,14 +746,14 @@ elif [ -f $1/Makefile ]; then
build_make "$1"
elif [ -f $1/compiz-manager ]; then
printinfo info $INFO_INSTALL;
- logcmd echo
+ echo
sed -e s:COMPIZ_BIN_PATH=\"/usr/local/bin/\":COMPIZ_BIN_PATH=\"$PREFIX/bin/\": -e s:PLUGIN_PATH=\"/usr/local/lib/compiz/\":PLUGIN_PATH=\"$PREFIX/$LIBDIR/compiz/\": -e s:/lib/:/$LIBDIR/:g $1/compiz-manager >$1/compiz-manager.temp
root install -m 755 $1/compiz-manager.temp $DESTDIR$PREFIX/bin/compiz-manager
rm $1/compiz-manager.temp
printinfo space
elif [ "$3" != "" ]; then
printinfo info $INFO_INSTALL;
- logcmd echo
+ echo
cd $1
$3 $2
cd $CPWD
@@ -719,22 +770,25 @@ unofficial_icons()
{
b="unofficial-compiz-fusion-icons"
CPWD=$PWD
-logcmd echo ">> $b <<"
+echo ">> $b <<"
if [ ! -d $b ]; then
- printinfo info "${INFO_CHECK_OUT//%s/$b}"
- logcmd echo
- logcmd svn co http://compiz-fusion-icons.googlecode.com/svn/trunk $b
+ spinner "${INFO_CHECK_OUT//%s/$b}" &
+ SPPID=$!
+ svn co http://compiz-fusion-icons.googlecode.com/svn/trunk $b >/dev/null
+ touch $LOGDIR/stop
else
if [ "$SKIP_UPDATE" != "true" -a -d $b ]; then
- printinfo info "${INFO_UPDATE//%s/$b}";
- logcmd echo
+ spinner "${INFO_UPDATE//%s/$b}" &
+ SPPID=$!
cd $b
svn update | grep -q "At revision"
- test=`echo $?`
+ test=$?
+ touch $LOGDIR/stop
cd $CPWD
fi
fi
+sleep 0.4
build_wrapper $b none "root ./install.sh --prefix=$DESTDIR$PREFIX --$UNOFFICIAL_ICONS_THEME"
}
@@ -743,19 +797,21 @@ opencv()
{
b="opencv"
CPWD=$PWD
-logcmd echo ">> $b <<"
+echo ">> $b <<"
if [ ! -d $b ]; then
- printinfo info "${INFO_CHECK_OUT//%s/$b}"
- logcmd echo
- logcmd svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/trunk .
+ spinner "${INFO_CHECK_OUT//%s/$b}" &
+ SPPID=$!
+ svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/trunk . >/dev/null
+ touch $LOGDIR/stop
else
if [ "$SKIP_UPDATE" != "true" -a -d $b ]; then
- printinfo info "${INFO_UPDATE//%s/$b}";
- logcmd echo
+ spinner "${INFO_UPDATE//%s/$b}" &
+ SPPID=$!
cd $b
svn update | grep -q "At revision"
- test=`echo $?`
+ test=$?
+ touch $LOGDIR/stop
cd $CPWD
fi
fi
@@ -763,12 +819,12 @@ fi
build_wrapper $b "-D CMAKE_BUILD_TYPE=RELEASE -D BUILD_PYTHON_SUPPORT=ON"
}
-logcmd echo
-logcmd echo ">>> G I T - C O M P I Z <<<"
+echo
+echo ">>> G I T - C O M P I Z <<<"
printinfo space
-printinfo info "${INFO_LOG_FILE//%s/$LOG_FILE}";
-logcmd echo
+printinfo info "${INFO_LOG_FILE//%s/$LOGDIR}";
+echo
printinfo space
## Check dependencies and internet status
@@ -782,7 +838,7 @@ fi
if [ "$SKIP_UPDATE" != "true" ]; then
b=`echo "users/omega/scripts" | sed 's/.*\///g'`
printinfo info "${INFO_UPDATE//%s/git-compiz}";
- logcmd echo
+ echo
git pull | grep -q "Already up-to-date."
test=`echo $?`
@@ -801,7 +857,7 @@ get_repo $CORE $REPO
## Build compiz core first, and no need to continue if it fails.
if ! build_wrapper core "$ARGS --prefix=$PREFIX --libdir=$PREFIX/$LIBDIR"; then
- logcmd echo $ERROR_CORE;
+ echo $ERROR_CORE;
exit 2;
fi
diff --git a/po/en.po b/po/en.po
index ee73ca8..b480096 100644
--- a/po/en.po
+++ b/po/en.po
@@ -82,7 +82,7 @@ INFO_FIX_STARTUP="Fixing startup session..."
INFO_GWM="Enabling Compiz via Simple-CCSM will now work"
INFO_INSTALL="Installing new version"
INFO_INTERNET_STATUS="Checking internet connection"
-INFO_LOG_FILE="Writing log file to %s"
+INFO_LOG_FILE="Writing log files to %s"
INFO_OK="OK"
INFO_REVERT_PATCH="Reverting patched files"
INFO_SKIP="Skipping %s"