-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_recipe_v2.1.txt
940 lines (745 loc) · 26.7 KB
/
build_recipe_v2.1.txt
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
################################################################
#
# Build Recipe v2.1, 2017-12-01
#
# These instructions are written for Linux Enthusiasts
# and System Integrators and provide a recipe for making
# a custom OS for running moOde audio player.
#
# NOTE: This recipe is based on Stretch Lite 2017-09-07
#
# Unless otherwise noted or if a command requires user
# interaction, groups of commands can be run in batch.
#
# moOde 4.0 Beta 11
#
# Changes:
#
# v2.1: Chg poweroff to reboot in STEP 2
# Should be /var/log/mpd/log in STEP 6
# v2.0: Add COMPONENT 8 Local UI display
# Add COMPONENT 9 Allo Piano 2.1 firmware
# Update STEP 8 with xinitrc
# Add avahi-utils to STEP 3 core packages
# Remove -j $(nproc --all) for compiles
# Add 0644 to /etc/upmpdcli.conf in COMPONENT 6 number 4
# v1.9: Fixes for COMPONENT 6 number 4
# Remove -j arg from make (it causes segfault)
# Fix typo in ./configure: /etcmake -> /etc
# v1.8: Add / to dev/null in STEP 9
# Remove bluealsa.servide disable in STEP 4
# v1.7: Fix step numbering
# Gmusicapi is optional install (COMPONENT 7)
# Squeezelite compile for native DSD support
# Use make -j $(nproc --all) for certain compiles
# Use amixer instead of alsamixer in STEP 9
# Add reference to win32diskimager to Appendix
# Add version suffix to rel-stretch zipfile
# Adjust rel-stretch-ver.zip download path
# v1.6: Add additional dev libs for gmusicapi
# Fix typo in STEP 2, wrong r40b_
# v1.5: Fix various typos
# v1.4: Remove odd binary chars at end of some lines
# v1.3: Added WiFi config to STEP 1
# v1.2: Simplified method for STEPS 1,2
# Bump to MPD 0.20.11
# v1.1: echo "pi:moodeaudio" | sudo chpasswd in STEP 2
# Set 0755 permissions on /var/local/www in STEP 7
# Remove templatesw# fatfinger dir in STEP 7
#
# (C) Tim Curtis 2017 http://moodeaudio.org
#
################################################################
////////////////////////////////////////////////////////////////
//
// STEP 1 - Modify Raspbian Lite and create a new, base image
//
// Use one of the two options below depending on what
// type of host computer you are going to be using.
//
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// OPTION 1: Using Raspbian Linux (Raspberry Pi)
////////////////////////////////////////////////////////////////
1. Download Raspbian Stretch Lite 2017-09-07
wget http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-09-08/2017-09-07-raspbian-stretch-lite.zip
sudo unzip 2017-09-07-raspbian-stretch-lite.zip
sudo rm 2017-09-07-raspbian-stretch-lite.zip
2. Mount the boot and root partitions
LOOPDEV=$(sudo losetup -f)
sudo losetup -P $LOOPDEV 2017-09-07-raspbian-stretch-lite.img
sudo mkdir /mnt/p1
sudo mkdir /mnt/p2
sudo mount -t vfat "$LOOPDEV"p1 /mnt/p1
sudo mount -t ext4 "$LOOPDEV"p2 /mnt/p2
3. Enable SSH
sudo touch /mnt/p1/ssh
4. Optionally enable WiFi connection
a. sudo nano /mnt/p1/wpa_supplicant.conf
b. Paste the lines below into the file making approproate substitutions for SSID and PASSWORD
c. Save the file (Ctrl-x y <return>)
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="YourSSID"
scan_ssid=1
psk="YourPASSWORD"
}
5. Remove Auto-Resize task & switch to using std interface names (eth0, wlan0)
sudo sed -i "s/init=.*//" /mnt/p1/cmdline.txt
sudo sed -i "s/quiet.*//" /mnt/p1/cmdline.txt
sudo rm /mnt/p2/etc/init.d/resize2fs_once
# Configure to use standard interface names
sudo sed -i "s/^/net.ifnames=0 /" /mnt/p1/cmdline.txt
6. Cleanup
sudo losetup -D
sudo umount /mnt/p1
sudo umount /mnt/p2
sudo rmdir /mnt/p1
sudo rmdir /mnt/p2
7. Install the modified 2017-09-07-raspbian-stretch-lite.img to an SD Card
8. Power off
# SR1
sudo poweroff
////////////////////////////////////////////////////////////////
// OPTION 2: Using Windows or Mac computer
////////////////////////////////////////////////////////////////
1. Download Raspbian Stretch Lite 2017-09-07
http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-09-08/2017-09-07-raspbian-stretch-lite.zip
2. Unzip and install the .img file to an SD Card
https://www.raspberrypi.org/documentation/installation/installing-images/
3. Eject the SD Card and then re-insert it
4. Open File Manager (Windows) or Finder (Mac)
5. Click the device named "boot" to show its contents
6. Create an empty file named "ssh" in the boot directory
7. Optionally enable WiFi connection
a. Create a file named wpa_supplicant.conf in the boot directory
b. Paste the lines below into the file making approproate substitutions for SSID and PASSWORD
c. Save the file
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="YourSSID"
scan_ssid=1
psk="YourPASSWORD"
}
8. Edit the file named cmdline.txt
# Remove the text below
quiet init=/usr/lib/raspi-config/init_resize.sh
# Add this text to beginning of the line. Ensure there is a space between this text and the remaining text.
net.ifnames=0
9. Eject the SD Card
////////////////////////////////////////////////////////////////
//
// STEP 2 - Expand the root partition to 3GB
//
////////////////////////////////////////////////////////////////
1. Insert the SD Card into a Raspberry Pi and POWER UP.
2. Change the current password (raspberry) to moodeaudio and the host name to moode.
ssh pi@raspberrypi (pwd=raspberry)
echo "pi:moodeaudio" | sudo chpasswd
sudo sed -i "s/raspberrypi/moode/" /etc/hostname
sudo sed -i "s/raspberrypi/moode/" /etc/hosts
3. Download moOde application sources and configs.
//
// NOTE: We are downloading the Sources in this particular step in order to obtain the resizefs.sh file.
//
// moOde 4.0 BETA 11
//
cd ~
wget http://moodeaudio.org/downloads/beta/rel-stretch-r40b11.zip
sudo unzip ./rel-stretch-r40b11.zip
4. Expand the root partition to 3GB.
sudo cp ./rel-stretch/www/command/resizefs.sh ./
sudo chmod 0755 ./resizefs.sh
sudo sed -i "/PART_END=/c\PART_END=+3000M" ./resizefs.sh
sudo ./resizefs.sh start
sudo rm ./resizefs.sh
sudo cp ./rel-stretch/boot/config.txt.default /boot/config.txt
# SR1
sudo reboot
////////////////////////////////////////////////////////////////
//
// STEP 3 - Install core packages
//
////////////////////////////////////////////////////////////////
1. First lets make some basic optimizations
ssh pi@moode (pwd=moodeaudio)
sudo dphys-swapfile swapoff
sudo update-rc.d dphys-swapfile remove
sudo rm /var/swap
sudo systemctl disable cron.service
sudo systemctl enable rpcbind
sudo apt-get -y purge triggerhappy
2. Install core packages.
# NOTE: run these two commands separately
sudo apt-get update
sudo apt-get -y upgrade
# SR2
sudo reboot
sudo apt-get -y install rpi-update php-fpm nginx sqlite3 php-sqlite3 memcached php-memcache mpc \
bs2b-ladspa libbs2b0 libasound2-plugin-equal telnet automake sysstat squashfs-tools tcpdump shellinabox \
samba smbclient udisks-glue ntfs-3g exfat-fuse git inotify-tools libav-tools avahi-utils
sudo systemctl disable shellinabox
////////////////////////////////////////////////////////////////
//
// STEP 4 - Install enhanced networking
//
////////////////////////////////////////////////////////////////
1. Install Host AP mode
sudo apt-get -y install dnsmasq hostapd
sudo systemctl daemon-reload
sudo systemctl disable hostapd
sudo systemctl disable dnsmasq
2. Install Bluetooth
sudo apt-get -y install bluez bluez-firmware pi-bluetooth \
dh-autoreconf expect libortp-dev libbluetooth-dev libasound2-dev \
libusb-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev libsbc1 libsbc-dev
NOTE: Ignore warnings from autoreconf and configure
cd /tmp
sudo git clone https://github.com/Arkq/bluez-alsa.git
cd bluez-alsa
sudo autoreconf --install
sudo mkdir build
cd build
sudo ../configure --disable-hcitop --with-alsaplugindir=/usr/lib/arm-linux-gnueabihf/alsa-lib
sudo make
sudo make install
cd ~
sudo rm -rf /tmp/bluez-alsa
3. Services are started by moOde Worker so lets disable them here.
sudo systemctl daemon-reload
sudo systemctl disable bluetooth.service
sudo systemctl disable hciuart.service
4. Finish up
sudo mkdir -p /var/run/bluealsa
sudo sync
sudo apt-get clean
# SR3
sudo reboot
////////////////////////////////////////////////////////////////
//
// STEP 5 - Install Rotary encoder driver
//
////////////////////////////////////////////////////////////////
1. WiringPi
NOTE: Ignore warnings during build
sudo cp ./rel-stretch/other/wiringpi/wiringPi-2.44-96344ff.tar.gz ./
sudo tar xfz ./wiringPi-2.44-96344ff.tar.gz
cd wiringPi-96344ff
sudo ./build
cd ~/
sudo rm -rf ./wiringPi-96344ff
sudo rm ./wiringPi-2.44-96344ff.tar.gz
2. Rotenc
sudo cp ./rel-stretch/other/rotenc/rotenc.c ./
sudo gcc -std=c99 rotenc.c -orotenc -lwiringPi
sudo cp ./rotenc /usr/local/bin
sudo rm ./rotenc*
////////////////////////////////////////////////////////////////
//
// STEP 6 - Compile and install MPD
//
////////////////////////////////////////////////////////////////
1. Create MPD runtime environment.
sudo useradd mpd
sudo mkdir /var/lib/mpd
sudo mkdir /var/lib/mpd/music
sudo mkdir /var/lib/mpd/playlists
sudo touch /var/lib/mpd/state
sudo chown -R mpd:audio /var/lib/mpd
sudo mkdir /var/log/mpd
sudo touch /var/log/mpd/log
sudo chmod 644 /var/log/mpd/log
sudo chown -R mpd:audio /var/log/mpd
sudo cp ./rel-stretch/mpd/mpd.conf.default /etc/mpd.conf
sudo chown mpd:audio /etc/mpd.conf
sudo chmod 0666 /etc/mpd.conf
2. Install MPD dev libs.
sudo apt-get -y install libmad0-dev libmpg123-dev libid3tag0-dev \
libflac-dev libvorbis-dev libfaad-dev \
libwavpack-dev \
libavcodec-dev libavformat-dev \
libmp3lame-dev \
libsoxr-dev \
libcdio-paranoia-dev libiso9660-dev \
libcurl4-gnutls-dev \
libasound2-dev \
libshout3-dev libyajl-dev \
libmpdclient-dev \
libavahi-client-dev \
libsystemd-dev \
libwrap0-dev \
libboost-dev \
libicu-dev \
libglib2.0-dev
3. Download MPD 0.20.11 sources and prep for compile.
sudo wget http://www.musicpd.org/download/mpd/0.20/mpd-0.20.11.tar.xz
sudo tar xf mpd-0.20.11.tar.xz
cd mpd-0.20.11
sudo sh autogen.sh
4. Configure compile options.
sudo ./configure --enable-database --enable-libmpdclient --enable-alsa \
--enable-curl --enable-dsd --enable-ffmpeg --enable-flac \
--enable-id3 --enable-soundcloud --enable-lame-encoder --enable-mad \
--enable-mpg123 --enable-pipe-output --enable-recorder-output --enable-shout \
--enable-vorbis --enable-wave-encoder --enable-wavpack --enable-httpd-output \
--enable-soxr --with-zeroconf=avahi \
--disable-bzip2 --disable-zzip --disable-fluidsynth --disable-gme \
--disable-wildmidi --disable-sqlite --disable-jack --disable-ao --disable-oss \
--disable-ipv6 --disable-pulse --disable-nfs --disable-smbclient \
--disable-upnp --disable-expat --disable-lsr \
--disable-sndfile --disable-audiofile --disable-sidplay
5. Compile and install.
sudo make
sudo make install
sudo strip --strip-unneeded /usr/local/bin/mpd
cd ~
sudo rm -rf ./mpd-0.20.11*
sudo apt-get clean
sudo apt-get autoremove
# SR4
sudo reboot
////////////////////////////////////////////////////////////////
//
// STEP 7 - Create moOde runtime environment
//
////////////////////////////////////////////////////////////////
1. Privilages
sudo -i
echo -e 'pi\tALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
echo -e 'www-data\tALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
logout
2. Directories and files
# Dirs
sudo mkdir /var/local/www
sudo mkdir /var/local/www/commandw
sudo mkdir /var/local/www/cssw
sudo mkdir /var/local/www/jsw
sudo mkdir /var/local/www/imagesw
sudo mkdir /var/local/www/imagesw/toggle
sudo mkdir /var/local/www/db
sudo mkdir /var/local/www/templatesw
sudo chmod -R 0755 /var/local/www
sudo mkdir /var/lib/mpd/music/RADIO
sudo mkdir /mnt/NAS
sudo mkdir /mnt/SDCARD
sudo mkdir /mnt/UPNP
# Symlinks
sudo ln -s /mnt/NAS /var/lib/mpd/music/NAS
sudo ln -s /mnt/SDCARD /var/lib/mpd/music/SDCARD
sudo ln -s /media /var/lib/mpd/music/USB
sudo ln -s /var/lib/mpd/music /var/www/mpdmusic
# Logs
sudo touch /var/log/moode.log
sudo chmod 0666 /var/log/moode.log
sudo touch /var/log/php_errors.log
sudo chmod 0666 /var/log/php_errors.log
# Files
sudo cp ./rel-stretch/mpd/sticker.sql /var/lib/mpd
sudo cp -r "./rel-stretch/other/sdcard/Stereo Test/" /var/lib/mpd/music/SDCARD
sudo cp ./rel-stretch/network/interfaces.default /etc/network/interfaces
sudo cp ./rel-stretch/network/wpa_supplicant.conf.default /etc/wpa_supplicant/wpa_supplicant.conf
sudo cp ./rel-stretch/network/dhcpcd.conf.default /etc/dhcpcd.conf
sudo cp ./rel-stretch/network/hostapd.conf.default /etc/hostapd/hostapd.conf
sudo cp ./rel-stretch/var/local/www/db/moode-sqlite3.db.default /var/local/www/db/moode-sqlite3.db
# Permissions
sudo chmod 0777 /var/lib/mpd/music/RADIO
sudo chmod -R 0777 /var/local/www/db
# Deletes
sudo rm -r /var/www/html
sudo rm /etc/update-motd.d/10-uname
////////////////////////////////////////////////////////////////
//
// STEP 8 - Install moOde sources and configs
//
////////////////////////////////////////////////////////////////
1. Application sources and configs
# Ignore "no such file or directory" errors if they appear.
sudo rm /var/lib/mpd/music/RADIO/*
sudo rm /var/www/images/radio-logos/*
sudo cp ./rel-stretch/mpd/RADIO/* /var/lib/mpd/music/RADIO
sudo cp ./rel-stretch/mpd/playlists/* /var/lib/mpd/playlists
sudo cp -r ./rel-stretch/etc/* /etc
sudo cp -r ./rel-stretch/home/* /home/pi
sudo cp -r ./rel-stretch/home/.dircolors /home/pi
sudo mv /home/pi/xinitrc.default /home/pi/.xinitrc
sudo cp -r ./rel-stretch/lib/* /lib
sudo cp -r ./rel-stretch/usr/* /usr
sudo cp -r ./rel-stretch/var/* /var
sudo cp -r ./rel-stretch/www/* /var/www
sudo chmod 0755 /var/www/command/*
sudo /var/www/command/util.sh "emerald" "2ecc71" "27ae60"
sudo sqlite3 /var/local/www/db/moode-sqlite3.db "update cfg_system set value='Emerald' where param='themecolor'"
3. Permissions for service files
# MPD
sudo chmod 0755 /etc/init.d/mpd
sudo chmod 0644 /lib/systemd/system/mpd.service
sudo chmod 0644 /lib/systemd/system/mpd.socket
# Bluetooth
sudo chmod 0666 /etc/bluealsaaplay.conf
sudo chmod 0644 /etc/systemd/system/[email protected]
sudo chmod 0644 /etc/systemd/system/bluealsa.service
sudo chmod 0644 /lib/systemd/system/bluetooth.service
sudo chmod 0755 /usr/local/bin/a2dp-autoconnect
# Rotenc
sudo chmod 0644 /lib/systemd/system/rotenc.service
# Udev
sudo chmod 0644 /etc/udev/rules.d/*
4. Services are started by moOde Worker so lets disable them here.
sudo systemctl daemon-reload
sudo systemctl disable mpd.service
sudo systemctl disable mpd.socket
sudo systemctl disable rotenc.service
# The binaries will not have been installed yet, but let's disable the services here
sudo chmod 0644 /lib/systemd/system/squeezelite-armv6l.service
sudo chmod 0644 /lib/systemd/system/squeezelite-armv7l.service
sudo systemctl disable squeezelite-armv6l
sudo systemctl disable squeezelite-armv7l
sudo chmod 0644 /lib/systemd/system/upmpdcli.service
sudo systemctl disable upmpdcli.service
5. Initial permissions for certain files. These also get set during moOde Worker startup.
sudo chmod 0777 /var/local/www/playhistory.log
sudo chmod 0777 /var/local/www/currentsong.txt
sudo touch /var/local/www/libcache.json
sudo chmod 0777 /var/local/www/libcache.json
# SR5
sudo reboot
////////////////////////////////////////////////////////////////
//
// STEP 9 - Alsaequal
//
////////////////////////////////////////////////////////////////
NOTE: The amixer command below will generate the alsaequal bin file.
sudo amixer -D alsaequal > /dev/null
sudo chmod 0755 /usr/local/bin/alsaequal.bin
sudo chown mpd:audio /usr/local/bin/alsaequal.bin
sudo rm /usr/share/alsa/alsa.conf.d/equal.conf
mpc enable only 1
////////////////////////////////////////////////////////////////
//
// STEP 10 - Optionally squash /var/www
//
////////////////////////////////////////////////////////////////
NOTE: This is optional but highly recommended for performance/reliability
sudo -i
echo "/var/local/moode.sqsh /var/www squashfs ro,defaults 0 0" >> /etc/fstab
logout
cd ~
sudo rm /var/local/moode.sqsh
sudo mksquashfs /var/www /var/local/moode.sqsh
sudo rm -rf /var/www/*
sync
# SR6
sudo reboot
////////////////////////////////////////////////////////////////
//
// STEP 11 - Optionally install latest Linux Kernel
//
////////////////////////////////////////////////////////////////
sudo PRUNE_MODULES=1 rpi-update
sudo rm -rf /lib/modules.bak
sudo rm -rf /boot.bak
# SR7
sudo reboot
////////////////////////////////////////////////////////////////
//
// STEP 12 - Launch and configure moOde!
//
////////////////////////////////////////////////////////////////
1. Initial configuration
a. http://moode
b. Browse Tab, Default Playlist, Add
c. Menu, Configure, Sources, UPDATE mpd database
d. Menu, Audio, Mpd options, EDIT SETTINGS, APPLY
e. Menu, System, Set timezone
f. Clear system logs, YES
g. Compact sqlite database, YES
h. Keyboard
i. Layout
2. Verification
a) Playback tab
b) Scroll to the last item which should be the Stereo Test track
c) Click to begin play
d) Menu, Audio info
e) Verify Output stream is 16 bit 48 kHz
////////////////////////////////////////////////////////////////
//
// STEP 13 - Final prep for image
//
////////////////////////////////////////////////////////////////
1. Optionally check the boot partition.
NOTE: Run these commands one at a time.
If the message "There are differences between boot sector and its backup" appears,
enter 1 "Copy original to backup", then y to "Perform changes ?"
sudo umount /boot
sudo dosfsck -tawl /dev/mmcblk0p1
sudo dosfsck -r /dev/mmcblk0p1
sudo dosfsck -V /dev/mmcblk0p1
sudo mount /boot
2. Reset the network config to defaults
*** IMPORTANT! ***
Don't forget to do this!
sudo rm /var/lib/dhcpcd5/*
sudo cp ./rel-stretch/network/interfaces.default /etc/network/interfaces
sudo cp ./rel-stretch/network/wpa_supplicant.conf.default /etc/wpa_supplicant/wpa_supplicant.conf
sudo cp ./rel-stretch/network/dhcpcd.conf.default /etc/dhcpcd.conf
sudo cp ./rel-stretch/network/hostapd.conf.default /etc/hostapd/hostapd.conf
5. Shut down
# SR8
sudo poweroff
NOTE: Resetting the network config allows the moodecfg.txt automation file to be used to automatically change the
host name and other names at first boot. See the file /var/www/setup.txt for more information on this feature.
################################################################
#
#
# Install additional components
#
#
################################################################
////////////////////////////////////////////////////////////////
//
// COMPONENT 1 - MiniDLNA
//
////////////////////////////////////////////////////////////////
sudo apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install minidlna
sudo systemctl disable minidlna
sudo apt-get -y install djmount
////////////////////////////////////////////////////////////////
//
// COMPONENT 2 - Autoshuffle
//
////////////////////////////////////////////////////////////////
cd ~
sudo git clone https://github.com/Joshkunz/ashuffle.git
cd ashuffle
sudo make
cd ~
sudo cp ./ashuffle/ashuffle /usr/local/bin
sudo rm -rf ./ashuffle
////////////////////////////////////////////////////////////////
//
// COMPONENT 3 - MPD Audio Scrobbler
//
////////////////////////////////////////////////////////////////
cd ~
sudo git clone https://github.com/hrkfdn/mpdas
cd mpdas
sudo make
sudo cp ./mpdas /usr/local/bin
cd ~/
sudo rm -rf ./mpdas
sudo cp ./rel-stretch/usr/local/etc/mpdasrc.default /usr/local/etc/mpdasrc
sudo chmod 0755 /usr/local/etc/mpdasrc
////////////////////////////////////////////////////////////////
//
// COMPONENT 4 - Shairport-sync
//
////////////////////////////////////////////////////////////////
sudo apt-get -y install autoconf libtool libdaemon-dev libasound2-dev libpopt-dev libconfig-dev \
avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev
cd ~
sudo git clone https://github.com/mikebrady/shairport-sync.git
cd shairport-sync
sudo autoreconf -i -f
sudo ./configure --with-alsa --with-avahi --with-ssl=openssl --with-soxr --with-metadata --with-stdout --with-systemd
sudo make
sudo make install
sudo systemctl disable shairport-sync
cd ~
sudo rm -rf ./shairport-sync
sudo cp ./rel-stretch/usr/local/etc/shairport-sync.conf /usr/local/etc
////////////////////////////////////////////////////////////////
//
// COMPONENT 5 - Squeezelite
//
////////////////////////////////////////////////////////////////
BASE=/tmp/squeezelite
git clone https://github.com/ralph-irving/squeezelite $BASE
# ARMV6l (Pi-Zero, A, 1B)
pushd $BASE
export CFLAGS="-O3 -march=native -mcpu=native -DDSD -DRESAMPLE -fno-fast-math -mfloat-abi=hard -pipe -fPIC"
cat ./scripts/squeezelite-ralphy-dsd.patch | patch -p 0
sudo make
sudo cp ./squeezelite /usr/local/bin/squeezelite-armv6l
popd
rm -rf $BASE
# ARMV7l (Pi 2B, 3B)
pushd $BASE
export CFLAGS="-O3 -march=native -mcpu=native -DDSD -DRESAMPLE -fno-fast-math -mfloat-abi=hard -pipe -fPIC"
cat ./scripts/squeezelite-ralphy-dsd.patch | patch -p 0
sudo make
sudo cp ./squeezelite /usr/local/bin/squeezelite-armv7l
popd
rm -rf $BASE
////////////////////////////////////////////////////////////////
//
// COMPONENT 6 - Upmpdcli
//
////////////////////////////////////////////////////////////////
// Enjoy a Coffee and listen to some Tunes while the compiles run :-)
1. Dev libraries
sudo apt-get -y install libmicrohttpd-dev libexpat1-dev \
libxml2-dev libxslt1-dev libjsoncpp-dev python-requests python-pip
2. Libupnp jfd5
cd ~
sudo cp ./rel-stretch/other/upmpdcli/libupnp-1.6.20.jfd5.tar.gz ./
sudo tar xfz ./libupnp-1.6.20.jfd5.tar.gz
cd libupnp-1.6.20.jfd5
./configure --prefix=/usr --sysconfdir=/etc
sudo make
sudo make install
cd ~
sudo rm -rf ./libupnp-1.6.20.jfd5
sudo rm libupnp-1.6.20.jfd5.tar.gz
3. Libupnpp
sudo cp ./rel-stretch/other/upmpdcli/libupnpp-0.16.0.tar.gz ./
sudo tar xfz ./libupnpp-0.16.0.tar.gz
cd libupnpp-0.16.0
./configure --prefix=/usr --sysconfdir=/etc
sudo make
sudo make install
cd ~
sudo rm -rf ./libupnpp-0.16.0
sudo rm libupnpp-0.16.0.tar.gz
4. Upmpdcli
sudo cp ./rel-stretch/other/upmpdcli/upmpdcli-1.2.15.tar.gz ./
sudo tar xfz ./upmpdcli-1.2.15.tar.gz
cd upmpdcli-1.2.15
./configure --prefix=/usr --sysconfdir=/etc
sudo make
sudo make install
cd ~
sudo rm -rf ./upmpdcli-1.2.15
sudo rm upmpdcli-1.2.15.tar.gz
sudo useradd upmpdcli
sudo cp ./rel-stretch/lib/systemd/system/upmpdcli.service /lib/systemd/system
sudo cp ./rel-stretch/etc/upmpdcli.conf /etc
sudo chmod 0644 /etc/upmpdcli.conf
sudo systemctl daemon-reload
sudo systemctl disable upmpdcli
5. upexplorer
NOTE: This also installs a bunch of other utils
sudo git clone https://@opensourceprojects.eu/git/p/libupnppsamples/code libupnppsamples-code
cd libupnppsamples-code
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
cd ~
sudo rm -rf ./libupnppsamples-code
////////////////////////////////////////////////////////////////
//
// COMPONENT 7 - Optionally install gmusicapi
//
////////////////////////////////////////////////////////////////
NOTE: This component enables access to Google Play Music service via UPnP renderer.
If its not installed, the Google Play section in UPnP config screen will not be present.
sudo pip install gmusicapi
////////////////////////////////////////////////////////////////
//
// COMPONENT 8 - Local UI display
//
////////////////////////////////////////////////////////////////
1. Install xserver. Perform this step separately from the rest.
sudo apt-get -y install xinit xorg lsb-release xserver-xorg-legacy chromium-browser libgtk-3-0
2. Permissions, clean up and service config
sudo sed -i "s/allowed_users=console/allowed_users=anybody/" /etc/X11/Xwrapper.config
sudo apt-get clean
sudo systemctl daemon-reload
sudo systemctl disable localui
4. Configure Chrome Browser
NOTE: These steps are performed AFTER actually starting local display via System config,
rebooting and then accessing moOde on the local display.
a. Connect a keyboard.
b. Press Ctrl-t to open a separate instance of Chrome Browser.
c. For Raspberry Pi 7" Touch Display open Chrome settings and set the zoom to 75%.
d. Optionally, enter url chome://extensions and install the xontab virtual keyboard extension.
e. Enter url chrome://flags and scroll down to Overlay Scrollbars and enable the setting.
////////////////////////////////////////////////////////////////
//
// COMPONENT 9 - Allo Piano 2.1 Firmware
//
////////////////////////////////////////////////////////////////
cd ~
wget https://github.com/allocom/piano-firmware/archive/master.zip
sudo unzip master.zip
sudo rm ./master.zip
sudo cp -r ./piano-firmware-master/lib/firmware/allo /lib/firmware
sudo rm -rf ./piano-firmware-master
////////////////////////////////////////////////////////////////
//
// FINAL - Clean up
//
////////////////////////////////////////////////////////////////
cd ~
sudo apt-get clean
sudo /var/www/command/util.sh clear-syslogs
sudo reboot
################################################################
#
#
# Appendix
#
#
################################################################
////////////////////////////////////////////////////////////////
//
// Squashfs procedures
//
////////////////////////////////////////////////////////////////
1. SQUASH /var/www
sudo -i
echo "/var/local/moode.sqsh /var/www squashfs ro,defaults 0 0" >>/etc/fstab
logout
cd ~
sudo rm /var/local/moode.sqsh
sudo mksquashfs /var/www /var/local/moode.sqsh
sudo rm -rf /var/www/*
sync
sudo reboot
2. UNSQUASH /var/www
sudo killall -s 9 watchdog.sh
sudo systemctl stop nginx
sudo systemctl stop php7.0-fpm
sudo umount /var/www
sudo rmdir /var/www
sudo unsquashfs -d /var/www /var/local/moode.sqsh
sync
sudo sed -i /moode.sqsh/d /etc/fstab
sudo rm /var/local/moode.sqsh
sudo reboot
////////////////////////////////////////////////////////////////
//
// SD Card procedures (Mac OSX)
//
////////////////////////////////////////////////////////////////
1. Write SD Card to image file with truncation to the root partition end blk.
NOTE: The count=6238208 param is besed on the 3GB root expansion in STEP 2.
diskutil list
diskutil unmountDisk /dev/disk3
sudo dd if=/dev/disk3 of=/Users/Lt1user/Documents/moode.img count=6238208 bs=512
diskutil eject /dev/disk3
4. Write image to SD Card.
diskutil list
diskutil unmountDisk /dev/disk3
sudo dd if=/Users/Lt1user/Documents/moode.img of=/dev/rdisk3 bs=1m
diskutil eject /dev/disk3
////////////////////////////////////////////////////////////////
//
// SD Card procedures (Windows)
//
////////////////////////////////////////////////////////////////
NOTE: The latest version of Win32diskImager v1.0 now has a setting where you can
select to read only allocated partitions. It is a free download from Sourceforge.
Download it using the link below.
https://sourceforge.net/projects/win32diskimager/
Assuming STEP 2 was performed to resize the root partition to 3GB, the resulting
moode.img file will only be 3GB in size. This will compress down to about 1GB.
################################################################
#
# END
#
################################################################