Browse Source

x230: add package-upgrade script

pull/36/head
Martin Kepplinger 5 years ago
parent
commit
21457e191d
4 changed files with 91 additions and 0 deletions
  1. +6
    -0
      x230/NEWS
  2. +1
    -0
      x230/README.md
  3. +1
    -0
      x230/release.sh
  4. +83
    -0
      x230/upgrade.sh

+ 6
- 0
x230/NEWS View File

@ -1,4 +1,10 @@
skulls-x230 0.0.9 - tbd
---------------------------------------
This release includes the following changes:
* added script to check for new releases
skulls-x230 0.0.8 - released 2018-07-06
---------------------------------------
This release includes the following changes:


+ 1
- 0
x230/README.md View File

@ -36,6 +36,7 @@ Before starting, run Linux on your X230, install `dmidecode` and run
`sudo ./x230_before_first_install.sh`. It simply prints system information and helps
you find out your RAM voltage. Make sure you have RAM that uses
[1,5V, not 1,35V](https://www.coreboot.org/Intel_Native_Raminit#Sandybridge.2FIvybridge).
Also make sure you have the latest skulls-x230 package release by running `./upgrade.sh`.
#### original BIOS update / EC firmware (optional)
Before flashing coreboot, consider doing one original Lenovo upgrade process


+ 1
- 0
x230/release.sh View File

@ -116,6 +116,7 @@ tar -cJf skulls-x230-"${version}".tar.xz \
x230_heads.sh \
external_install_bottom.sh \
external_install_top.sh \
upgrade.sh \
SOURCE.md \
"${RELEASE_IMAGE_FILE}" \
"${RELEASE_IMAGE_FILE}.sha256"


+ 83
- 0
x230/upgrade.sh View File

@ -0,0 +1,83 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0+
# Copyright (C) 2018, Martin Kepplinger <martink@posteo.de>
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
set -e
usage()
{
echo "Skulls for the X230"
echo ""
echo " This script checks if there's a newer"
echo " release of the X230 Skulls package available."
echo ""
echo "Usage: $0"
}
args=$(getopt -o h -- "$@")
if [ $? -ne 0 ] ; then
usage
exit 1
fi
eval set -- "$args"
while [ $# -gt 0 ]
do
case "$1" in
-h)
usage
exit 1
;;
--)
shift
break
;;
*)
echo "Invalid option: $1"
exit 1
;;
esac
shift
done
command -v curl >/dev/null 2>&1 || { echo -e >&2 "${RED}Please install curl.${NC}"; exit 1; }
CURRENT_VERSION=$(head -2 NEWS | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")
UPSTREAM_FILE=$(curl -s https://api.github.com/repos/merge/skulls/releases/latest | grep browser_download_url | cut -d'"' -f4 | cut -d'/' -f9 | head -n 1)
UPSTREAM_VERSION=$(curl -s https://api.github.com/repos/merge/skulls/releases/latest | grep browser_download_url | cut -d'"' -f4 | cut -d'/' -f9 | head -n 1 | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")
UPSTREAM_X230=$(echo ${UPSTREAM_FILE} | grep x230)
if [[ -z "$UPSTREAM_X230" ]] ; then
echo "The latest release didn't include the X230"
exit 0
fi
if [[ "$CURRENT_VERSION" = "$UPSTREAM_VERSION" ]] ; then
echo -e "${GREEN}You are using the latest version of Skulls for the X230${NC}"
exit 0
else
echo -e "${RED}You have ${CURRENT_VERSION} but there is version ${UPSTREAM_VERSIONJ} available for the X230. Please update.${NC}"
read -r -p "Download it to the parent directory now? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
UPSTREAM_URL=$(curl -s https://api.github.com/repos/merge/skulls/releases/latest | grep browser_download_url | cut -d'"' -f4 | head -n 1)
UPSTREAM_URL_SHA256=$(curl -s https://api.github.com/repos/merge/skulls/releases/latest | grep browser_download_url | cut -d'"' -f4 | head -n 3 | tail -n 1)
cd ..
curl -LO ${UPSTREAM_URL}
curl -LO ${UPSTREAM_URL_SHA256}
sha256sum -c ${UPSTREAM_FILE}.sha256
mkdir skulls-x230-${UPSTREAM_VERSION}
cd skulls-x230-${UPSTREAM_VERSION}
tar -xf ${UPSTREAM_FILE} -C skulls-x230-${UPSTREAM_VERSION}/
echo "Version ${UPSTREAM_VERSION} extracted to ../skulls-x230-${UPSTREAM_VERSION}/"
;;
*)
exit 0
;;
esac
fi

Loading…
Cancel
Save