Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build system: Improve install-utilite script
- Loading branch information
1 parent
e0861b0
commit 798cec2
Showing
1 changed file
with
17 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |