Skip to content

Commit

Permalink
add PKGBUILDS; Update image-creator
Browse files Browse the repository at this point in the history
  • Loading branch information
0pcom committed Sep 2, 2020
1 parent a574b6c commit c1860e9
Show file tree
Hide file tree
Showing 25 changed files with 830 additions and 226 deletions.
25 changes: 25 additions & 0 deletions PKGBUILDS/bootstrap/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Maintainer: Moses Narrow <moe_narrow@use.startmail.com>
pkgname=bootstrap
_pkgname=bootstrap
pkgdesc="archlinux(arm) bootstrapping script"
pkgver=0.0.1
pkgrel=1
arch=('any')
license=()
makedepends=()
source=(
"bootstrap.sh"
)
sha256sums=('1537bbfd2cdc979d34e76154a2174e2b5502d69e22bf21dac1dc01e58167c01a')

package() {
_rmextension=".sh"
_scripts=$(ls *.sh)
_services=$(ls *.service)
for i in $_scripts ; do
install -Dm755 ${i} ${pkgdir}/usr/bin/${i//$rmextension}
done
for i in $_services ; do
install -Dm644 ${i} ${pkgdir}/usr/lib/systemd/system/${i}
done
}
1 change: 1 addition & 0 deletions PKGBUILDS/bootstrap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deprecated
64 changes: 64 additions & 0 deletions PKGBUILDS/bootstrap/bootstrap-alarm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
#user portion of the setup customization
#rerun to update AUR packages
set -e
if [[ $EUID -eq 0 ]]; then
echo "Please do not run this script as root." 1>&2
exit 100
fi

#sync databases before upgrade
sudo pacman -Syy

#full system update
yes | sudo pacman -Syu --noconfirm

package=yay-git
if pacman -Qi $package > /dev/null ; then
echo "$package is installed, rebuilding to the latest commits"
yay -S --noconfirm $package
else
echo "$package is not installed, manually building"
#clone the build dir for yay-git to it's future package cache
mkdir -p ~/.cache/yay/ && cd ~/.cache/yay/
git clone https://aur.archlinux.org/$package
cd $package
yes | makepkg -scif --noconfirm
cd ~/
fi
echo "installed $package"

#install package cache sharing utility with yay
package=readonly-cache
if pacman -Qi $package > /dev/null ; then
echo "$package is installed, rebuilding with the latest commits"
yay -S --noconfirm $package
else
echo "installing $package now"
yay -S --noconfirm $package
fi
echo "installed $package"

#install skywire with yay
#package=skywire
#if pacman -Qi $package > /dev/null ; then
# echo "$package is installed, rebuilding with the latest commits"
# yay -S --noconfirm $package
#else
# echo "installing $package now"
# yay -S --noconfirm $package
#fi
#echo "installed $package"
#
#echo "installed $package"

#packages in yay's cache are added to the skyminer local repo hosted by the manager
#sudo aur-local

#enable the service to host these packges on the LAN
#sudo systemctl enable readonly-cache.service

#systemctl daemon-reload

#reboot
sudo reboot now
51 changes: 51 additions & 0 deletions PKGBUILDS/bootstrap/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
#root portion of the setup customization
set -e

if [[ $EUID -ne 0 ]]; then
echo "You must be root to do this." 1>&2
exit 100
fi

#set hostname to hypervisor
#echo "hypervisor" > /etc/hostname

#toggle systemd-resolved.service to fix DNS
systemctl enable fixdns.service
systemctl start fixinternet.service

#boilerplate archlinux setup
pacman-key --init
pacman-key --populate
#sync the repos
pacman -Syy

#update the keyring first to avoid errors from missing keys
pacman -S archlinux-keyring --noconfirm

#install a few things needed for makepkg
yes | pacman -S base-devel git sudo --needed --noconfirm

#install macchanger, create and enable a systemd service or MAC address will be 36:c9:e3:f1:b8:05
#pacman -S macchanger --noconfirm --needed
#systemctl enable macchanger.service

#set easy sudo for user portion of configuration
ISO_USER="$(cat /etc/passwd | grep "/home" |cut -d: -f1 |head -1)"
wfile=/etc/sudoers
wfile1=/etc/sudoers-bak
wfile2=/root/sudoers
if [ ! -f $wfile1 ]; then
cp $wfile $wfile1
cp -a $wfile1 $wfile2
echo "$ISO_USER ALL=(ALL:ALL) NOPASSWD:ALL" >> $wfile2
mv $wfile2 $wfile
else
cp -a $wfile1 $wfile2
echo "$ISO_USER ALL=(ALL:ALL) NOPASSWD:ALL" >> $wfile2
mv $wfile2 $wfile
fi

echo "sudo permissions granted to $ISO_USER"
#run the user portion of the configuration - makepkg cannot be run as root
su -c "skybootstrap-alarm" $ISO_USER
80 changes: 80 additions & 0 deletions PKGBUILDS/bootstrap/nodebootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash
#root portion of the setup customization
set -e
if [[ $EUID -ne 0 ]]; then
echo "You must be root to do this." 1>&2
exit 100
fi

### SET HOSTNAME ###
HOST_NAME=$(cat /etc/hostname)
if [ $HOST_NAME == *"alarm"* ]; then
echo "Skyminer node setup"
echo "Setting hostname, please enter a unique identifier for this node"
read -p "A number between 1 and 8 is recommended: " -r
HOST_NAME=${REPLY}
echo "visor$HOST_NAME" > /etc/hostname
#else
#echo "$HOST_NAME" > /etc/hostname
#fi
fi

if [ ! -z $1 ]; then
AURLOCAL=${1}
fi

if [ -z $AURLOCAL ]; then
set -e
#prompt to enter sky manager IP address
read -p "Please input IP address of the hypervisor: " -r
AURLOCAL=${REPLY}
fi

# backup the mirrorlist
if [ ! -f /etc/pacman.d/mirrorlist-bak ]; then
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist-bak
fi

#set the AURLOCAL IP as a mirror for pacman to retrieve updates from
echo "$(echo "Server = http://$AURLOCAL:8079" | cat - /etc/pacman.d/mirrorlist-bak)" > /root/mirrorlist
mv /root/mirrorlist /etc/pacman.d/mirrorlist

#backup pacman.conf
if [ ! -f /etc/pacman.conf-bak ]; then
cp /etc/pacman.conf /etc/pacman.conf-bak
fi

#add the skyminer repo to pacman.conf
cat /etc/pacman.conf-bak > /root/pacman.conf
echo -e "
[aur-local]
SigLevel = PackageOptional
Server = http://$AURLOCAL:8079
" >> /root/pacman.conf
mv /root/pacman.conf /etc/pacman.conf


### BOOTSTRAPPING ###
#boilerplate archlinux setup
pacman-key --init
pacman-key --populate

#sync the repos
pacman -Syy

#update the keyring first to avoid errors from missing keys
pacman -S archlinux-keyring --noconfirm

#install skywire-mainnet from the skyminer repo on the manager
yes | pacman -S skywire --noconfirm

#install macchanger, create and enable a systemd service or MAC address will be 36:c9:e3:f1:b8:05
pacman -S macchanger --noconfirm

systemctl enable macchanger.service

#full system update
yes | pacman -Syu --noconfirm

#reboot for stablity because the kernel was probably updated
reboot now
27 changes: 27 additions & 0 deletions PKGBUILDS/fixdns/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Maintainer: Moses Narrow <moe_narrow@use.startmail.com>
pkgname=fixdns
_pkgname=$pkgname
pkgdesc="toggle systemd-resolved.service to fix DNS resolution issues on archlinuxARM"
pkgver=0.0.1
pkgrel=1
arch=('x86_64' 'aarch64' 'armhf' 'armel' 'arm' 'armv6h' 'armv7h')
license=()
source=("https://github.com/skyfleet/archlinuxarm/raw/master/PKGBUILDS/fixdns/fixdns.sh"
"https://github.com/skyfleet/archlinuxarm/raw/master/PKGBUILDS/fixdns/fixdns.service"
"https://github.com/skyfleet/archlinuxarm/raw/master/PKGBUILDS/fixdns/fixdns.install"
)
sha256sums=('6c0d38114d8ed695539adb1e3f6e2a260247758c814386097ae3cdab78314fdb'
'89ddbf49589fec8ee8346eaf39300f17e51e1214e8b32769f13e014a700098b2'
'1957e00d865e8d1c56f73adf2e93923c51eb59be1f734f3af95a5156529a4471')
install=$pkgname.install
package() {
_rmextension=".sh"
_scripts=$(ls *.sh)
_services=$(ls *.service)
for i in $_scripts ; do
install -Dm755 ${i} ${pkgdir}/usr/bin/${i//$rmextension}
done
for i in $_services ; do
install -Dm644 ${i} ${pkgdir}/usr/lib/systemd/system/${i}
done
}
18 changes: 18 additions & 0 deletions PKGBUILDS/fixdns/fixdns.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
post_install() {
systemctl enable --now fixdns.service
}

pre-upgrade() {
systemctl disable --now fixdns.service
}

post_upgrade() {
post_install
}

pre-remove() {
pre-upgrade
}

post_remove() {
}
12 changes: 12 additions & 0 deletions PKGBUILDS/fixdns/fixdns.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=fix dns service
After=network.target
After=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/bin/fixdns
RemainAfterExit=no

[Install]
WantedBy=multi-user.target
6 changes: 6 additions & 0 deletions PKGBUILDS/fixdns/fixdns.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "You must be root to do this." 1>&2
exit 100
fi
systemctl stop systemd-resolved
20 changes: 20 additions & 0 deletions PKGBUILDS/macchanger-service/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Maintainer: Moses Narrow <moe_narrow@use.startmail.com>
pkgname=macchanger-service
_pkgname=macchanger-service
pkgdesc="macchanger systemd service"
pkgver=0.0.1
pkgrel=1
arch=('x86_64' 'aarch64' 'armhf' 'armel' 'arm' 'armv6h' 'armv7h')
license=()
depends=(macchanger)
source=("macchanger.service"
"macchanger-service.install")
sha256sums=('01319ab9a08ebe4f21a6da948361c44553c2b53f8c70730c6c6c9ddba591467a'
'cd6bac0eb65d85bf98e9a89a3d2dc9c961a1882a567c952346de4b68e164e42f')
install=macchanger-service.install
package() {
_services=$(ls *.service)
for i in $_services ; do
install -Dm644 ${i} ${pkgdir}/usr/lib/systemd/system/${i}
done
}
18 changes: 18 additions & 0 deletions PKGBUILDS/macchanger-service/macchanger-service.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
post_install() {
systemctl enable --now macchanger.service
}

pre-upgrade() {
systemctl disable --now macchanger.service
}

post_upgrade() {
post_install
}

pre-remove() {
pre-upgrade
}

post_remove() {
}
13 changes: 13 additions & 0 deletions PKGBUILDS/macchanger-service/macchanger.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=macchanger on eth0
Wants=network-pre.target
Before=network-pre.target
BindsTo=sys-subsystem-net-devices-eth0.device
After=sys-subsystem-net-devices-eth0.device

[Service]
ExecStart=/usr/bin/macchanger -e eth0
Type=oneshot

[Install]
WantedBy=multi-user.target
24 changes: 24 additions & 0 deletions PKGBUILDS/skycoin-keyring/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Maintainer: Moses Narrow <moe_narrow@use.startmail.com>
pkgbase=skycoin-keyring
pkgname=("$pkgbase")
pkgver=0.0.1
pkgrel=1
pkgdesc="Skycoin archlinux packages keyring"
arch=('x86_64' 'aarch64' 'armhf' 'armel' 'arm' 'armv6h' 'armv7h')
url="https://github.com/skyfleet"
source=("https://github.com/skyfleet/archlinuxarm/raw/master/PKGBUILDS/skycoin-keyring/skycoin-keyring.install"
"https://github.com/skyfleet/archlinuxarm/raw/master/PKGBUILDS/skycoin-keyring/skycoin.gpg")
sha256sums=('e63b689c0c7a183ef55d155d2d51e9796ab107e807e71139650a377fa1d32db7'
'dc9e87ebf2fbecc2836c0ef54b32affffacd0940aeb8a475bc3286098f0155f1')

destdir=/usr/share/pacman/keyrings
install=$pkgbase.install

package() {
mkdir -p ${pkgdir}/$destdir
cd ..
cp skycoin.gpg ${pkgdir}/$destdir
cp skycoin-trusted ${pkgdir}/$destdir
install -dm 755 "${pkgdir}/$destdir"

}
21 changes: 21 additions & 0 deletions PKGBUILDS/skycoin-keyring/skycoin-keyring.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
post_install() {

pacman-key --init
pacman-key --add /usr/share/pacman/keyrings/skycoin-keyring.gpg
pacman-key --lsign-key DE08F924EEE93832DABC642CA8DC761B1C0C0CFC
pacman-key --lsign-key 98F934F04F9334B81DFA3398913BBD5206B19620
pacman-key --populate

}

post_upgrade() {

pacman-key --init
pacman-key --add /usr/share/pacman/keyrings/skycoin-keyring.gpg
pacman-key --lsign-key DE08F924EEE93832DABC642CA8DC761B1C0C0CFC
pacman-key --lsign-key 98F934F04F9334B81DFA3398913BBD5206B19620
pacman-key --populate


}
# -*- mode: bash;-*-
2 changes: 2 additions & 0 deletions PKGBUILDS/skycoin-keyring/skycoin-trusted
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DE08F924EEE93832DABC642CA8DC761B1C0C0CFC:4:
98F934F04F9334B81DFA3398913BBD5206B19620:4:
Binary file added PKGBUILDS/skycoin-keyring/skycoin.gpg
Binary file not shown.
Loading

0 comments on commit c1860e9

Please sign in to comment.