Last active
March 2, 2020 08:21
-
-
Save mAster-rAdio/5582270 to your computer and use it in GitHub Desktop.
Ubuntu用Chromium更新スクリプト。http://paste.ubuntu.com/1110824/ からfork。
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
#!/usr/bin/env bash | |
# based on | |
# http://askubuntu.com/questions/112432/chromium-19-for-ubuntu | |
# http://paste.ubuntu.com/1110824/ | |
# https://gist.github.com/uu59/4019433 | |
set -e | |
set -u | |
SCRIPT="Chromium Updater" | |
ICON="--icon=chromium-browser" | |
CURRENT_FILE=~/.config/chromium/build.number | |
TMP_DIR=~/Downloads | |
REQUEST_URL="http://commondatastorage.googleapis.com/chromium-browser-snapshots" | |
notify() { | |
local body="$1" | |
notify-send ${ICON} "${SCRIPT}" "${body}" | |
} | |
error() { | |
local msg="$1" | |
notify-send -u critical ${ICON} "${SCRIPT}" "${msg}" | |
exit 1 | |
} | |
version() { | |
chromium-browser --version || echo "Not Installed" | |
} | |
if [ -n "$(uname -a | grep 'x86_64')" ] ; then | |
LINUX=Linux_x64 | |
else | |
LINUX=Linux | |
fi | |
SCRIPT="${SCRIPT} ${LINUX}" | |
if [ -f ${CURRENT_FILE} ] ; then | |
CURRENT="$(cat ${CURRENT_FILE})" | |
else | |
CURRENT="$(echo "123456" > ${CURRENT_FILE})" | |
fi | |
LATEST="$(curl ${REQUEST_URL}/${LINUX}/LAST_CHANGE)" | |
notify "current:${CURRENT} -> latest:${LATEST}" | |
if [ "${LATEST}" -gt "${CURRENT}" ] ; then | |
notify "We got new Chromium(${LATEST}), Updating!" | |
test -d ${TMP_DIR} || mkdir -p ${TMP_DIR} | |
cd ${TMP_DIR} | |
rm -rf chrome-linux* | |
notify "Downloading new Chromium(${LATEST})!" | |
wget ${REQUEST_URL}/${LINUX}/${LATEST}/chrome-linux.zip | |
notify "Unpacking Chromium(${LATEST})!" | |
unzip chrome-linux.zip | |
cd chrome-linux | |
mv chrome chromium-browser | |
mv chrome-wrapper chromium-browser-wrapper | |
notify "Installing Chromium(${LATEST})!" | |
cp -r * /usr/lib/chromium-browser | |
echo ${LATEST} > ${CURRENT_FILE} | |
notify "We've updated $(version) ({$LATEST})!" | |
elif [ "${LATEST}" -eq "${CURRENT}" ] ; then | |
notify "You're already have latest version $(version) (${CURRENT})" | |
elif [ "${LATEST}" -lt "${CURRENT}" ] ; then | |
notify "Seems like your version newer than one at server? $(version) (${LATEST}), RLLY?!" | |
fi | |
exit 0 |
icon指定が違っていたので修正。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://paste.ubuntu.com/1110824/ が消えていたので保全。