-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make a release for standalone install
- Loading branch information
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
hosts | ||
calendar-install-*.run | ||
package | ||
makeself-2.4.2* | ||
playbook.retry |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
CALENDAR_VER=`cat release_number.txt` | ||
MAKESELF_VER=2.4.2 | ||
|
||
makeself-$(MAKESELF_VER)/makeself.sh: | ||
wget --quiet https://github.com/megastep/makeself/releases/download/release-$(MAKESELF_VER)/makeself-$(MAKESELF_VER).run | ||
sh ./makeself-$(MAKESELF_VER).run | ||
rm makeself-$(MAKESELF_VER).run | ||
|
||
calendar-install-$(CALENDAR_VER).run: makeself-$(MAKESELF_VER)/makeself.sh install.sh hosts-localhost playbook.yml $(wildcard roles/**/*) | ||
mkdir -p package | ||
cp -r hosts-localhost install.sh roles playbook.yml package/. | ||
# makeself.sh [args] archive_dir file_name label startup_script [script_args] | ||
makeself-$(MAKESELF_VER)/makeself.sh package calendar-install-$(CALENDAR_VER).run "Installing setup scripts" install.sh | ||
|
||
|
||
.PHONY: clean package release | ||
|
||
clean: | ||
rm -rf package calendar-install-*.run | ||
|
||
package: calendar-install-$(CALENDAR_VER).run | ||
|
||
release: package | ||
git tag r$(CALENDAR_VER) | ||
git push origin | ||
curl -X POST -H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/jscarbor/rpi-calendar/releases \ | ||
-d '{"tag_name":"'r$(CALENDAR_VER)'"}' | ||
expr $(CALENDAR_VER) + 1 >release_number.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
function makeFileWithMode { | ||
[[ -f $1 ]] || (touch $1 ; chmod $2 $1) | ||
} | ||
|
||
# assume sudo permission (it is default) | ||
|
||
# check ssh is turned on | ||
sudo systemctl status ssh | grep -q "Active: active" || sudo systemctl start ssh | ||
sudo systemctl status ssh | grep Loaded: | grep -q enabled || sudo systemctl enable ssh | ||
|
||
# check ssh keygen ran for pi | ||
[[ -f /home/pi/.ssh/id_rsa ]] || (echo -e "\n\n\n" | ssh-keygen 2>&1 >/dev/null) | ||
|
||
# check pi has its own authorized_key | ||
ak="/home/pi/.ssh/authorized_keys" | ||
makeFileWithMode $ak 600 | ||
grep -q "$(cat /home/pi/.ssh/id_rsa.pub)" $ak || (cat /home/pi/.ssh/id_rsa.pub >> $ak) | ||
|
||
# check pi has the localhost known_host | ||
kh="/home/pi/.ssh/known_hosts" | ||
makeFileWithMode $kh 600 | ||
grep -q localhost $kh | ssh-keyscan localhost >>$kh | ||
|
||
# install Ansible if necessary | ||
sudo dpkg -s ansible 2>&1 >/dev/null || sudo apt-get install ansible | ||
|
||
ansible-playbook playbook.yml -i hosts-localhost -u pi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |