Skip to content

Commit

Permalink
Make it Possible to Re-Bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaiede committed Nov 18, 2019
1 parent 5c01381 commit d8f09e7
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 9 deletions.
25 changes: 22 additions & 3 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# Bootstraps RPiLight on a Fresh Raspberry Pi
#

function usage()
{
echo "usage: bootstrap.sh [nobuild]"
}

#
# Detecting Distro
#
Expand Down Expand Up @@ -123,6 +128,18 @@ function install_dependencies() {
#
# Script Flow
#
BUILD=1

while [ "$1" != "" ]; do
case $1 in
nobuild ) BUILD=0
;;
* ) usage
exit 1
esac
shift
done

process_distro
cd ~

Expand All @@ -132,9 +149,11 @@ install_dependencies
#
# Clone & Build
#
git clone https://github.com/Kaiede/RPiLight.git
pushd ~/RPiLight > /dev/null
if [ "$BUILD" == "1" ]; then
git clone https://github.com/Kaiede/RPiLight.git
pushd ~/RPiLight > /dev/null

./build.sh stable install
./build.sh stable install
fi

popd > /dev/null
34 changes: 28 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@

function usage()
{
echo "usage: build.sh [stable | latest] [package] [install]"
echo "usage: build.sh [bootstrap] [stable | latest] [package] [install]"
echo
echo " bootstrap - Fetch latest Swift & Packages (like bootstrap.sh)"
echo " stable | latest - Stable fetches latest release, latest contains newer changes"
echo " install - Install to /opt/rpilight"
echo
echo "WARNING: package option is currently unsupported"
}

#
Expand All @@ -35,23 +41,32 @@ function ensure_swift_in_path() {
fi
}

#
# Run Bootstrap Again for Swift/Packages
#
function run_bootstrap() {
echo "Running Bootstrap"
bash ./bootstrap.sh nobuild
}

#
# Grab Latest Tag
#
function update_latest_source() {
echo "Fetching Latest Source"
git checkout master
git pull --rebase
}

#
# Grab Latest Git State
#
function update_stable_source() {
echo "Fetching Tags"
git fetch
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Updating to $LATEST_TAG..."
git checkout $LATEST_TAG
echo "Fetching Tags"
git fetch
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Updating to $LATEST_TAG..."
git checkout $LATEST_TAG
}

#
Expand Down Expand Up @@ -198,9 +213,12 @@ function configure_service() {
FETCH=0
PACKAGE=0
INSTALL=0
BOOTSTRAP=0

while [ "$1" != "" ]; do
case $1 in
bootstrap) BOOTSTRAP=1
;;
stable | latest ) FETCH=$1
;;
package ) PACKAGE=1
Expand Down Expand Up @@ -241,6 +259,10 @@ elif [ "$FETCH" == "latest" ]; then
update_latest_source
fi

if [ "$BOOTSTRAP" == "1" ]; then
run_bootstrap
fi

build_rpilight

if [ "$PACKAGE" == "1" ]; then
Expand Down

0 comments on commit d8f09e7

Please sign in to comment.