-
Notifications
You must be signed in to change notification settings - Fork 1
/
drawpile-installer-v1-0-6-official-build-from-sources
2273 lines (2224 loc) · 92 KB
/
drawpile-installer-v1-0-6-official-build-from-sources
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
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
drawpilescriptversion=2.91
scriptname=drawpile-installer-v1-0-6-official-build-from-sources
scriptname2=drawpile-installer-v1-0-6-official-build-from-sources-server-mgmt
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bold=$(tput bold)
underline=$(tput smul)
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
magenta=$(tput setaf 5)
cyan=$(tput setaf 6)
normal=$(tput sgr0)
#
# Text Formatting - Yellow looks orange unless used in bold mode.
# https://stackoverflow.com/questions/2924697/how-does-one-output-bold-text-in-bash
# http://linuxcommand.org/lc3_adv_tput.php
echo
echo 'Made with the assistance of the Creator of Drawpile! His PayPal E-mail if'
echo 'you want to donate some money as thanks for all that he does!'
echo "${underline}[email protected]${normal}"
echo
echo "Script Version ${bold}$drawpilescriptversion${normal}"
echo "'Google Doc --> ${underline}http://tinyurl.com/jx5oe4h ${normal}"
echo "GitHub --> ${underline}https://github.com/Wade821/PiDrawpile.git ${normal}"
echo
echo 'Please make sure you are using the latest version of this script before'
echo 'continuing. You can get the latest version from Github or by making sure'
echo 'the script number above matches the Drawpile Google document version number'
echo 'in the upper right of every page where this script was obtained. If you do'
echo 'not have the newest version, this script should auoto retrieve the newest'
echo 'version of the script. If not, close this window and get the newest'
echo 'version before proceeding.'
echo
read -p 'Press [Enter] key to continue...'
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
echo 'Pick an install location for the use of the Drawpile Server folders.'
echo 'This includes session recordings, file backed sessions which help the'
echo 'server survive crashes or power outages, or template files which help'
echo 'create rooms with specific settings that exist on the server at all'
echo 'times.'
echo
echo "1 - Public Folder ${underline}(Recommended)${normal} - /home/pi/Public"
echo '2 - Desktop Folder - /home/pi/Desktop'
echo '3 - Documents Folder - /home/pi/Documents'
echo '4 - Pictures Folder - /home/pi/Pictures'
echo ' - Other, simply enter the exact location desired without a / at the end.'
echo ' This is an advanced option and not suggested for average users.'
echo ' If using a path with spaces, do NOT use double or single quotes as'
echo ' the script will not work if you do.'
echo " ${underline}Acceptable Example:${normal} /home/pi/Desktop/My Drawpile Server"
echo
echo "${bold}Note:${normal} If you use Windows and Share files across the network, this script"
echo 'will give you the option later to share just the Public folder, or'
echo 'the Music, Pictures, Public, and Videos folders, or the other location'
echo 'personally specified, or no folders.'
echo
echo 'Please make your selection now by entering the number or folder path:'
echo
read dpinstallloc
echo
if [ "$dpinstallloc" == "1" ]; then
dpinstallloc=/home/pi/Public
echo "Install location chosen is $dpinstallloc"
elif [ "$dpinstallloc" == "2" ]; then
dpinstallloc=/home/pi/Desktop
echo "Install location chosen is $dpinstallloc"
elif [ "$dpinstallloc" == "3" ]; then
dpinstallloc=/home/pi/Documents
echo "Install location chosen is $dpinstallloc"
elif [ "$dpinstallloc" == "4" ]; then
dpinstallloc=/home/pi/Pictures
echo "Install location chosen is $dpinstallloc"
else
echo "Install location chosen is $dpinstallloc"
sudo mkdir -p -v "$dpinstallloc"
fi
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
cd "$dpinstallloc/"
sudo mkdir -p -v Programs
cd "$dpinstallloc/Programs"
sudo wget "https://raw.githubusercontent.com/Wade821/PiDrawpile/master/$scriptname"
sudo chmod 777 "$dpinstallloc/Programs" -R
echo
dpcheckversion=$(grep -m 1 "drawpilescriptversion=" "$dpinstallloc/Programs/$scriptname" | cut -c 23-26)
currentscriptname="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")"
if [[ "$drawpilescriptversion" < "$dpcheckversion" ]]; then
echo "Newest Script is using version $dpcheckversion."
echo "Newer version of script available, the old script has been copied over"
echo "the old script. Please re-run this script to use newest version."
cd "$dpinstallloc"
sudo rm -rf "$SCRIPTDIR/$currentscriptname"
sudo cp "$dpinstallloc/Programs/$scriptname" "$SCRIPTDIR/$currentscriptname"
sudo chmod 777 "$SCRIPTDIR/$currentscriptname"
sudo rm -rf "$dpinstallloc/Programs/$scriptname"
echo "Terminating script in 30 seconds."
echo
sleep 30s
exit
elif [[ "$drawpilescriptversion" = "$dpcheckversion" ]]; then
echo "Script is newest version available."
sudo rm -rf "$dpinstallloc/Programs/$scriptname"
elif [[ "$drawpilescriptversion" > "$dpcheckversion" ]]; then
echo "It appears the creator of the script has failed to update github with the newest version."
echo "Please contact him to update the script there by emailing him at [email protected]"
echo
echo "Script in use: $drawpilescriptversion"
echo "Github Script: $dpcheckversion"
echo
echo "Pausing script for 30 seconds before continuing."
sudo rm -rf "$dpinstallloc/Programs/$scriptname"
sleep 30s
else
echo "Unable to determine script version, proceeding with script."
fi
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
echo "${bold}*****Updating software list available for updates and new packages. . . .*****${normal}"
echo
sudo apt-get -q -y update
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
echo 'This stage will give you an option to set up your Raspberry Pi for file'
echo 'sharing with Windows so that you can copy or move files to and from'
echo 'the device. This also means it will be easier to get recorded sessions,'
echo 'templates, and the archived file backed sessions from the drawpile'
echo 'server to your computer.'
echo
echo 'What folders would you like to share to access on the network?'
echo 'Enter a number and hit enter to continue.'
echo
echo 'Press 1 for Public Folder Only.'
echo 'Press 2 for Music, Pictures, Public, and Videos.'
echo 'Press 3 for custom location of drawpile Server files only to be shared.'
echo " Will share the location $dpinstallloc"
echo 'Press 4 for no Windows file sharing to be set up.'
echo
read samba
echo
if [ "$samba" == "1" ]; then
echo '*****Installing Samba for Windows Network Sharing...*****'
sudo apt-get -q -y install samba samba-common-bin
sudo chmod 777 /etc/samba/smb.conf
sudo sed -i '/workgroup = MYWORKGROUP/ c\workgroup = WORKGROUP' /etc/samba/smb.conf
sudo sed -i '/\# wins support = no/ c\ wins support = yes' /etc/samba/smb.conf
echo
sudo chmod 777 /home/pi/Public -R
echo "[Pi-Public]
comment = Pi Public Shared Folder
path = /home/pi/Public
guest ok = yes
browsable = yes
read only = no
create mask = 0777
directory mask = 0777" >> /etc/samba/smb.conf
sudo chmod 641 /etc/samba/smb.conf
sudo samba restart
echo 'Read more on Samba --> http://tinyurl.com/y9t5qxbv'
#Read more on Samba --> https://www.daedtech.com/create-a-windows-share-on-your-raspberry-pi/
echo
elif [ "$samba" == "2" ]; then
echo '*****Installing Samba for Windows Network Sharing...*****'
sudo apt-get -q -y install samba samba-common-bin
sudo chmod 777 /etc/samba/smb.conf
sudo sed -i '/workgroup = MYWORKGROUP/ c\workgroup = WORKGROUP' /etc/samba/smb.conf
sudo sed -i '/\# wins support = no/ c\ wins support = yes' /etc/samba/smb.conf
echo
sudo chmod 777 /home/pi/Public -R
sudo chmod 777 /home/pi/Music -R
sudo chmod 777 /home/pi/Pictures -R
sudo chmod 777 /home/pi/Videos -R
echo "[Pi-Public]
comment = Pi Public Shared Folder
path = /home/pi/Public
guest ok = yes
browsable = yes
read only = no
create mask = 0777
directory mask = 0777
[Pi-Music]
comment = Pi Music Shared Folder
path = /home/pi/Music
guest ok = yes
browsable = yes
read only = no
create mask = 0777
directory mask = 0777
[Pi-Pictures]
comment = Pi Pictures Shared Folder
path = /home/pi/Pictures
guest ok = yes
browsable = yes
read only = no
create mask = 0777
directory mask = 0777
[Pi-Videos]
comment = Pi Videos Shared Folder
path = /home/pi/Videos
guest ok = yes
browsable = yes
read only = no
create mask = 0777
directory mask = 0777" >> /etc/samba/smb.conf
sudo chmod 641 /etc/samba/smb.conf
sudo samba restart
echo 'Read more on Samba --> http://tinyurl.com/y9t5qxbv'
#Read more on Samba --> https://www.daedtech.com/create-a-windows-share-on-your-raspberry-pi/
elif [ "$samba" == "3" ]; then
echo '*****Installing Samba for Windows Network Sharing...*****'
sudo apt-get -q -y install samba samba-common-bin
sudo chmod 777 /etc/samba/smb.conf
sudo sed -i '/workgroup = MYWORKGROUP/ c\workgroup = WORKGROUP' /etc/samba/smb.conf
sudo sed -i '/\# wins support = no/ c\ wins support = yes' /etc/samba/smb.conf
echo
sudo chmod 777 "$dpinstallloc/" -R
echo "[Pi-Drawpile-Server]
comment = Pi Drawpile Server
path = \"$dpinstallloc\"
guest ok = yes
browsable = yes
read only = no
create mask = 0777
directory mask = 0777" >> /etc/samba/smb.conf
sudo chmod 641 /etc/samba/smb.conf
sudo samba restart
echo 'Read more on Samba --> http://tinyurl.com/y9t5qxbv'
#Read more on Samba --> https://www.daedtech.com/create-a-windows-share-on-your-raspberry-pi/
else
echo 'No Windows file sharing to be set up!'
fi
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
echo 'This stage is for setting up an easy to remember way to connect to your server.'
echo
echo "${underline}https://freedns.afraid.org/ ${normal}"
echo "${bold}Pros:${normal} Free registration, renew hostname every six months."
echo "${bold}Cons:${normal} Minor additional setup with script guided help required, guided setup."
echo ' If a typo is made, you must use crontab -e to update the code manually.'
echo
echo "${underline}https://www.noip.com/ ${normal}"
echo "${bold}Pros:${normal} Free registration, simple setup, only slightly less complex than above"
echo ' option listed above.'
echo "${bold}Cons:${normal} Must renew the hostname via notification received in email every 30 days"
echo ' or lose access. Might not be able to get the same name back.'
echo
echo 'Do you want to use freeDNS.afraid.org or No-IP?'
echo 'Enter a number and hit enter to continue.'
echo
echo 'Press 1 for freeDNS.afraid.org'
echo 'Press 2 for No-IP'
echo 'Press 3 to skip this step.'
echo
read dns
echo
if [ "$dns" == "1" ]; then
echo '*****Setting up FreeDNS.afraid.org cronjob for auto update of IP...*****'
echo
echo 'Requirements: Register an account, go to Subdomains option on the left,'
echo 'select option Add a subdomain. Leave Type set to A, set any desired subdomain'
echo 'name that you wish to use. Domain options are listed in the dropbox, you can '
echo 'pick Many many more available in order to search for domain names you like '
echo 'that are listed as Public. Click the link Shared Domain Registry and search '
echo 'for a desired domain. Once you find a name you like, click on the link on the'
echo 'left. Leave the fields Destination, TTL, and Wildcard as they currently are... '
echo 'and fill in the Captcha that everyone loves and hates.'
echo
echo 'Click on Dynamic DNS on the left, then go to dynamic update interface'
echo 'hyperlink at the top of the page, should say (version 2) beside it. Click '
echo 'the checkbox beside your hostname, click Apply below that where the option to '
echo 'the left should read: Action: Enable Dynamic DNS... . Then click cron script'
echo 'on the gray table to the right of your registered hostname.'
echo
echo 'Copy only the very bottom line of the page and paste here.'
echo 'Press Ctrl + Shift + V to paste.'
echo 'That is everything which appears after this line ... '
echo 'PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin'
echo
read freeDNS
echo
(crontab -l 2>>/dev/null; echo "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
$freeDNS") | crontab
elif [ "$dns" == "2" ]; then
echo '*****Installing No-IP...*****'
cd "$dpinstallloc/Programs"
sudo mkdir -p -v noip
cd noip
sudo wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
sudo tar vzxf noip-duc-linux.tar.gz
cd noip-2.1.9-1
sudo make
echo
echo 'https://www.noip.com/'
echo
echo 'Requirements: Once logged in, you should be looking at the dashboard. You will '
echo 'know if the hyperlink at the top is https://my.noip.com/#!/. Just type'
echo 'your desired hostname and choose a domain drop down that you like. from the '
echo 'Free Domains options. Click the button Add Hostname. You will just need your '
echo 'username and password to set this up.'
echo
echo 'If using the classic site, click Add Host on the left. Type in your Hostname,'
echo 'and choose a domain on the right from the list of No-IP Free Domains. Make '
echo 'sure the host type is set to DNS Host (A). For IP Address, open a new tab'
echo 'and go to www.whatismyip.com to get your IP and put it in this field. Leave '
echo 'other options at default values and click Add Host.'
echo
echo 'You will be prompted to login with your No-IP account username and password.'
echo 'After logging into the DUC program, answer the questions to proceed. When asked'
echo 'how often you want the update to happen you must choose 5 or more. The interval'
echo 'is listed in minutes, if you choose 5 the update interval will be 5 minutes.'
echo 'If you choose 30 the interval will be 30 minutes.'
sudo make install
sudo /usr/local/bin/noip2
#echo 'Confirming service is working properly...'
#sudo noip2 -S
#Read install process here --> http://www.noip.com/support/knowledgebase/install-ip-duc-onto-raspberry-pi/
echo 'If you made a typo when putting in your password for no IP, simply'
echo 'type the following:'
echo
echo 'noip2 -C -c /usr/local/etc/no-ip2.conf'
else
echo 'No IP update service to be set up!'
fi
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
echo "${bold}*****Adding user for security purposes for Drawpile . . .*****${normal}"
echo 'The server cannot run under a user with root access, so we must create a new'
echo 'user.'
echo
sudo adduser drawpileuser -ingroup users --gecos ""
groups drawpileuser
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
echo "${bold}*****Installing Dependencies . . .*****${normal}"
echo
echo 'Would you like to update all installed packages? This step may take a while'
echo 'to complete if you choose to do this.'
echo
echo 'Enter a letter and hit enter to continue.'
echo
echo 'y for yes'
echo 'n for no'
echo
read x
echo
if [ "$x" == "y" ]; then
echo 'Updating already installed packages . . .'
echo
sudo apt-get -q -y upgrade
sudo apt-get clean
else
echo 'Skipping update of all installed packages.'
fi
echo
echo 'Installing dependencies . . .'
# Compile Client Requirements - https://github.com/drawpile/Drawpile/wiki/Building-from-sources
#
# **Actual Dependencies**
# cmake - Cross platform open source make system
# extra-cmake-modules - Extra modules and scripts for CMake
# g++ - compiler
# libgif-dev - library for GIF images (development) (enables animated GIF export)
# libkf5archive-dev - development files for karchive
# libkf5dnssd-dev - development files for kdnssd (enables local server discovery)
# libminiupnpc-dev - UPnP IGD client lightweight library development files (enables automatic port forwarding)
# libqt5network5 - Qt 5 network module
# libqt5svg5-dev - Qt 5 SVG module development files
# miniupnpc - UPnP IGD client lightweight library client (enables automatic port forwarding)
# qtbase5-dev - Qt 5 base development files
# qtmultimedia5-dev - APIs for multimedia functionality - development files
# qttools5-dev - Qt 5 tools development files
sudo apt-get -q -y install cmake extra-cmake-modules g++ libgif-dev libkf5archive-dev libkf5dnssd-dev libminiupnpc-dev libqt5network5 libqt5svg5-dev miniupnpc qtbase5-dev qtmultimedia5-dev qttools5-dev
sudo apt-get clean
echo
# **Optional Dependencies**
# libmicrohttpd-dev - library embedding HTTP server functionality (development, used for remote administration of drawpile server)
# libsystemd - systemd utility library - development files (enable socket drawpile server startup I believe)
# mini-httpd - Small HTTP server (Used for creating password for use with NGINX)
# nginx - small, powerful, scalable web/proxy server (used for reverse proxy to manage drawpile server in a more secure manner)
# openssl - Secure Sockets Layer toolkit - cryptographic utility (used to create SSL key for encrypted drawing sessions)
# QtColorPicker - Not chosen for install as it is bundled, but external library is used if available
sudo apt-get -q -y install libmicrohttpd-dev libsystemd-dev mini-httpd nginx openssl
sudo apt-get clean
echo
#
# Not in use, left here for notes.
# gnome-schedule sqlite3 sqlitebrowser
#
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
echo "${bold}*****Cloning Repository . . .*****${normal}"
echo
cd "$dpinstallloc"
sudo chmod 777 "$dpinstallloc" -R
cd "$dpinstallloc/Programs"
echo
git clone https://github.com/drawpile/Drawpile.git
cd Drawpile
git checkout -f 1.0.6
#
# drawpile-srv 1.0.6
# Protocol version: 15.6
# Qt version: 5.7.1 (compiled against 5.7.1)
# SSL library version: OpenSSL 1.0.2l 25 May 2017 (268443855)
#
# Use the git hub link to access more information about drawpile on a web browser.
echo
echo "--------------------------------------------------------------------------------"
echo "--------------------------------------------------------------------------------"
echo
echo "${bold}*****Preparing to Build Drawpile . . .*****${normal}"
echo
cd "$dpinstallloc/Programs/Drawpile"
sudo mkdir -p -v build
sudo chmod 777 "$dpinstallloc/Programs/Drawpile/build" -R
cd "$dpinstallloc/Programs/Drawpile/build"
#
#---------------------------------------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------------------------------------
# These lines are to fix an issue with an older version of KArchive which cannot be easily upgraded.
# KArchive apparently doesn't supply a version number macro so this can't be detected at compile time as a problem.
# File is located under Drawpile/src/client/ora/orawriter.cpp and replaces the following text
# zip.errorLine()
# zf.errorLine()
#
# with this instead as per the creator of Drawpile
#
# QString("ZIP error")
#
#It is presumable that the current (09/18/2017) stable release of KArchive at 5.28.0-2 has this issue fixed with
#the testing version of KArchive which is 5.37.0-2. Once updated to or past that number, this section below should
#no longer be necessary to use.
#
# Page for newest KArchive download ---> https://api.kde.org/frameworks/karchive/html/index.html
# Also see https://tracker.debian.org/pkg/karchive
# Or see https://packages.qa.debian.org/k/karchive.html
#---------------------------------------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------------------------------------
echo
version=$(apt-cache policy libkf5archive-dev | grep "Installed:" | cut -c 14-40)
echo "K Archive is using version $version"
echo
if [[ "$version" > "5.29" ]]; then
echo "Installed version of K Archive is greater than 5.29."
echo "No modification of source files required."
elif [[ "$version" = "5.29" ]]; then
echo "Installed version of K Archive is equal to 5.29."
echo "No modification of source files required."
elif [[ "$version" < "5.29" ]]; then
echo "Installed version of K Archive is less than 5.29."
echo "Modification of source files required."
echo
echo 'Creating backup of file orawriter.cpp before modification.'
sudo cp "$dpinstallloc/Programs/Drawpile/src/client/ora/orawriter.cpp" "$dpinstallloc/Programs/Drawpile/src/client/ora/orawriter.cpp.backup"
echo
echo 'Modifying file orawriter.cpp for use with older version of KArchive (5.28.0-2).'
sudo sed -i -e 's/zip.errorString()/QString("ZIP error")/g' "$dpinstallloc/Programs/Drawpile/src/client/ora/orawriter.cpp"
sudo sed -i -e 's/zf.errorString()/QString("ZIP error")/g' "$dpinstallloc/Programs/Drawpile/src/client/ora/orawriter.cpp"
else
echo "Unable to make a determination of which version of K Archive is installed."
fi
echo
echo
#---------------------------------------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------------------------------------
echo
echo "${bold}*****Drawpile Build Configuration . . .*****${normal}"
echo
echo 'These options configure the installation of Drawpile for your device.'
echo 'All options with the server assume systemd will be in use.'
echo 'Recommended Options: 1, 3, or 4.'
echo
echo 'Enter a number and hit enter to continue.'
echo
echo 'Drawpile Server Only Options:'
echo '1 for Drawpile Server Only - connect from a desktop or laptop.'
echo '2 for Drawpile Server Only - No GUI or graphics interface - headless'
echo
echo 'Drawpile Server & Client Options:'
echo '3 - Server & Client with Wacom'
echo '4 - Server & Client'
echo '5 - Server & Client - dprectool and debugging version'
echo
echo 'Drawpile Client Only Options:'
echo '6 for Drawpile Client Only with Wacom'
echo '7 for Drawpile Client Only'
echo
read x
echo
echo
echo "${bold}*****Determine Compile Speed . . .*****${normal}"
echo
tMax=$(grep -c ^processor /proc/cpuinfo)
echo 'You can hit enter to continue here, as it will pick the maximum amount of'
echo 'threads available from the processor. If the script froze at this stage, try'
echo "a lower number than $tMax. This uses less system resources on the Pi and is "
echo 'more likely to complete without freezing up.'
echo
echo 'This is the command to be run, where # is a number input by you:'
echo 'sudo make -j #'
echo
read -p "Enter compiling thread count (blank for maximum of $tMax): " threadCount
echo
while [ true ] ; do
if [ -z "$threadCount" ] ; then
echo "Compiling using maximum"
threadCount=$tMax
echo
break
elif [[ $threadCount =~ ^[0-9]+$ ]] ; then
if (($threadCount>0)) && (($threadCount<=$tMax)) ; then
break
else
echo "Value: '$threadCount' is not within the range [1,$tMax]"
echo
fi
else
echo "Value: '$threadCount' is not a positive integer"
echo
fi
read -p "Enter compiling thread count (blank for maximum of $tMax): " threadCount
echo
done
echo
echo
if [ "$x" == "2" ]; then
sudo cmake .. -DINITSYS=systemd -DCLIENT=OFF -DSERVERGUI=off
elif [ "$x" == "3" ]; then
sudo cmake .. -DINITSYS=systemd
sudo apt-get -q -y install libwacom-bin libwacom-common libwacom-dev libwacom2 libwacom2-dbg xserver-xorg-input-wacom
echo
xsetwacom --list devices
echo
xsetwacom --list parameters
echo
echo 'Use the following in the terminal more information.'
echo 'man wacom'
echo
echo 'You can set the tablet from absolute positioning to relative via this command.'
echo 'xsetwacom set stylus mode relative'
echo
echo 'You may have to replace stylus with the ID listed for the device, which you'
echo 'can find by typing the following: xwacom --list devices'
echo 'Additionally, you may use the full name of the device in single quotes as well'
echo 'To represent the device. For example, the following could be used . . .'
echo 'Wacom Intuos3 6x8 Pen stylus'
echo
echo 'There does not appear to be any working graphical based configuration program'
echo 'for the wacom tablet that I have been able to find as of yet.'
echo
echo 'Read more on configuring your Wacom Tablet here --> http://tinyurl.com/blhyk7m'
echo 'write the following command in the terminal to read more on Wacom Configuration:'
echo 'man wacom'
echo
elif [ "$x" == "4" ]; then
sudo cmake .. -DINITSYS=systemd
elif [ "$x" == "5" ]; then
sudo cmake .. -DINITSYS=systemd -DTOOLS=on -DCMAKE_BUILD_TYPE=debug
elif [ "$x" == "6" ]; then
sudo cmake .. -DSERVER=off
sudo apt-get -q -y install libwacom-bin libwacom-common libwacom-dev libwacom2 libwacom2-dbg xserver-xorg-input-wacom
echo
xsetwacom --list devices
echo
xsetwacom --list parameters
echo
echo 'Use the following in the terminal more information.'
echo 'man wacom'
echo
echo 'You can set the tablet from absolute positioning to relative via this command.'
echo 'xsetwacom set stylus mode relative'
echo
echo 'You may have to replace stylus with the ID listed for the device, which you'
echo 'can find by typing the following: xwacom --list devices'
echo 'Additionally, you may use the full name of the device in single quotes as well'
echo 'To represent the device. For example, the following could be used . . .'
echo 'Wacom Intuos3 6x8 Pen stylus'
echo
echo 'There does not appear to be any working graphical based configuration program'
echo 'for the wacom tablet that I have been able to find as of yet.'
echo
echo 'Read more on configuring your Wacom Tablet here --> http://tinyurl.com/blhyk7m'
echo 'write the following command in the terminal to read more on Wacom Configuration:'
echo 'man wacom'
echo
echo
echo "Compiling with $threadCount threads."
echo
sudo make -j $threadCount
echo
echo 'Making installation of compiled program, libraries, and documentation to proper locations.'
sudo make install
#Location of created executable --> /usr/local/bin/
echo
echo "Compiling complete, exiting script since no further config is required."
echo
sleep 30s
exit
elif [ "$x" == "7" ]; then
sudo cmake .. -DSERVER=off
echo
echo "Compiling with $threadCount threads."
echo
sudo make -j $threadCount
echo
echo 'Making installation of compiled program, libraries, and documentation to proper locations.'
sudo make install
#Location of created executable --> /usr/local/bin/
echo
echo "Compiling complete, exiting script since no further config is required."
echo
sleep 30s
exit
else
sudo cmake .. -DINITSYS=systemd -DCLIENT=OFF
fi
echo
echo "Compiling with $threadCount threads."
echo
sudo make -j $threadCount
echo
echo 'Making installation of compiled program, libraries, and documentation to proper locations.'
sudo make install
#Location of created executable --> /usr/local/bin/
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
echo "${bold}*****Drawpile is Compiled . . *****${normal}"
echo
echo
echo "${bold}***** Now setting up for automated startup . . .*****${normal}"
echo
echo 'This script assumes you have a hostname, and it is required for'
echo 'encrypted server connections to protect private conversations'
echo 'and also to mask your Public IP address when connecting to the'
echo 'server.'
echo
echo 'Make sure this is correctly typed both times before proceeding'
echo 'with the script. If you do not enter it correctly, users will'
echo 'not be able to connect to hosted sessions with the server using'
echo 'encryption by SSL.'
echo
echo "${bold}For example:${normal}"
echo "${underline}example.hostwebsite.com ${normal}"
echo
echo 'If you do not have one, simply leave it blank and hit enter'
echo 'twice. However, it is highly recommended to have one, they'
echo 'are free after all!'
echo
echo "${bold}Note:${normal} If you do make a mistake, you can always run"
echo "Option ${underline}6 - Change all startup options.${normal} via the script"
echo 'drawpile-server.sh later on.'
echo
echo 'If you have a hostname please enter it now.'
echo
read -p "Enter hostname: " hostname1
read -p "Enter hostname again: " hostname2
while [[ $hostname1 != $hostname2 ]]
do
echo
echo "Hostnames entered do not match!"
echo
read -p "Enter hostname: " hostname1
read -p "Enter hostname again: " hostname2
done
#
hostname=$hostname1
echo
echo "Your hostname is: $hostname"
echo
echo 'This will be used to display in the session listing instead of your'
echo 'public IP address.'
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
echo "${bold}***** Setting up SSL Certificate Creation . . . *****${normal}"
echo
echo 'This section is for encrypting sessions to keep them more private.'
echo 'Fill out this section regardless of whether you plan to use encryption'
echo 'or not, as later on you will have the option to decide if you want to'
echo 'use this or not.'
echo
echo 'Please note in the following sections that the parts contained within'
echo 'the brackets are the default option if no information is entered.'
echo
echo 'Country Name (2 letter code) [AU]:'
echo
read country
echo
if [ "$country" != "" ]; then
echo "Selected: $country"
else
country="AU"
fi
echo
echo '--------------------------------------------------------------------------------'
echo
echo 'State or Province Name (full name) [Some-State]:'
echo
read state
echo
if [ "$state" != "" ]; then
echo "Selected: $state"
else
state="Some-State"
fi
echo
echo '--------------------------------------------------------------------------------'
echo
echo 'Locality name (e.g., city) [Some-City]:'
echo
read locality
echo
if [ "$locality" != "" ]; then
echo "Selected: $locality"
else
locality="Some-City"
fi
echo
echo '--------------------------------------------------------------------------------'
echo
echo 'Organization Name (eg, company) [Internet Widgits Pty Ltd]:'
echo
read organization
echo
if [ "$organization" != "" ]; then
echo "Selected: $organization"
else
organization="Internet Widgits Pty Ltd"
fi
echo
echo '--------------------------------------------------------------------------------'
echo
echo 'Organizational Unit Name (e.g., section) [Collaborating Artists]:'
echo
read unitname
echo
if [ "$unitname" != "" ]; then
echo "Selected: $unitname"
else
unitname="Collaborating Artists"
fi
echo
echo '--------------------------------------------------------------------------------'
echo
echo 'Email Address [[email protected]]'
echo
read email
echo
if [ "$email" != "" ]; then
echo "Selected: $email"
else
email="[email protected]"
fi
echo
echo '--------------------------------------------------------------------------------'
echo
sudo openssl req -x509 -newkey rsa:2048 -nodes -keyout /home/drawpileuser/key.pem -out /home/drawpileuser/cert.pem -days 365 -subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$unitname/CN=$hostname/emailAddress=$email"
echo
sudo chmod 777 /home/drawpileuser/
sudo chown drawpileuser /home/drawpileuser/cert.pem
sudo chown drawpileuser /home/drawpileuser/key.pem
echo
echo
echo "#!/bin/bash
sudo chmod 777 /home/drawpileuser/
sudo openssl req -x509 -newkey rsa:2048 -nodes -keyout /home/drawpileuser/key.pem -out /home/drawpileuser/cert.pem -days 365 -subj \"/C=$country/ST=$state/L=$locality/O=$organization/OU=$unitname/CN=$hostname/emailAddress=$email\"
sudo chown drawpileuser /home/drawpileuser/cert.pem
sudo chown drawpileuser /home/drawpileuser/key.pem
sudo chmod 755 /home/drawpileuser/!(ssl.sh)
echo
if [ \"\`systemctl is-enabled drawpile-srv.socket\`\" = \"enabled\" ]
then
echo \"drawpile-srv.socket previously enabled, restarting server.\"
sudo systemctl restart drawpile-srv.socket
else [ \"\`systemctl is-enabled drawpile-srv.service\`\" = \"enabled\" ]
echo \"drawpile-srv.service previously enabled, restarting server.\"
sudo systemctl restart drawpile-srv.service
fi" > /home/drawpileuser/ssl.sh
echo
sudo chmod 755 /home/drawpileuser/!(ssl.sh)
echo
sudo chmod 777 /home/drawpileuser/ssl.sh
echo
hostname="--announce-local-addr $hostname"
#---------------------------------------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------------------------------------
# Default info in crontab, use command "crontab -e" to open for manual editing.
#---------------------------------------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------------------------------------
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
#---------------------------------------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------------------------------------
# Read more on Crontab below
# https://www.raspberrypi.org/documentation/linux/usage/cron.md
# https://askubuntu.com/questions/408611/how-to-remove-or-delete-single-cron-job-using-linux-command
# The line below adds a job to crontab. Read more here --> https://stackoverflow.com/questions/8579330/appending-to-crontab-with-a-shell-script-on-ubuntu
# Use "crontab -r" to reset crontab's configuration. Manual editing "crontab -e" --> https://askubuntu.com/questions/793578/resetting-crontab-file-to-default
echo
(crontab -l 2>>/dev/null; echo "*/0 0 1 11 * /home/drawpileuser/ssl.sh") | crontab
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
echo 'Making backup of drawpile-srv.service before modification.'
echo
sudo cp "$dpinstallloc/Programs/Drawpile/server/drawpile-srv.service" "$dpinstallloc/Programs/Drawpile/server/drawpile-srv.service.backup"
echo
echo 'Modifying drawpile-srv.service . . .'
echo
sudo chmod 777 "$dpinstallloc/Programs/Drawpile/server/drawpile-srv.service"
#
cd "$dpinstallloc"
sudo chmod 777 "$dpinstallloc" -R
cd "$dpinstallloc/Programs"
sudo mkdir -p -v Drawpile-Srv-Files
cd Drawpile-Srv-Files
sudo chmod 777 "$dpinstallloc/Programs/Drawpile-Srv-Files/" -R
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
#
# This is for session recordings, however it is not necessary when using file backed sessions.
# --record "$dpinstallloc/Programs/Drawpile-Srv-Files/session-record/%d--%a--%a.dprec"
#
# Code to place after the database file in order to use httpd to authenticate instead. Username and password is plain text, no hash.
# --web-admin-port 27780 --web-admin-access all --web-admin-auth user:pass
#
# Default location of the GUI Database if no location is specified.
# /home/pi/.local/share/drawpile/drawpile-srv/guiserver.db
# sudo chmod 777 /home/pi/.local/share/drawpile/drawpile-srv/guiserver.db
#
# Location provided by Calle for drawpileuser database. Can be used when drawpile-srv supports socket activation for web admin.
# /home/drawpileuser/server.db
#
echo "Determine how you want drawpile-srv to run now. ${underline}Option 2${normal} is recommended"
echo 'if you have a hostname. If you do not have a hostname, option 6 instead.'
echo 'All settings will automatically work, though some additional setup for'
echo 'session templates is required. Read more on the hyperlink below.'
echo
echo "${bold}${cyan}Short summary of options:${normal}"
echo " Read more --> ${underline}https://drawpile.net/help/server/${normal}"
echo "${bold}web remote admin${normal} - add users, ban users, set auto session reset, etc."
echo "${bold}recording${normal} - records all sessions, may not be necessary with file backed"
echo ' sessions turned on, though it can be useful for debugging broken boards or '
echo ' recovering art from broken boards. This can be turned on an individual basis'
echo ' when a room is active on the server by going to File and then Record... ,'
echo " or by combining the file backed sessions option and checking ${underline}Archive"
echo " terminated sessions${normal}."
echo "${bold}ssl${normal} - Encrypt data sent so conversations and drawings are kept private."
echo ' If you do not have this option on, sensitive information should not'
echo ' be shared in sessions. I.E. credit cards.'
echo
echo "${bold}${cyan}These options assume you have a host name.${normal}"
echo ' 1 - Run drawpile-srv w all options.'
echo " 2 - Run drawpile-srv w web admin & ssl - ${underline}recommended${normal}"
echo ' 3 - Run drawpile-srv w web admin & session recording'
echo ' 4 - Run drawpile-srv w web admin'
echo
echo "${bold}${cyan}These options assume you do not have a host name.${normal}"
echo ' 5 - Run drawpile-srv w web admin & session recording'
echo ' 6 - Run drawpile-srv w web admin'
echo
read systemd
echo
if [ "$systemd" == "1" ]; then
echo '1 - Run drawpile-srv w all options.'
sudo mkdir -p -v session-record
sudo chmod 777 "$dpinstallloc/Programs/Drawpile-Srv-Files/session-record" -R
sudo chown drawpileuser "$dpinstallloc/Programs/Drawpile-Srv-Files/session-record" -R
systemd=" --record \"$dpinstallloc/Programs/Drawpile-Srv-Files/session-record/%d--%a--%a.dprec\" --secure --ssl-cert /home/drawpileuser/cert.pem --ssl-key /home/drawpileuser/key.pem $hostname"
elif [ "$systemd" == "2" ]; then
echo '2 - Run drawpile-srv w web admin & ssl - recommended'
systemd=" --secure --ssl-cert /home/drawpileuser/cert.pem --ssl-key /home/drawpileuser/key.pem $hostname"
elif [ "$systemd" == "3" ]; then
echo '3 - Run drawpile-srv w web admin & session recording'
sudo mkdir -p -v session-record
sudo chmod 777 "$dpinstallloc/Programs/Drawpile-Srv-Files/session-record" -R
sudo chown drawpileuser "$dpinstallloc/Programs/Drawpile-Srv-Files/session-record" -R
systemd=" --record \"$dpinstallloc/Programs/Drawpile-Srv-Files/session-record/%d--%a--%a.dprec\" $hostname"
elif [ "$systemd" == "4" ]; then
echo '4 - Run drawpile-srv w web admin'
systemd=" $hostname"
elif [ "$systemd" == "5" ]; then
echo '5 - Run drawpile-srv w web admin & session recording'
sudo mkdir -p -v session-record
sudo chmod 777 "$dpinstallloc/Programs/Drawpile-Srv-Files/session-record" -R
sudo chown drawpileuser "$dpinstallloc/Programs/Drawpile-Srv-Files/session-record" -R
systemd=" --record \"$dpinstallloc/Programs/Drawpile-Srv-Files/session-record/%d--%a--%a.dprec\""
else [ "$systemd" == "6" ]
echo '6 - Run drawpile-srv w web admin'
systemd=""
fi
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
echo 'Please set the session size limit now in megabytes.'
echo
echo 'Example: 10MB'
echo 'This will set a session limit of 10MB'
echo
echo 'If you just hit enter with nothing, it will default'
echo 'to 15MB. Do not use spaces.'
echo
read sessionsizeLimit
echo
if [ "$sessionsizeLimit" != "" ]; then
echo "Your session size limit is $sessionsizeLimit."
else
sessionsizeLimit=15MB
echo "Your session size limit is $sessionsizeLimit."
fi
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
#
#
echo 'Please set the max number of sessions at any one time.'
echo 'to run on the server.'
echo
echo 'If you just hit enter with nothing, it will default'
echo 'to 25 sessions at max.'
echo
read sessionCountLimit
echo
if [ "$sessionCountLimit" != "" ]; then
echo "Your max session limit is $sessionCountLimit."
else
sessionCountLimit=25
echo "Your max session limit is $sessionCountLimit."
fi
echo
echo '--------------------------------------------------------------------------------'
echo '--------------------------------------------------------------------------------'
echo
#
#
echo 'Please set server title.'
echo
echo 'If you just hit enter with nothing, it will default'
echo 'to: "Welcome to my Raspberry Pi Drawpile server!"'
echo 'Use double quotes when typing out your title.'
echo
read title
echo