Skip to content

Commit

Permalink
Build system: Improve install-utilite script
Browse files Browse the repository at this point in the history
  • Loading branch information
warped-rudi committed Mar 22, 2015
1 parent e0861b0 commit 798cec2
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions 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"

0 comments on commit 798cec2

Please sign in to comment.