-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build
executable file
·143 lines (116 loc) · 3.88 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash -e
# Set temporary nameserver
mv /etc/resolv.conf /etc/resolv.conf.tmp
echo 'nameserver 8.8.8.8' > /etc/resolv.conf
# Set hostname
echo "patchos" > /etc/hostname
echo "127.0.0.1 localhost.localdomain localhost patchos" >> /etc/hosts
# Initialize pacman
pacman-key --init
pacman-key --populate archlinuxarm
# System update
pacman -Syu --noconfirm
# Install packages
pacman -S --noconfirm \
base-devel \
git \
realtime-privileges \
libffado \
qt5-base \
rtaudio \
portaudio \
celt \
opus \
libsamplerate \
waf \
avahi \
nss-mdns \
python-flask \
python-pydbus \
python-flask-socketio \
python-eventlet
# Rename default user
sed -i "s/alarm/patch/g" /etc/passwd /etc/group /etc/shadow
mv /home/alarm "/home/patch"
echo patch:patch | chpasswd
usermod -a -G audio,realtime patch
# Move /patchOS to /home/patch/patchOS, and set owner to 'patch'
mv /patchOS /home/patch/patchOS
chown -R patch:patch /home/patch/patchOS
# Enter "patch" home folder (for later downloads and easier cleanup)
cd /home/patch
# Set bashrc variable
echo "TERM=ansi" >> .bashrc
# Install fakeroot-tcp. Fakeroot has stopped working in chroot
# FIXME: This should be uneccessary. Find out why we cannot run standard fakeroot
cd /home/patch/patchOS/packages/fakeroot-tcp
curl http://ftp.debian.org/debian/pool/main/f/fakeroot/fakeroot_1.24.orig.tar.gz | tar xvz
cd fakeroot-1.24
export PYTHONPATH="${PWD}:${PYTHONPATH}"
./configure --prefix=/opt/fakeroot \
--libdir=/opt/fakeroot/libs \
--disable-static \
--with-ipc=tcp
make
make install
cd /home/patch/patchOS/packages/fakeroot-tcp
su patch <<'EOF'
export PATH="/opt/fakeroot/bin/:$PATH"
makepkg -sA --skipchecksums --noconfirm
export PATH="/usr/bin/:$PATH"
EOF
pacman -R --noconfirm fakeroot
cd /home/patch/patchOS/packages/fakeroot-tcp
pacman -U *aarch64.pkg.tar.xz --noconfirm
# Build jack from source
cd /home/patch/patchOS/packages/jack
su patch -c "makepkg -sA --skipchecksums --noconfirm"
# Remove conflicting packages before installing jack
pacman -R --noconfirm \
rtaudio \
portaudio \
jack
# Install jack
pacman -U *aarch64.pkg.tar.xz --noconfirm
# Reinstall packages that depends on jack
pacman -S --noconfirm \
rtaudio \
portaudio
# Build jacktrip from source
cd /home/patch/patchOS/packages/jacktrip
su patch -c "makepkg -sA --skipchecksums --noconfirm"
pacman -U *aarch64.pkg.tar.xz --noconfirm
# Set message of the day
cat /home/patch/patchOS/etc/motd > /etc/motd
# Install control-panel service
cp /home/patch/patchOS/etc/systemd/system/control-panel.service /etc/systemd/system/control-panel.service
chmod 644 /etc/systemd/system/control-panel.service
systemctl enable control-panel.service
# Install jack service
cp /home/patch/patchOS/etc/systemd/system/jack.service /etc/systemd/system/jack.service
chmod 644 /etc/systemd/system/jack.service
mkdir -p /home/patch/.config/jack
cp /home/patch/patchOS/packages/jack/jack.conf /home/patch/.config/jack/jack.conf
# Configure jack service to start/stop when USB devices connects/disconnects
cp /home/patch/patchOS/etc/udev/rules.d/*.rules /etc/udev/rules.d/
# Install jacktrip services (server and client)
cp /home/patch/patchOS/etc/systemd/system/jacktrip-server.service /etc/systemd/system/jacktrip-server.service
cp /home/patch/patchOS/etc/systemd/system/jacktrip-client.service /etc/systemd/system/jacktrip-client.service
chmod 644 /etc/systemd/system/jacktrip-server.service
chmod 644 /etc/systemd/system/jacktrip-client.service
# Enable and start mDNS service
cp /home/patch/patchOS/etc/systemd/system/http.service /etc/avahi/services/http.service
systemctl enable avahi-daemon
# Cleanup #
###########
# Remove unneeded locales
shopt -s extglob
rm -rvf /usr/share/locale/!(en_US|locale.alias)
# Restore DNS conf
mv /etc/resolv.conf.tmp /etc/resolv.conf
# Remove local build directories
rm -Rf /home/patch/patchOS/packages
# Remove unneeded packages
pacman -Rsu git base-devel --noconfirm
# Clean pacman cache
yes | pacman -Scc