-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
914 lines (856 loc) · 20.8 KB
/
install
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
#!/bin/bash
# Move to working dir
cd "$(readlink -f "$(dirname "$0")")"
# Infos
installerVersion="0.1.5"
while read line; do
if [[ $line == "globalvars.version="* ]]; then
iandiVersion="$(cut -d'"' -f 2 <<< $line)"
break
fi
done < iandi
# Check if zenity is usable
if command -v zenity &> /dev/null; then
if [ "$DISPLAY" != "" ]; then
canUseZenity=true
else
canUseZenity=false
fi
else
canUseZenity=false
fi
notify () {
if command -v notify-send &> /dev/null ;then
notify-send -t 2000 "Iandi installer" "$1" 2> /dev/null
elif $canUseZenity ;then
zenity --notification --window-icon="info" --text="$1" 2> /dev/null
fi
}
errorOut () {
if $canUseZenity ; then
zenity --error --title="Iandi installer" --text="$1" 2> /dev/null
else
echo "$1"
fi
}
if $canUseZenity ; then
zenity --info --title="Iandi installer" --text="Iandi $iandiVersion\nInstaller $installerVersion" 2> /dev/null
else
echo "Iandi $iandiVersion"
echo -e "Installer $installerVersion\n"
fi
# Check for permissions
if [[ $UID != 0 ]]; then
if $canUseZenity ;then
if zenity --question --title "Iandi installer" --text "You are not logged as root (sudo ./install).\nDo you want continue anyway?" 2> /dev/null ;then
continueAsNotRoot=true
else
continueAsNotRoot=false
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "$(readlink -f "$0")"
exit $?
fi
else
echo "You are not logged as root (sudo ./install)."
read -p "Do you want continue anyway? [y/N] " continueAsNotRoot
case $continueAsNotRoot in
[yY][eE][sS]|[yY])
echo "Yes."
continueAsNotRoot=true
;;
*)
echo "No."
continueAsNotRoot=false
;;
esac
fi
if ! $continueAsNotRoot ; then
exit 4
fi
fi
# Check if using sudo and getting real username
if [ -z ${SUDO_USER} ]; then
cuser=$USER
else
cuser=$SUDO_USER
fi
# Check args
yes2all=false
for arg in $@; do
case $arg in
-y|--yes) # skip all questions simply by answering with the default value
yes2all=true
;;
esac
done
# Get python version
if command -v python3 &> /dev/null; then
pythonV=3
elif command -v python &> /dev/null; then
pythonV=$(python -c 'import sys; print(sys.version_info[0])')
else
pythonV=3
fi
if $canUseZenity ; then
if zenity --question --title "Iandi installer" --text "Do you want use default options?" 2> /dev/null ; then
yes2all=true
else
yes2all=false
fi
fi
# Inputs
## package manager
while true
do
if $yes2all ; then
installDep=true
break
else
if $canUseZenity ; then
if zenity --question --title "Iandi installer" --text "Install dependencies?" 2> /dev/null ; then
installDep=true
else
installDep=false
fi
break
fi
read -p "Install dependencies? [Y/n] " installDep
case $installDep in
[nN][oO]|[nN])
echo "No."
installDep=false
break
;;
*)
echo "Yes."
installDep=true
break
;;
esac
fi
done
if $installDep ; then
# Get default package manager
if command -v apt &> /dev/null; then
pmDefault="apt"
elif command -v dnf &> /dev/null; then
pmDefault="dnf"
elif command -v yum &> /dev/null; then
pmDefault="yum"
elif command -v pacman &> /dev/null; then
pmDefault="pacman"
fi
while true
do
if $yes2all ; then
pm=$pmDefault
break
else
if $canUseZenity ; then
zenityInput=$(zenity --list --radiolist --title="Iandi installer" --column="" --column="Package manager" "TRUE" "apt" "FALSE" "dnf" "FALSE" "yum" "FALSE" "pacman" 2> /dev/null)
prgexitstatus=$?
if [ $prgexitstatus -eq 0 ] ; then
pm=$zenityInput
echo $pm
else
exit 5
fi
break
fi
read -p "Package manager: " pm
case $pm in
[aA][pP][tT])
pm="apt"
break
;;
[dD][nN][fF])
pm="dnf"
break
;;
[yY][uU][mM])
pm="yum"
break
;;
#[hH][oO][mM][eE][bB][rR][eE][wW]|[bB][rR][eE][wW])
# pm="homebrew"
# break
# ;;
[pP][aA][cC][mM][aA][nN])
pm="pacman"
break
;;
#[pP][oO][rR][tT][aA][gG][eE]|[eE][mM][eE][rR][gG][eE])
# pm="portage"
# break
# ;;
#[zZ][yY][pP][eE][rR])
# pm="zypper"
# break
# ;;
*)
echo "Package manager not supported."
echo "Use it manually out of installer."
exit 1
;;
esac
fi
done
echo "$pm."
fi
## precompiled snowboy
while true
do
if $yes2all ; then
installSb=true
break
else
if $canUseZenity ; then
if zenity --question --title "Iandi installer" --text "Install snowboy?" 2> /dev/null ; then
installSb=true
else
installSb=false
fi
break
fi
read -p "Install snowboy? [Y/n] " installSb
case $installSb in
[nN][oO]|[nN])
installSb=false
echo "No."
break
;;
*)
installSb=true
echo "Yes."
break
;;
esac
fi
done
## Procname
while true
do
if $yes2all ; then
compileProcname=true
break
else
if $canUseZenity ; then
if zenity --question --title "Iandi installer" --text "Compile procname?" 2> /dev/null ; then
compileProcname=true
else
compileProcname=false
fi
break
fi
read -p "Compile procname? [Y/n] " compileProcname
case $compileProcname in
[nN][oO]|[nN])
echo "No."
compileProcname=false
break
;;
*)
echo "Yes."
compileProcname=true
break
;;
esac
fi
done
## Terminal Virtual Face
while true
do
if $yes2all ; then
getTermVFace=true
break
else
if $canUseZenity ; then
if zenity --question --title "Iandi installer" --text "Get Terminal Virtual Face?" 2> /dev/null ; then
getTermVFace=true
else
getTermVFace=false
fi
break
fi
read -p "Get Terminal Virtual Face? [Y/n] " getTermVFace
case $getTermVFace in
[nN][oO]|[nN])
echo "No."
getTermVFace=false
break
;;
*)
echo "Yes."
getTermVFace=true
break
;;
esac
fi
done
## Tdlib
while true
do
if $yes2all ; then
installTdl=true
break
else
if $canUseZenity ; then
if zenity --question --title "Iandi installer" --text "Install tdlib?" 2> /dev/null ; then
installTdl=true
else
installTdl=false
fi
break
fi
read -p "Install tdlib? [Y/n] " installTdl
case $installTdl in
[nN][oO]|[nN])
echo "No."
installTdl=false
break
;;
*)
echo "Yes."
installTdl=true
break
;;
esac
fi
done
## Brain mime type
while true
do
if $yes2all ; then
installBrnMime=true
break
else
if $canUseZenity ; then
if zenity --question --title "Iandi installer" --text "Install brain MIME type?" 2> /dev/null ; then
installBrnMime=true
else
installBrnMime=false
fi
break
fi
read -p "Install brain MIME type? [Y/n] " installBrnMime
case $installBrnMime in
[nN][oO]|[nN])
echo "No."
installBrnMime=false
break
;;
*)
echo "Yes."
installBrnMime=true
break
;;
esac
fi
done
## Install Iandi on system
while true
do
if $yes2all ; then
installOnSys=true
break
else
if $canUseZenity ; then
if zenity --question --title "Iandi installer" --text "Install Iandi on system?" 2> /dev/null ; then
installOnSys=true
else
installOnSys=false
fi
break
fi
read -p "Install Iandi on system? [Y/n] " installOnSys
case $installOnSys in
[nN][oO]|[nN])
echo "No."
installOnSys=false
break
;;
*)
echo "Yes."
installOnSys=true
break
;;
esac
fi
done
if $installOnSys ; then
installOnSysBinDefaultPath="/usr/local/bin/"
if $yes2all ; then
installOnSysBinPath=$installOnSysBinDefaultPath
else
if $canUseZenity ; then
zenityInput=$(zenity --title "Iandi installer" --entry --text "Executable path:" --entry-text="$installOnSysBinDefaultPath" 2> /dev/null)
prgexitstatus=$?
if [ $prgexitstatus -eq 0 ] ; then
installOnSysBinPath=$zenityInput
else
exit 5
fi
else
read -p "Executable path: [$installOnSysBinDefaultPath] " installOnSysBinPath
if [ "$installOnSysBinPath" == "" ] ; then
installOnSysBinPath=$installOnSysBinDefaultPath
fi
fi
fi
if [ "$cuser" == "root" ]; then
cuserPath=$HOME
else
cuserPath="/home/$cuser"
fi
installOnSysDefaultPath="$cuserPath/.iandi/"
if $yes2all ; then
installOnSysPath=$installOnSysDefaultPath
else
if $canUseZenity ; then
zenityInput=$(zenity --title "Iandi installer" --entry --text "Resources path:" --entry-text="$installOnSysDefaultPath" 2> /dev/null)
prgexitstatus=$?
if [ $prgexitstatus -eq 0 ] ; then
installOnSysPath=$zenityInput
else
exit 5
fi
else
read -p "Resources path: [$installOnSysDefaultPath] " installOnSysPath
if [ "$installOnSysPath" == "" ] ; then
installOnSysPath=$installOnSysDefaultPath
fi
fi
fi
fi
if $installOnSys ; then
if $yes2all ; then
autostartIandi=true
else
if $canUseZenity ; then
if zenity --question --title "Iandi installer" --text "Autostart Iandi on login?" 2> /dev/null ; then
autostartIandi=true
else
autostartIandi=false
fi
else
read -p "Autostart Iandi on login? [Y/n] " autostartIandi
case $autostartIandi in
[nN][oO]|[nN])
echo "No."
autostartIandi=false
;;
*)
echo "Yes."
autostartIandi=true
;;
esac
fi
fi
fi
#zenity --title="Iandi installer" --progress --text="Iandi installation in progress..." --percentage=0 --auto-close 2> /dev/null
if $canUseZenity ; then
notify "Iandi installation in progress..."
else
echo "[ Ok ] Now you can go afk."
fi
# Checking ram info
ram=$(grep -i memtotal /proc/meminfo)
IFS=" "
read -raramarray<<<"$ram"
ram=$((${ramarray[1]}/1024/1024))
if [ $(($ram < 3)) ]; then
dosplit=true
else
dosplit=false
fi
# Dependencies
if $installDep ; then
case $pm in
apt)
apt-get -y install python"$pythonV"-pip python-dev python"$pythonV"-gi python-setuptools git portaudio19-dev libpulse-dev libespeak-dev libatlas-base-dev vlc ffmpeg make zlib1g-dev libssl-dev gperf cmake clang libc++-dev libc++abi-dev swig
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "apt failed with exit code $prgexitstatus."
exit 3
fi
if $dosplit; then
apt-get -y install php-cli
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "apt failed with exit code $prgexitstatus."
exit 3
fi
fi
;;
dnf|yum)
$pm -y --setopt=strict=no install python-pip python-devel python2-devel python-setuptools git portaudio-devel pulseaudio-libs-devel libespeak-dev atlas-sse2-static atlas-devel vlc ffmpeg make zlib-devel openssl-devel gperf gcc-c++ cmake clang libcxx libcxxabi swig redhat-rpm-config
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "$pm failed with exit code $prgexitstatus."
exit 3
fi
if $dosplit; then
$pm -y --setopt=strict=no install php
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "$pm failed with exit code $prgexitstatus."
exit 3
fi
fi
#wget -O blas-3.9.0-5.rpm https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/33/Everything/x86_64/os/Packages/b/blas-3.9.0-5.fc33.i686.rpm
;;
homebrew)
brew install python python-setuptools git portaudio pulseaudio libespeak-dev vlc ffmpeg make zlib openssl gperf cmake swig
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "homebrew failed with exit code $prgexitstatus."
exit 3
fi
if $dosplit; then
brew install php
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "homebrew failed with exit code $prgexitstatus."
exit 3
fi
fi
;;
pacman)
pacman --noconfirm -S python"$pythonV"-pip python-dev python-setuptools git portaudio19-dev libpulse-dev libespeak-dev libatlas-base-dev vlc ffmpeg make zlib1g-dev libssl-dev gperf cmake clang libc++-dev libc++abi-dev swig
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "pacman failed with exit code $prgexitstatus."
exit 3
fi
if $dosplit; then
pacman --noconfirm -S php-cli
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "pacman failed with exit code $prgexitstatus."
exit 3
fi
fi
;;
portage)
emerge python"$pythonV"-pip python-dev python-setuptools git portaudio19-dev libpulse-dev libespeak-dev libatlas-base-dev vlc ffmpeg make zlib1g-dev libssl-dev gperf cmake clang libc++-dev libc++abi-dev swig
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "emerge failed with exit code $prgexitstatus."
exit 3
fi
if $dosplit; then
emerge php-cli
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "emerge failed with exit code $prgexitstatus."
exit 3
fi
fi
;;
*)
errorOut "Unexpected error in dependencies block."
exit 2
;;
esac
if command -v pip3 &> /dev/null; then
pipcmd="pip3"
elif command -v pip &> /dev/null; then
pipcmd="pip"
elif command -v pip2 &> /dev/null; then
pipcmd="pip2"
elif command -v python3 &> /dev/null; then
pipcmd="python3 -m pip"
else
pipcmd="python -m pip"
fi
#$pipcmd install --no-input setuptools pyaudio playsound pyttsx3 speechrecognition pocketsphinx pyalsaaudio python-vlc==3.0.11115 youtube-dl
$pipcmd install --no-input -r requirements.txt
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "$pipcmd failed with exit code $prgexitstatus."
exit 3
fi
if $canUseZenity ; then
notify "Iandi dependencies installed."
else
echo "[ Ok ] Dependencies installed."
fi
fi
# Snowboy
## https://github.com/seasalt-ai/snowboy
if $installSb; then
git clone https://github.com/seasalt-ai/snowboy
cd snowboy/swig/Python/
make
cd ../Python3/
sed -i "s/SNOWBOYDETECTSWIGLIBFILE = _snowboydetect.so/SNOWBOYDETECTSWIGLIBFILE = _snowboydetect_py3.so/" Makefile
sed -i "s/%module snowboydetect/%module snowboydetect_py3/" snowboy-detect-swig.i
make
cd ../../../
cp snowboy/resources/common.res resources/
chown -R $cuser:$cuser resources/common.res
cp snowboy/swig/Python/_snowboydetect.so .
chown -R $cuser:$cuser _snowboydetect.so
cp snowboy/swig/Python3/_snowboydetect_py3.so .
chown -R $cuser:$cuser _snowboydetect_py3.so
rm -rf snowboy/
if $canUseZenity ; then
notify "Snowboy installed."
else
echo "[ Ok ] Snowboy installed."
fi
fi
# Procname
if $compileProcname; then
cd procname-0.2/
make build
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "make failed with exit code $prgexitstatus while compiling procname."
exit 3
fi
mv procname.so ../
cd ../
if $canUseZenity ; then
notify "Procname compiled."
else
echo "[ Ok ] Procname compiled."
fi
fi
# Terminal Virtual Face
## https://github.com/Bytezz/VirtualFace
if $getTermVFace; then
rawFileUrl="https://raw.githubusercontent.com/Bytezz/VirtualFace/master/terminal_virtualface.py"
# search an installed program to download the raw file
if command -v curl &> /dev/null; then # verify if curl is installed, if true use it to download
curl -o terminal_virtualface.py $rawFileUrl
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "curl failed with exit code $prgexitstatus while downloading Terminal Virtual Face."
exit 3
fi
elif command -v wget &> /dev/null; then
wget -O terminal_virtualface.py $rawFileUrl
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "wget failed with exit code $prgexitstatus while downloading Terminal Virtual Face."
exit 3
fi
else
GET $rawFileUrl > terminal_virtualface.py
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "GET failed with exit code $prgexitstatus while downloading Terminal Virtual Face."
exit 3
fi
fi
if $canUseZenity ; then
notify "Terminal Virtual Face downloaded."
else
echo "[ Ok ] Terminal Virtual Face downloaded."
fi
fi
# Tdlib
if $installTdl; then
rm -rf td/
git clone https://github.com/tdlib/td.git
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "git failed with exit code $prgexitstatus."
exit 3
fi
cd td
rm -rf build/
mkdir build/
cd build/
if [ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]; then
CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ..
else
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ..
fi
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "cmake failed with exit code $prgexitstatus."
exit 3
fi
if $dosplit; then
cmake --build . --target prepare_cross_compiling
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "cmake failed with exit code $prgexitstatus."
exit 3
fi
cd ..
php SplitSource.php
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "php failed with exit code $prgexitstatus."
exit 3
fi
cd build/
fi
cmake --build . --target install
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "cmake failed with exit code $prgexitstatus."
exit 3
fi
if $dosplit; then
cd ..
php SplitSource.php --undo
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "php failed with exit code $prgexitstatus."
exit 3
fi
cd ..
else
cd ../../
fi
if $canUseZenity ; then
notify "Tdlib installed."
else
echo "[ Ok ] Tdlib installed."
fi
fi
# Brain mime type
if $installBrnMime; then
# Adding mime
xdg-mime install resources/mime/sobot-brain.xml
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "xdg-mime failed with exit code $prgexitstatus."
exit 3
fi
# Pairing 48 icon to mime
xdg-icon-resource install --context mimetypes --size 48 resources/mime/brain-file-icon-48.png text-brain
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "xdg-icon-resource failed with exit code $prgexitstatus."
exit 3
fi
# Pairing 256 icon to mime
xdg-icon-resource install --context mimetypes --size 256 resources/mime/brain-file-icon-256.png text-brain
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "xdg-icon-resource failed with exit code $prgexitstatus."
exit 3
fi
fi
# Install Iandi on system
if $installOnSys; then
mkdir -p "$installOnSysBinPath"
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "mkdir failed with exit code $prgexitstatus."
exit 3
fi
cp iandi "$installOnSysBinPath"
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "cp failed with exit code $prgexitstatus."
exit 3
fi
chmod +x "$installOnSysBinPath"/iandi
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "chmod failed with exit code $prgexitstatus."
exit 3
fi
#
mkdir -p "$installOnSysPath"
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "mkdir failed with exit code $prgexitstatus."
exit 3
fi
rsync -av --exclude=iandi ./* "$installOnSysPath"
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "cp failed with exit code $prgexitstatus."
exit 3
fi
if [ "$installOnSysPath" == "$cuserPath/.iandi/" ]; then
chown -R $cuser:$cuser "$installOnSysPath"
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "chown failed with exit code $prgexitstatus."
exit 3
fi
fi
#
mkdir -p /usr/share/applications/
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "mkdir failed with exit code $prgexitstatus."
exit 3
fi
cp -r resources/launcher/iandi.desktop /usr/share/applications/
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "cp failed with exit code $prgexitstatus."
exit 3
fi
chmod +x /usr/share/applications/iandi.desktop
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "chmod failed with exit code $prgexitstatus."
exit 3
fi
mkdir -p /usr/share/icons/
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "mkdir failed with exit code $prgexitstatus."
exit 3
fi
cp -r resources/icons/icon-round2.png /usr/share/icons/iandi.png
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "cp failed with exit code $prgexitstatus."
exit 3
fi
#
if $autostartIandi; then
if [ "$installOnSysPath" == "$cuserPath/.iandi/" ]; then
autostartPath="$cuserPath/.config/autostart/"
else
autostartPath="$HOME/.config/autostart/"
fi
mkdir -p "$autostartPath"
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "mkdir failed with exit code $prgexitstatus."
exit 3
fi
chown -R $cuser:$cuser "$autostartPath"
if [ $prgexitstatus -ne 0 ] ; then
errorOut "chown failed with exit code $prgexitstatus."
exit 3
fi
cp -r resources/launcher/iandi.desktop "$autostartPath"
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "cp failed with exit code $prgexitstatus."
exit 3
fi
if [ "$installOnSysPath" == "$cuserPath/.iandi/" ]; then
chown -R $cuser:$cuser "$autostartPath/iandi.desktop"
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "chown failed with exit code $prgexitstatus."
exit 3
fi
fi
chmod +x "$autostartPath/iandi.desktop"
prgexitstatus=$?
if [ $prgexitstatus -ne 0 ] ; then
errorOut "chmod failed with exit code $prgexitstatus."
exit 3
fi
fi
fi
if $canUseZenity ; then
zenity --info --title="Iandi installer" --text="Iandi installation completed." 2> /dev/null
else
echo "[Done] Installation completed."
fi
exit 0