From 798cec292cea5e5fd759c8bb79d76434e14ccbc3 Mon Sep 17 00:00:00 2001 From: Rudi Date: Sun, 22 Mar 2015 11:59:21 +0100 Subject: [PATCH] Build system: Improve install-utilite script --- scripts/install-utilite | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/scripts/install-utilite b/scripts/install-utilite index f1b4bdda41..4e5b8b0348 100755 --- a/scripts/install-utilite +++ b/scripts/install-utilite @@ -1,41 +1,43 @@ #!/bin/sh - CUSTOM_ARCHIVE="$1" -if ! [ ${CUSTOM_ARCHIVE} ] ; then - printf "${CUSTOM_ARCHIVE} doesn't exist !\n" +if [ -n "${CUSTOM_ARCHIVE}" ] && [ ! -f ${CUSTOM_ARCHIVE} ]; then + printf "Archive ${CUSTOM_ARCHIVE} doesn't exist !\n" exit 1 -else - ARCHIVE="`basename ${CUSTOM_ARCHIVE}`" fi -mkdir -p /root/install-utilite/temp + +WORKDIR=$HOME/install-utilite +rm -rf $WORKDIR/temp +mkdir -p $WORKDIR/temp if [ -f ${CUSTOM_ARCHIVE} ] ; then - ln -s ${CUSTOM_ARCHIVE} /root/install-utilite/$ARCHIVE + ARCHIVE="`basename ${CUSTOM_ARCHIVE}`" + ln -sf ${CUSTOM_ARCHIVE} $WORKDIR/$ARCHIVE else ARCH_SRC="http://download.geexbox.org/snapshots/geexbox-xbmc-imx6-utilite/latest/binaries.utilite" - ARCHIVE=`curl http://download.geexbox.org/snapshots/geexbox-xbmc-imx6-utilite/latest/binaries.utilite/ -s| grep tar.xz | cut -d'"' -f2` + ARCHIVE=`curl $ARCH_SRC/ -s | grep "tar\.xz" | cut -d'"' -f2` printf "Downloading $ARCH_SRC/$ARCHIVE ...\n" - wget $ARCH_SRC/$ARCHIVE -O /root/install-utilite/$ARCHIVE + curl -o $WORKDIR/$ARCHIVE $ARCH_SRC/$ARCHIVE fi printf "Mounting partitions ...\n" -mount /dev/sda2 /root/install-utilite/temp +mount /dev/sda2 $WORKDIR/temp printf " Erasing all data in /dev/sda2 ...\n" -rm -rf /root/install-utilite/temp/* +rm -rf $WORKDIR/temp/* -mkdir /root/install-utilite/temp/boot -mount /dev/sda1 /root/install-utilite/temp/boot +mkdir $WORKDIR/temp/boot +mount /dev/sda1 $WORKDIR/temp/boot printf " Erasing all data in /dev/sda1 ...\n" -rm -rf /root/install-utilite/temp/boot/* +rm -rf $WORKDIR/temp/boot/* printf "Unpacking archive ...\n" -tar --no-same-owner -xaf /root/install-utilite/$ARCHIVE -C /root/install-utilite/temp +tar --no-same-owner -xaf $WORKDIR/$ARCHIVE -C $WORKDIR/temp printf "Done, Unmounting partitions ...\n" umount /dev/sda1 umount /dev/sda2 +sync printf "Please reboot, removing your µsdcard.\n"