From 34798abf118dc137e951617187ae212fcb6f37f5 Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Thu, 9 Aug 2018 03:29:35 -0700 Subject: [PATCH] New scripts/fixup and move nulib2-version Plan to be able to use /usr/local/lib/raspple2 for other things, so moved the nulib2-version file to a pkginfo subdir. This gave me an excuse to create something I've wanted for awhile: A place to stick legacy code that fixes our mistakes that probably doesn't need to exist forever. I can count the number of people who downloaded 1f8afb6 on a few fingers of one hand most likely, but the change still got published and I can silently fix my mistake without having to stick mostly useless code in install_archive_tools someone's gonna look at three years from now and ask, "does that still need to be there?" No, no it doesn't. And fixup describes succinctly how long that code needs to remain there. And the fix is encapsulated into a nice little blob that's easily removed when the time comes. --- install.sh | 3 +++ scripts/fixup | 39 +++++++++++++++++++++++++++++++++++ scripts/install_archive_tools | 14 ++++++------- 3 files changed, 49 insertions(+), 7 deletions(-) create mode 100755 scripts/fixup diff --git a/install.sh b/install.sh index 8511d80..a530399 100755 --- a/install.sh +++ b/install.sh @@ -71,6 +71,9 @@ if [[ ! $autoAnswerYes ]]; then fi fi +# Fix any mistakes we've made in previous versions +. "$a2cSource/scripts/fixup" + # Install Archive Tools # FIXME: Interim refactoring . "$a2cSource/scripts/install_archive_tools" $noPicoPkg diff --git a/scripts/fixup b/scripts/fixup new file mode 100755 index 0000000..088c1df --- /dev/null +++ b/scripts/fixup @@ -0,0 +1,39 @@ +#! /bin/bash +# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh: + +# fixup - correct any mistakes from previous versions +# +# To the extent possible under law, T. Joseph Carter and Ivan Drucker have +# waived all copyright and related or neighboring rights to the a2cloud +# scripts themselves. Software used or installed by these scripts is subject +# to other licenses. This work is published from the United States. + +# The idea behind this script is to prevent other scripts from becoming a +# minefield of ancient and deprecated code designed to compensate for other +# even more ancient and replaced code that is no longer needed, no longer +# useful, and honestly complicates maintenance of that code. Everything here +# will explain what it does, when it was put here, and it should remain clear +# when the legacy code may be removed. +# +# The use of functions which get immediately called is to try and prevent the +# long spidery conditional blocks a2cloud was originally known for. + +# # Added 2000-00-00 +# fix_some_stupid_mistake() +# { +# # Needed until: Upgrades from 0.0.0 no longer supported +# : +# } +# fix_some_stupid_mistake + +# Added 2018-08-09 +fix_nulib2_version_file_location() +{ + # Needed while: Unreleased 1f8afb6 (2018-08-05) is in use by testers + local ras2_pkginfo="/usr/local/lib/raspple2/pkginfo" + if [[ -f /usr/local/lib/raspple2/nulib2-version ]]; then + sudo install -d -m 755 -o root -g root "$ras2_pkginfo" + sudo mv /usr/local/lib/raspple2/nulib2-version "$ras2_pkginfo" + fi +} +fix_nulib2_version_file_location diff --git a/scripts/install_archive_tools b/scripts/install_archive_tools index e605d85..e04c3be 100755 --- a/scripts/install_archive_tools +++ b/scripts/install_archive_tools @@ -11,7 +11,7 @@ nulib2Version="3.1.0" a2cBinaryURL="http://blocksfree.com/downloads" -versionDir="/usr/local/lib/raspple2" +ras2_pkginfo="/usr/local/lib/raspple2/pkginfo" # Find the path of our source directory a2cSource="$( dirname "${BASH_SOURCE[0]}" )/.." @@ -28,8 +28,8 @@ fi install_nulib2() { nulib2installed= - if [[ -f ${versionDir}/nulib2-version ]]; then - read nulib2Installed < ${versionDir}/nulib2-version + if [[ -f ${ras2_pkginfo}/nulib2-version ]]; then + read nulib2Installed < ${ras2_pkginfo}/nulib2-version fi if [[ $nulib2Installed != $nulib2Version ]]; then @@ -46,8 +46,8 @@ install_nulib2() { fi fi - if [[ -f ${versionDir}/nulib2-version ]]; then - read nulib2Installed < ${versionDir}/nulib2-version + if [[ -f ${ras2_pkginfo}/nulib2-version ]]; then + read nulib2Installed < ${ras2_pkginfo}/nulib2-version fi if [[ $nulib2Installed != $nulib2Version ]]; then @@ -67,8 +67,8 @@ install_nulib2() { ./configure make sudo make install - sudo install -d -m 755 -o root -g root "${versionDir}" - echo ${nulib2Version} | sudo tee "${versionDir}/nulib2-version" >/dev/null + sudo install -d -m 755 -o root -g root "${ras2_pkginfo}" + echo ${nulib2Version} | sudo tee "${ras2_pkginfo}/nulib2-version" >/dev/null fi popd >/dev/null rm -rf "$nulibWork"