Skip to content

Commit

Permalink
remove lcd drive which breaks pi zero, support node in pi zero
Browse files Browse the repository at this point in the history
  • Loading branch information
fuji246 committed Sep 26, 2019
1 parent 0788d6a commit 0cbe0a8
Show file tree
Hide file tree
Showing 7 changed files with 406 additions and 35 deletions.
2 changes: 1 addition & 1 deletion config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
IMG_NAME="lomorage"
STAGE_LIST="stage0 stage1 stage2 stage-lcd-show stage-localtunnel stage-share"
STAGE_LIST="stage0 stage1 stage2 stage-localtunnel stage-share"
ENABLE_SSH=1
123 changes: 123 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#!/bin/bash

# MIT License
#
# Copyright (c) 2017 Mauro Bringolf
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

CAPITALIZE() {
first_capital="$(echo "$1"|cut -c1|tr '[:lower:]' '[:upper:]' )"
rest_regular="$(echo "$1"|cut -c2-)"
echo "$first_capital$rest_regular"
}

CREATE_CHANGELOG() {

# Definition of default commit types
COMMIT_TYPES=( breaking bugfix feature frontend backend workflow testing documentation internal )

# String to accumulate changelog
CONTENT=""

# Get all commits with type annotations and make them paragraphs.
for TYPE in "${COMMIT_TYPES[@]}"
do
if [ -z "$1" ]
then
PARAGRAPH="$(git log --format="* %s (%h)" --grep="^\[${TYPE}\]")"
else
PARAGRAPH="$(git log "$1"..HEAD --format="* %s (%h)" --grep="^\[${TYPE}\]")"
fi
if [ ! -z "$PARAGRAPH" ]
then
TITLE="$(CAPITALIZE "$TYPE")"
PARAGRAPH="${PARAGRAPH//\[$TYPE\] /}"
CONTENT="$CONTENT## $TITLE\n\n$PARAGRAPH\n\n"
fi
done

# Regex used to find commits without types
TYPES_REGEX=""
for TYPE in "${COMMIT_TYPES[@]}"
do
TYPES_REGEX="$TYPES_REGEX\[$TYPE\]\|"
done
TYPES_REGEX="$TYPES_REGEX\[skip-changelog\]"

# Get all commit without type annotation and make them another paragraph.
if [ -z "$1" ]
then
PARAGRAPH="$(git log --format=";* %s (%h);")"
else
PARAGRAPH="$(git log "$1"..HEAD --format=";* %s (%h);")"
fi
OIFS="$IFS"
IFS=";"
FILTERED_PARAGRAPH=""
for COMMIT in $PARAGRAPH
do
TRIMMED_COMMIT="$(echo "$COMMIT" | xargs -0)"
if [ ! -z "$TRIMMED_COMMIT" ] && ! echo "$TRIMMED_COMMIT" | grep -q "$TYPES_REGEX"
then
FILTERED_PARAGRAPH="$FILTERED_PARAGRAPH$TRIMMED_COMMIT\n"
fi
done
IFS="$OIFS"

# Only add to content if there are commits without type annotations.
if [ ! -z "$FILTERED_PARAGRAPH" ]
then
CONTENT="\n\n## CHANGE LOGS\n\n$FILTERED_PARAGRAPH\n\n$CONTENT"
fi

# Output changelog
echo -e "$CONTENT"
}

# Generate changelog either from last tag or from beginning
if [ -z "$(git tag)" ]
then
CONTENT=$(CREATE_CHANGELOG)
else
LATEST_RELEASE="$(git describe --tags --abbrev=0)"
CONTENT=$(CREATE_CHANGELOG "${LATEST_RELEASE}")
fi


if [ -z "$CONTENT" ]
then
echo -e "No changes made since last release $LATEST_RELEASE."
exit
fi

echo "$CONTENT"

if [ ! -z $1 ]
then
if [ -f $1 ]
then
echo "releasing $1..."
hub release create -a $1 -m "$CONTENT" $RELEASE_VERSION
else
echo "Error: $1 not exists"
fi
else
echo "Error: image name required!"
fi
8 changes: 4 additions & 4 deletions stage-localtunnel/00-localtunnel-install/01-run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -e

install -v -m 755 files/install_node.sh "${ROOTFS_DIR}/sbin/install_node.sh"
install -v -m 755 files/node-install "${ROOTFS_DIR}/sbin/node-install"
install -v -m 755 files/localtunnel_install.sh "${ROOTFS_DIR}/sbin/localtunnel_install.sh"
sed -i "s/FIRST_USER_NAME/$FIRST_USER_NAME/g" "${ROOTFS_DIR}/sbin/localtunnel_install.sh"

#on_chroot << EOF
#/sbin/install_node.sh
#EOF
install -v -m 755 files/localtunnel.sh "${ROOTFS_DIR}/sbin/localtunnel.sh"
30 changes: 0 additions & 30 deletions stage-localtunnel/00-localtunnel-install/files/install_node.sh

This file was deleted.

7 changes: 7 additions & 0 deletions stage-localtunnel/00-localtunnel-install/files/localtunnel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
PORT=8000

until lt -s $1 -p $PORT --print-requests
do
echo "Retry ..."
done
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

NODE_VERSION=9.8.0
NPM_CACHE=/home/FIRST_USER_NAME/.npm/npm-cache

# Install node.js
echo "Install node.js..."

# notice for pi zero we need armv61 version
python /sbin/node-install -v $NODE_VERSION

rm -rf $NPM_CACHE
npm config set unsafe-perm true
npm cache clean -f
npm config set cache $NPM_CACHE --global
npm set progress=false
rm -rf $NPM_CACHE
sudo -H -u FIRST_USER_NAME bash -c "mkdir -p $NPM_CACHE"

npm install -g localtunnel
ln -f -s /opt/nodejs/bin/lt /sbin/lt;
Loading

0 comments on commit 0cbe0a8

Please sign in to comment.