96 lines
2.5 KiB
Bash
Executable file
96 lines
2.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# variables
|
|
CWD=$(pwd)
|
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=gwh
|
|
TMP=${TMP:-/tmp/$TAG}
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
PRGNAM=${PRGNAM:-$(basename $CWD)}
|
|
PKG=${PKG:-$TMP/pkg-$PRGNAM}
|
|
|
|
ARCH=${ARCH:-noarch}
|
|
|
|
PREFIX=${PREFIX:-/usr}
|
|
|
|
REPOSITORY=${REPOSITORY:=/home/installs/SlackBuilds/_repositories/$PRGNAM}
|
|
|
|
# nettoyage préalable
|
|
for d in $PKG $TMP/$PRGNAM; do
|
|
[ -d $d ] && rm -fr $d
|
|
done
|
|
|
|
# mise en place
|
|
[ ! -e $REPOSITORY ] && git clone https://github.com/mrfixit2001/updates_repo.git $REPOSITORY
|
|
( cd $REPOSITORY; git pull )
|
|
VERSION="git_$( cd $REPOSITORY/pinebook/ && cat version )"
|
|
|
|
cp -R $REPOSITORY $TMP/$PRGNAM
|
|
cd $TMP/$PRGNAM/
|
|
git checkout v$VERSION
|
|
|
|
mkdir -p $PKG/boot/
|
|
cp $TMP/$PRGNAM/pinebook/filesystem/{idbloader,uboot,trust}.img $PKG/boot/
|
|
cat <<EOF > $PKG/boot/install-boot-imgs.sh
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
grep -q "pinebook-pro" /proc/device-tree/compatible || exit 1
|
|
|
|
echo "Updating U-Boot..."
|
|
SYSPART=\$(findmnt -n -o SOURCE /)
|
|
if echo \$SYSPART | grep -qE 'p[0-9]$' ; then
|
|
DEVID=\$(echo \$SYSPART | sed -e s+'p[0-9]\$'+''+)
|
|
else
|
|
DEVID=\$(echo \$SYSPART | sed -e s+'[0-9]\$'++)
|
|
fi
|
|
echo Identified \$DEVID as device to flash uboot to...
|
|
if [ -f /boot/idbloader.img ] ; then
|
|
echo "Upgrading idbloader.img..."
|
|
dd if=/boot/idbloader.img of=\$DEVID bs=32k seek=1 conv=fsync &>/dev/null
|
|
fi
|
|
if [ -f /boot/uboot.img ] ; then
|
|
echo "Upgrading uboot.img..."
|
|
dd if=/boot/uboot.img of=\$DEVID bs=64k seek=128 conv=fsync &>/dev/null
|
|
fi
|
|
if [ -f /boot/trust.img ] ; then
|
|
echo "Upgrading trust.img..."
|
|
dd if=/boot/trust.img of=\$DEVID bs=64k seek=192 conv=fsync &>/dev/null
|
|
fi
|
|
EOF
|
|
|
|
chmod +x $PKG/boot/install-boot-imgs.sh
|
|
|
|
# correction
|
|
cd $PKG
|
|
chown -R root:root *
|
|
|
|
# embaumement
|
|
mkdir -p $PKG/install
|
|
cat <<EOF > $PKG/install/slack-desc
|
|
# HOW TO EDIT THIS FILE:
|
|
# The "handy ruler" below makes it easier to edit a package description. Line
|
|
# up the first '|' above the ':' following the base package name, and the '|'
|
|
# on the right side marks the last column you can put a character in. You must
|
|
# make exactly 11 lines for the formatting to be correct. It's also
|
|
# customary to leave one space after the ':'.
|
|
|
|
|-----handy-ruler------------------------------------------------------|
|
|
$PRGNAM: $PRGNAM (Pinebook Pro's boot bits)
|
|
$PRGNAM:
|
|
$PRGNAM: run /boot/install-boot-imgs.sh
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM: https://github.com/mrfixit2001/updates_repo
|
|
$PRGNAM:
|
|
EOF
|
|
|
|
# empaquetage
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz
|