Browse Source

Merge pull request #44 from mayankchhabra/patch/cleanup

Cleanup code
master
Mayank Chhabra 5 years ago
committed by GitHub
parent
commit
211b31e2fc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 53
      .github/workflows/on-push.yml
  2. 4
      .github/workflows/on-tag-only.yml
  3. 2
      README.md
  4. 20
      stage2/01-sys-tweaks/files/rc.local
  5. 1
      stage2/02-net-tweaks/00-packages
  6. 4
      stage2/05-docker-compose/01-run.sh
  7. 7
      stage2/06-prepare-home-dir/01-run.sh
  8. 10
      stage2/07-set-bitcoind-perms/01-run.sh
  9. 6
      stage2/08-configure-tor/01-run.sh
  10. 21
      stage2/08-configure-tor/files/torrc

53
.github/workflows/on-push.yml

@ -0,0 +1,53 @@
name: Build image on push
on:
push:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Run Apt-get update
run: sudo apt-get update
- name: Install dependencies
run: sudo apt-get -y install quilt qemu-user-static debootstrap bsdtar
- name: Nuke current Docker installation
run: |
sudo systemctl stop docker
sudo apt-get purge docker-ce docker-ce-cli containerd.io moby-engine moby-cli
sudo rm -rf /var/lib/docker
- name: Re-install Docker
run: |
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
docker --version
- name: Enable experimental features in Docker
run: |
sudo rm -rf /etc/docker/daemon.json
echo '{"experimental": true}' | sudo tee -a /etc/docker/daemon.json
sudo systemctl restart docker
- name: Run build script
run: sudo ./build.sh
- name: Copy ZIP to current working dir
run: cp deploy/*.zip ./
- name: Debug current working dir
run: ls -la
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: umbr3l-lite.zip
path: ./umbr3l-lite.zip

4
.github/workflows/on-tag-only.yml

@ -1,7 +1,9 @@
name: Automatically Build image on tag ONLY name: Automatically Build image on tag ONLY
on: on:
push: push:
tags: [ '*' ] tags:
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-*
jobs: jobs:
build: build:

2
README.md

@ -75,7 +75,7 @@ For building an API (or scripting), look in `/home/umbrel/statuses` for the foll
The above variables control whether or not the umbrelbox startup script is run (for SD Card safety). The above variables control whether or not the umbrelbox startup script is run (for SD Card safety).
If you want to overricde the checks, please delete ```service-configured``` file and add a ```disk-partitioned```, and then reinstall/configure [Umbrel Compose](https://github.com/getumbrel/umbrel-compose). Then run ```/etc/rc.local``` as root again (or restart your box) If you want to overricde the checks, please delete ```service-configured``` file and add a ```disk-partitioned```, and then reinstall/configure [Umbrel](https://github.com/getumbrel/umbrel). Then run ```/etc/rc.local``` as root again (or restart your box)
--- ---

20
stage2/01-sys-tweaks/files/rc.local

@ -39,19 +39,11 @@ if [ ! -f /home/umbrel/statuses/disk-partitioned ]; then
fi fi
if [ ! -f /home/umbrel/statuses/service-configured ]; then if [ ! -f /home/umbrel/statuses/service-configured ]; then
if [ -f /home/umbrel/bin/rpcauth.py ]; then if [ -f /home/umbrel/configure-box.sh ]; then
echo "Running rpcauth.py, and generating secrets for bitcoind" echo "Running configuration script"
cd /home/umbrel/bin/ cd /home/umbrel
./rpcauth.py lncm | tee /home/umbrel/secrets/generated.txt | head -2 | tail -1 > /home/umbrel/secrets/rpcauth.txt ./configure-box.sh || exit 1
tail -1 /home/umbrel/secrets/generated.txt > /home/umbrel/secrets/rpcpass.txt # Marking this as done so we don't do configuration again
echo "Updating bitcoin.conf"
cat /home/umbrel/secrets/rpcauth.txt >> /home/umbrel/bitcoin/bitcoin.conf
# Update RPC Passwords for both LND and INVOICER
RPCPASS=`cat /home/umbrel/secrets/rpcpass.txt`
sed -i "s/RPCPASS/${RPCPASS}/g;" /home/umbrel/docker-compose.yml
sed -i "s/RPCPASS/${RPCPASS}/g;" /home/umbrel/lnd/lnd.conf
# Making this as done so we don't go through updates again
touch /home/umbrel/statuses/service-configured touch /home/umbrel/statuses/service-configured
chown -R umbrel.umbrel /home/umbrel/statuses/service-configured chown -R umbrel.umbrel /home/umbrel/statuses/service-configured
fi fi
@ -77,7 +69,7 @@ if [ ! -f /home/umbrel/statuses/service-configured ]; then
/etc/init.d/umbrelbox start /etc/init.d/umbrelbox start
fi fi
else else
echo "Disk not partitioned, will not start umbrel-compose framework (Please do it manually)" echo "Disk not partitioned, will not start umbrel framework (Please do it manually)"
fi fi
fi fi

1
stage2/02-net-tweaks/00-packages

@ -2,7 +2,6 @@ wpasupplicant wireless-tools firmware-atheros firmware-brcm80211 firmware-libert
raspberrypi-net-mods raspberrypi-net-mods
dhcpcd5 dhcpcd5
net-tools net-tools
tor
libzbar-dev libzbar-dev
libzbar0 libzbar0
python3-pip python3-pip

4
stage2/05-docker-compose/01-run.sh

@ -6,7 +6,7 @@ echo "Installing docker-compose from pip3, and also setting up the box folder st
on_chroot << EOF on_chroot << EOF
pip3 install docker-compose pip3 install docker-compose
cd /home/${FIRST_USER_NAME} cd /home/${FIRST_USER_NAME}
wget -qO- "https://raw.githubusercontent.com/getumbrel/umbrel-compose/master/install-box.sh" | sh wget -qO- "https://raw.githubusercontent.com/getumbrel/umbrel/master/install-box.sh" | sh
chown -R ${FIRST_USER_NAME}:${FIRST_USER_NAME} /home/${FIRST_USER_NAME} chown -R ${FIRST_USER_NAME}:${FIRST_USER_NAME} /home/${FIRST_USER_NAME}
EOF EOF
@ -31,7 +31,7 @@ cp files/compose-service ${ROOTFS_DIR}/etc/init.d/umbrelbox
echo "Pulling Docker images required to run Umbrel services" echo "Pulling Docker images required to run Umbrel services"
wget -q "https://raw.githubusercontent.com/getumbrel/umbrel-compose/master/docker-compose.yml" wget -q "https://raw.githubusercontent.com/getumbrel/umbrel/master/docker-compose.yml"
IMAGES=$(grep '^\s*image' docker-compose.yml | sed 's/image://' | sed 's/\"//g' | sed '/^$/d;s/[[:blank:]]//g' | sort | uniq) IMAGES=$(grep '^\s*image' docker-compose.yml | sed 's/image://' | sed 's/\"//g' | sed '/^$/d;s/[[:blank:]]//g' | sort | uniq)
echo "List of images to download: $IMAGES" echo "List of images to download: $IMAGES"

7
stage2/06-prepare-home-dir/01-run.sh

@ -1,7 +0,0 @@
# Save password (for createwallet script).
# We will remove this later when a more suitable secure system is finalized.
touch $ROOTFS_DIR/home/$FIRST_USER_NAME/.save_password
echo "Executables directory"
mkdir -p $ROOTFS_DIR/home/$FIRST_USER_NAME/bin

10
stage2/07-set-bitcoind-perms/01-run.sh

@ -1,10 +0,0 @@
# TODO: configure username and password (internally)
echo "Downloading password utility"
cd ${ROOTFS_DIR}/home/${FIRST_USER_NAME}/bin
curl "https://raw.githubusercontent.com/bitcoin/bitcoin/master/share/rpcauth/rpcauth.py" 2>/dev/null 1>rpcauth.py
chmod 755 rpcauth.py
on_chroot << EOF
chown -R ${FIRST_USER_NAME}:${FIRST_USER_NAME} /home/${FIRST_USER_NAME}
EOF

6
stage2/08-configure-tor/01-run.sh

@ -1,6 +0,0 @@
# TODO: configure username and password (internally)
chmod 644 files/torrc
mkdir -p ${ROOTFS_DIR}/etc/tor/
echo "Overriding TORRC"
cp files/torrc ${ROOTFS_DIR}/etc/tor/torrc

21
stage2/08-configure-tor/files/torrc

@ -1,21 +0,0 @@
SocksPort 9050 # Default: Bind to localhost:9050 for local connections.
Log notice syslog
Log debug file /var/log/tor/debug.log
#RunAsDaemon 1
DataDirectory /var/lib/tor
ControlPort 9051
# Default password for umbrel tor
HashedControlPassword 16:50A873DF18C00F4A6048BF1CEF7E7AA66478F0B5134DA4369D80657F26
# Backwards compatibility
CookieAuthentication 1
# Allow this for now
# TOR HOSTNAME
HiddenServiceDir /var/lib/tor/sshd
HiddenServicePort 22 127.0.0.1:22
HiddenServiceDir /var/lib/tor/web
HiddenServicePort 80 127.0.0.1:80
Loading…
Cancel
Save