P4wnP1_aloa/Makefile

144 lines
5.0 KiB
Makefile
Raw Permalink Normal View History

2018-07-29 20:40:42 +00:00
SHELL := /bin/bash
PATH := /usr/local/go/bin:$(PATH)
all: compile
test:
# export PATH="$$PATH:/usr/local/go/bin" # put into ~/.profile
echo $(CURDIR)
2018-07-29 21:27:27 +00:00
echo $(HOME)
2018-07-29 20:18:06 +02:00
# make dep runs without sudo
dep:
# sudo apt-get -y install git screen hostapd autossh bluez bluez-tools bridge-utils policykit-1 genisoimage iodine haveged
# sudo apt-get -y install tcpdump
# sudo apt-get -y install python-pip python-dev
2018-07-29 20:40:42 +00:00
# before installing dnsmasq, the nameserver from /etc/resolv.conf should be saved
# to restore after install (gets overwritten by dnsmasq package)
# cp /etc/resolv.conf /tmp/backup_resolv.conf
# sudo apt-get -y install dnsmasq
# sudo /bin/bash -c 'cat /tmp/backup_resolv.conf > /etc/resolv.conf'
2018-07-29 20:40:42 +00:00
# python dependencies for HIDbackdoor
# sudo pip install pycrypto # already present on stretch
# sudo pip install pydispatcher
2018-07-29 20:18:06 +02:00
2018-07-29 20:40:42 +00:00
# install go
# wget https://storage.googleapis.com/golang/go1.10.linux-armv6l.tar.gz
# sudo tar -C /usr/local -xzf go1.10.linux-armv6l.tar.gz
2018-07-29 20:18:06 +02:00
2018-07-29 20:40:42 +00:00
export PATH="$$PATH:/usr/local/go/bin"
2018-07-29 20:18:06 +02:00
2018-07-29 20:40:42 +00:00
# put into ~/.profile
# ToDo: check if already present
# echo "export PATH=\$$PATH:/usr/local/go/bin" >> ~/.profile
# sudo bash -c 'echo export PATH=\$$PATH:/usr/local/go/bin >> ~/.profile'
2018-07-29 20:18:06 +02:00
2018-07-29 20:40:42 +00:00
# install gopherjs
go install github.com/gopherjs/gopherjs
2018-07-29 20:18:06 +02:00
2018-07-29 20:40:42 +00:00
# we don't need protoc + protoc-grpc-web, because the proto file is shipped pre-compiled
2018-07-29 20:18:06 +02:00
2018-07-29 20:40:42 +00:00
# go dependencies for webapp (without my own)
#go get google.golang.org/grpc
#go get -u github.com/improbable-eng/grpc-web/go/grpcweb
#go get -u github.com/gorilla/websocket
2018-07-29 20:18:06 +02:00
# This target probably needs to be run at least once to get the dependencies on
# the go path. But after that, you probably actually want to run:
# $ cd build_support && ./build.sh && cd ..
# instead, to build with the right GOOS and GOARCH settings.
2018-07-29 20:40:42 +00:00
compile:
go get github.com/mame82/P4wnP1_aloa/... # partially downloads again, but we need the library packages in go path to build
2018-07-29 21:08:40 +00:00
# <--- second compilation, maybe -d flag on go get above is better
env GOBIN=$(CURDIR)/build go install ./cmd/... # compile all main packages to the build folder
2018-07-29 20:18:06 +02:00
# compile the web app
# ToDo: (check if dependencies have been fetched by 'go get', even with the build js tags)
2018-12-07 00:59:54 +01:00
$(HOME)/go/bin/gopherjs get github.com/mame82/P4wnP1_aloa/web_client/...
2018-07-29 21:27:27 +00:00
$(HOME)/go/bin/gopherjs build -m -o build/webapp.js web_client/*.go
2018-10-05 18:07:09 +02:00
installkali:
2018-10-10 10:44:43 +02:00
#apt-get -y install git screen hostapd autossh bluez bluez-tools bridge-utils policykit-1 genisoimage iodine haveged
#apt-get -y install tcpdump
#apt-get -y install python-pip python-dev
2018-10-05 18:07:09 +02:00
# before installing dnsmasq, the nameserver from /etc/resolv.conf should be saved
# to restore after install (gets overwritten by dnsmasq package)
2018-10-10 10:44:43 +02:00
#cp /etc/resolv.conf /tmp/backup_resolv.conf
#apt-get -y install dnsmasq
#/bin/bash -c 'cat /tmp/backup_resolv.conf > /etc/resolv.conf'
2018-10-05 18:07:09 +02:00
# python dependencies for HIDbackdoor
sudo pip install pydispatcher
cp build/P4wnP1_service /usr/local/bin/
cp build/P4wnP1_cli /usr/local/bin/
cp dist/P4wnP1.service /etc/systemd/system/P4wnP1.service
2018-10-05 18:07:09 +02:00
# copy over keymaps, scripts and www data
mkdir -p /usr/local/P4wnP1
cp -R dist/keymaps /usr/local/P4wnP1/
cp -R dist/scripts /usr/local/P4wnP1/
cp -R dist/HIDScripts /usr/local/P4wnP1/
cp -R dist/www /usr/local/P4wnP1/
cp -R dist/db /usr/local/P4wnP1/
2018-11-21 01:30:37 +01:00
cp -R dist/helper /usr/local/P4wnP1/
cp -R dist/ums /usr/local/P4wnP1/
cp -R dist/legacy /usr/local/P4wnP1/
2018-10-05 18:07:09 +02:00
cp build/webapp.js /usr/local/P4wnP1/www
cp build/webapp.js.map /usr/local/P4wnP1/www
# careful testing
#sudo update-rc.d dhcpcd disable
#sudo update-rc.d dnsmasq disable
systemctl disable networking.service # disable network service, relevant parts are wrapped by P4wnP1 (boottime below 20 seconds)
2018-10-05 22:34:49 +02:00
# enable service
2018-10-15 22:58:51 +02:00
systemctl enable haveged
2018-10-18 14:40:38 +02:00
systemctl enable avahi-daemon
2018-10-05 22:34:49 +02:00
systemctl enable P4wnP1.service
2018-10-05 18:07:09 +02:00
install:
2018-07-29 20:18:06 +02:00
cp build/P4wnP1_service /usr/local/bin/
cp build/P4wnP1_cli /usr/local/bin/
cp dist/P4wnP1.service /etc/systemd/system/P4wnP1.service
# copy over keymaps, scripts and www data
mkdir -p /usr/local/P4wnP1
cp -R dist/keymaps /usr/local/P4wnP1/
cp -R dist/scripts /usr/local/P4wnP1/
cp -R dist/HIDScripts /usr/local/P4wnP1/
cp -R dist/www /usr/local/P4wnP1/
cp -R dist/db /usr/local/P4wnP1/
2018-10-18 14:40:38 +02:00
cp dist/bin/* /usr/local/bin/
2018-07-29 20:18:06 +02:00
cp build/webapp.js /usr/local/P4wnP1/www
cp build/webapp.js.map /usr/local/P4wnP1/www
# careful testing
#sudo update-rc.d dhcpcd disable
2018-07-29 20:40:42 +00:00
#sudo update-rc.d dnsmasq disable
# systemctl disable networking.service # disable network service, relevant parts are wrapped by P4wnP1 (boottime below 20 seconds)
2018-07-29 20:18:06 +02:00
# reinit service daemon
# systemctl daemon-reload
# enable service
# systemctl enable haveged
# systemctl enable P4wnP1.service
# start service
# service P4wnP1 start
remove:
# stop service
service P4wnP1 stop
# disable service
systemctl disable P4wnP1.service
rm -f /usr/local/bin/P4wnP1_service
rm -f /usr/local/bin/P4wnP1_cli
rm -f /etc/systemd/system/P4wnP1.service
2018-07-29 20:18:06 +02:00
rm -R /usr/local/P4wnP1/ # this folder should be kept, if only an update should be applied
# reinit service daemon
systemctl daemon-reload
2018-07-29 20:18:06 +02:00
#sudo update-rc.d dhcpcd enable