Skip to content

Commit c1860e9

Browse files
author
Moses Narrow
committed
add PKGBUILDS; Update image-creator
1 parent a574b6c commit c1860e9

25 files changed

+830
-226
lines changed

PKGBUILDS/bootstrap/PKGBUILD

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Maintainer: Moses Narrow <[email protected]>
2+
pkgname=bootstrap
3+
_pkgname=bootstrap
4+
pkgdesc="archlinux(arm) bootstrapping script"
5+
pkgver=0.0.1
6+
pkgrel=1
7+
arch=('any')
8+
license=()
9+
makedepends=()
10+
source=(
11+
"bootstrap.sh"
12+
)
13+
sha256sums=('1537bbfd2cdc979d34e76154a2174e2b5502d69e22bf21dac1dc01e58167c01a')
14+
15+
package() {
16+
_rmextension=".sh"
17+
_scripts=$(ls *.sh)
18+
_services=$(ls *.service)
19+
for i in $_scripts ; do
20+
install -Dm755 ${i} ${pkgdir}/usr/bin/${i//$rmextension}
21+
done
22+
for i in $_services ; do
23+
install -Dm644 ${i} ${pkgdir}/usr/lib/systemd/system/${i}
24+
done
25+
}

PKGBUILDS/bootstrap/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
deprecated
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
#user portion of the setup customization
3+
#rerun to update AUR packages
4+
set -e
5+
if [[ $EUID -eq 0 ]]; then
6+
echo "Please do not run this script as root." 1>&2
7+
exit 100
8+
fi
9+
10+
#sync databases before upgrade
11+
sudo pacman -Syy
12+
13+
#full system update
14+
yes | sudo pacman -Syu --noconfirm
15+
16+
package=yay-git
17+
if pacman -Qi $package > /dev/null ; then
18+
echo "$package is installed, rebuilding to the latest commits"
19+
yay -S --noconfirm $package
20+
else
21+
echo "$package is not installed, manually building"
22+
#clone the build dir for yay-git to it's future package cache
23+
mkdir -p ~/.cache/yay/ && cd ~/.cache/yay/
24+
git clone https://aur.archlinux.org/$package
25+
cd $package
26+
yes | makepkg -scif --noconfirm
27+
cd ~/
28+
fi
29+
echo "installed $package"
30+
31+
#install package cache sharing utility with yay
32+
package=readonly-cache
33+
if pacman -Qi $package > /dev/null ; then
34+
echo "$package is installed, rebuilding with the latest commits"
35+
yay -S --noconfirm $package
36+
else
37+
echo "installing $package now"
38+
yay -S --noconfirm $package
39+
fi
40+
echo "installed $package"
41+
42+
#install skywire with yay
43+
#package=skywire
44+
#if pacman -Qi $package > /dev/null ; then
45+
# echo "$package is installed, rebuilding with the latest commits"
46+
# yay -S --noconfirm $package
47+
#else
48+
# echo "installing $package now"
49+
# yay -S --noconfirm $package
50+
#fi
51+
#echo "installed $package"
52+
#
53+
#echo "installed $package"
54+
55+
#packages in yay's cache are added to the skyminer local repo hosted by the manager
56+
#sudo aur-local
57+
58+
#enable the service to host these packges on the LAN
59+
#sudo systemctl enable readonly-cache.service
60+
61+
#systemctl daemon-reload
62+
63+
#reboot
64+
sudo reboot now

PKGBUILDS/bootstrap/bootstrap.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
#root portion of the setup customization
3+
set -e
4+
5+
if [[ $EUID -ne 0 ]]; then
6+
echo "You must be root to do this." 1>&2
7+
exit 100
8+
fi
9+
10+
#set hostname to hypervisor
11+
#echo "hypervisor" > /etc/hostname
12+
13+
#toggle systemd-resolved.service to fix DNS
14+
systemctl enable fixdns.service
15+
systemctl start fixinternet.service
16+
17+
#boilerplate archlinux setup
18+
pacman-key --init
19+
pacman-key --populate
20+
#sync the repos
21+
pacman -Syy
22+
23+
#update the keyring first to avoid errors from missing keys
24+
pacman -S archlinux-keyring --noconfirm
25+
26+
#install a few things needed for makepkg
27+
yes | pacman -S base-devel git sudo --needed --noconfirm
28+
29+
#install macchanger, create and enable a systemd service or MAC address will be 36:c9:e3:f1:b8:05
30+
#pacman -S macchanger --noconfirm --needed
31+
#systemctl enable macchanger.service
32+
33+
#set easy sudo for user portion of configuration
34+
ISO_USER="$(cat /etc/passwd | grep "/home" |cut -d: -f1 |head -1)"
35+
wfile=/etc/sudoers
36+
wfile1=/etc/sudoers-bak
37+
wfile2=/root/sudoers
38+
if [ ! -f $wfile1 ]; then
39+
cp $wfile $wfile1
40+
cp -a $wfile1 $wfile2
41+
echo "$ISO_USER ALL=(ALL:ALL) NOPASSWD:ALL" >> $wfile2
42+
mv $wfile2 $wfile
43+
else
44+
cp -a $wfile1 $wfile2
45+
echo "$ISO_USER ALL=(ALL:ALL) NOPASSWD:ALL" >> $wfile2
46+
mv $wfile2 $wfile
47+
fi
48+
49+
echo "sudo permissions granted to $ISO_USER"
50+
#run the user portion of the configuration - makepkg cannot be run as root
51+
su -c "skybootstrap-alarm" $ISO_USER
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
#root portion of the setup customization
3+
set -e
4+
if [[ $EUID -ne 0 ]]; then
5+
echo "You must be root to do this." 1>&2
6+
exit 100
7+
fi
8+
9+
### SET HOSTNAME ###
10+
HOST_NAME=$(cat /etc/hostname)
11+
if [ $HOST_NAME == *"alarm"* ]; then
12+
echo "Skyminer node setup"
13+
echo "Setting hostname, please enter a unique identifier for this node"
14+
read -p "A number between 1 and 8 is recommended: " -r
15+
HOST_NAME=${REPLY}
16+
echo "visor$HOST_NAME" > /etc/hostname
17+
#else
18+
#echo "$HOST_NAME" > /etc/hostname
19+
#fi
20+
fi
21+
22+
if [ ! -z $1 ]; then
23+
AURLOCAL=${1}
24+
fi
25+
26+
if [ -z $AURLOCAL ]; then
27+
set -e
28+
#prompt to enter sky manager IP address
29+
read -p "Please input IP address of the hypervisor: " -r
30+
AURLOCAL=${REPLY}
31+
fi
32+
33+
# backup the mirrorlist
34+
if [ ! -f /etc/pacman.d/mirrorlist-bak ]; then
35+
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist-bak
36+
fi
37+
38+
#set the AURLOCAL IP as a mirror for pacman to retrieve updates from
39+
echo "$(echo "Server = http://$AURLOCAL:8079" | cat - /etc/pacman.d/mirrorlist-bak)" > /root/mirrorlist
40+
mv /root/mirrorlist /etc/pacman.d/mirrorlist
41+
42+
#backup pacman.conf
43+
if [ ! -f /etc/pacman.conf-bak ]; then
44+
cp /etc/pacman.conf /etc/pacman.conf-bak
45+
fi
46+
47+
#add the skyminer repo to pacman.conf
48+
cat /etc/pacman.conf-bak > /root/pacman.conf
49+
echo -e "
50+
[aur-local]
51+
SigLevel = PackageOptional
52+
Server = http://$AURLOCAL:8079
53+
" >> /root/pacman.conf
54+
mv /root/pacman.conf /etc/pacman.conf
55+
56+
57+
### BOOTSTRAPPING ###
58+
#boilerplate archlinux setup
59+
pacman-key --init
60+
pacman-key --populate
61+
62+
#sync the repos
63+
pacman -Syy
64+
65+
#update the keyring first to avoid errors from missing keys
66+
pacman -S archlinux-keyring --noconfirm
67+
68+
#install skywire-mainnet from the skyminer repo on the manager
69+
yes | pacman -S skywire --noconfirm
70+
71+
#install macchanger, create and enable a systemd service or MAC address will be 36:c9:e3:f1:b8:05
72+
pacman -S macchanger --noconfirm
73+
74+
systemctl enable macchanger.service
75+
76+
#full system update
77+
yes | pacman -Syu --noconfirm
78+
79+
#reboot for stablity because the kernel was probably updated
80+
reboot now

PKGBUILDS/fixdns/PKGBUILD

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Maintainer: Moses Narrow <[email protected]>
2+
pkgname=fixdns
3+
_pkgname=$pkgname
4+
pkgdesc="toggle systemd-resolved.service to fix DNS resolution issues on archlinuxARM"
5+
pkgver=0.0.1
6+
pkgrel=1
7+
arch=('x86_64' 'aarch64' 'armhf' 'armel' 'arm' 'armv6h' 'armv7h')
8+
license=()
9+
source=("https://github.com/skyfleet/archlinuxarm/raw/master/PKGBUILDS/fixdns/fixdns.sh"
10+
"https://github.com/skyfleet/archlinuxarm/raw/master/PKGBUILDS/fixdns/fixdns.service"
11+
"https://github.com/skyfleet/archlinuxarm/raw/master/PKGBUILDS/fixdns/fixdns.install"
12+
)
13+
sha256sums=('6c0d38114d8ed695539adb1e3f6e2a260247758c814386097ae3cdab78314fdb'
14+
'89ddbf49589fec8ee8346eaf39300f17e51e1214e8b32769f13e014a700098b2'
15+
'1957e00d865e8d1c56f73adf2e93923c51eb59be1f734f3af95a5156529a4471')
16+
install=$pkgname.install
17+
package() {
18+
_rmextension=".sh"
19+
_scripts=$(ls *.sh)
20+
_services=$(ls *.service)
21+
for i in $_scripts ; do
22+
install -Dm755 ${i} ${pkgdir}/usr/bin/${i//$rmextension}
23+
done
24+
for i in $_services ; do
25+
install -Dm644 ${i} ${pkgdir}/usr/lib/systemd/system/${i}
26+
done
27+
}

PKGBUILDS/fixdns/fixdns.install

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
post_install() {
2+
systemctl enable --now fixdns.service
3+
}
4+
5+
pre-upgrade() {
6+
systemctl disable --now fixdns.service
7+
}
8+
9+
post_upgrade() {
10+
post_install
11+
}
12+
13+
pre-remove() {
14+
pre-upgrade
15+
}
16+
17+
post_remove() {
18+
}

PKGBUILDS/fixdns/fixdns.service

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=fix dns service
3+
After=network.target
4+
After=network-online.target
5+
6+
[Service]
7+
Type=oneshot
8+
ExecStart=/usr/bin/fixdns
9+
RemainAfterExit=no
10+
11+
[Install]
12+
WantedBy=multi-user.target

PKGBUILDS/fixdns/fixdns.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
if [[ $EUID -ne 0 ]]; then
3+
echo "You must be root to do this." 1>&2
4+
exit 100
5+
fi
6+
systemctl stop systemd-resolved
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Maintainer: Moses Narrow <[email protected]>
2+
pkgname=macchanger-service
3+
_pkgname=macchanger-service
4+
pkgdesc="macchanger systemd service"
5+
pkgver=0.0.1
6+
pkgrel=1
7+
arch=('x86_64' 'aarch64' 'armhf' 'armel' 'arm' 'armv6h' 'armv7h')
8+
license=()
9+
depends=(macchanger)
10+
source=("macchanger.service"
11+
"macchanger-service.install")
12+
sha256sums=('01319ab9a08ebe4f21a6da948361c44553c2b53f8c70730c6c6c9ddba591467a'
13+
'cd6bac0eb65d85bf98e9a89a3d2dc9c961a1882a567c952346de4b68e164e42f')
14+
install=macchanger-service.install
15+
package() {
16+
_services=$(ls *.service)
17+
for i in $_services ; do
18+
install -Dm644 ${i} ${pkgdir}/usr/lib/systemd/system/${i}
19+
done
20+
}

0 commit comments

Comments
 (0)