forked from NelloKudo/osu-winello
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosu-winello.sh
executable file
·1357 lines (1009 loc) · 62.6 KB
/
osu-winello.sh
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
#Variables
WINEVERSION=7.16.0
LASTWINEVERSION=0
CURRENTGLIBC="$(ldd --version | tac | tail -n1 | awk '{print $(NF)}')"
MINGLIBC=2.27
WINELINK="https://github.com/NelloKudo/WineBuilder/releases/download/wine-osu-stable-7.16/wine-osu-7.16-x86_64.tar.xz"
WINEBACKUPLINK="https://www.dropbox.com/s/p7stmsx0zd2rn7o/wine-osu-7.16-x86_64.tar.xz?dl=0"
Info()
{
echo -e '\033[1;34m'"Winello:\033[0m $*";
}
Revert()
{
echo -e '\033[1;31m'"Reverting install...:\033[0m"
rm -f "$HOME/.local/share/icons/osu-wine.png"
rm -f "$HOME/.local/share/applications/osu-wine.desktop"
rm -f "$HOME/.local/bin/osu-wine"
rm -rf "$HOME/.local/share/osuconfig"
rm -f "/tmp/wine-osu-${WINEVERSION}-x86_64.pkg.tar.xz"
rm -f "/tmp/osu-mime.tar.xz"
rm -rf "/tmp/osu-mime"
rm -f "$HOME/.local/share/mime/packages/osuwinello-file-extensions.xml"
rm -f "$HOME/.local/share/applications/osuwinello-file-extensions-handler.desktop"
rm -f "$HOME/.local/share/applications/osuwinello-url-handler.desktop"
rm -rf "/tmp/tempfonts"
rm -f "/tmp/winestreamproxy-2.0.3-amd64.tar.xz"
rm -rf "/tmp/winestreamproxy"
echo -e '\033[1;31m'"Reverting done, try again with ./osu-winello.sh\033[0m"
if [ "$osid" == "debian" ]; then
"$root_var" mv /etc/apt/sources.list.bak /etc/apt/sources.list ; fi
}
Error()
{
echo -e '\033[1;31m'"Script failed:\033[0m $*"; Revert ; exit 1;
}
Install()
{
if [ "$USER" = "root" ] ; then Error "Please run the script without root" ; fi
Info "Welcome to the script! Follow it to install osu! 8)"
if [ -e /usr/bin/osu-wine ] ; then Error "Please uninstall old osu-wine (/usr/bin/osu-wine) before installing!" ; fi #Checking DiamondBurned's osu-wine
if [ -e "$HOME/.local/bin/osu-wine" ] ; then Error "Please uninstall osu-wine before installing!" ; fi
#/.local/bin check
mkdir -p "$HOME/.local/bin"
if (grep -q "bash" "$SHELL" || [[ -f "$HOME/.bashrc" ]]) && ! grep -q "PATH="$HOME/.local/bin/:$PATH"" "$HOME/.bashrc"; then
echo 'export PATH="$HOME/.local/bin/:$PATH"' >> "$HOME/.bashrc"
source "$HOME/.bashrc"
fi
if (grep -q "zsh" "$SHELL" || [[ -f "$HOME/.zshrc" ]]) && ! grep -q "PATH="$HOME/.local/bin/:$PATH"" "$HOME/.zshrc"; then
echo 'export PATH="$HOME/.local/bin/:$PATH"' >> "$HOME/.zshrc"
source "$HOME/.zshrc"
fi
if [[ -f "$HOME/.config/fish/config.fish" ]] && ! grep -q "PATH="$HOME/.local/bin/:$PATH"" "$HOME/.config/fish/config.fish"; then
echo 'export PATH="$HOME/.local/bin/:$PATH"' >> "$HOME/.config/fish/config.fish"
source "$HOME/.config/fish/config.fish"
fi
# Checking for 'sudo' or 'doas'
if command -v doas >/dev/null 2>&1 ; then
doascheck=$(doas id -u)
if [ "$doascheck" = "0" ] ; then
root_var="doas"
else
root_var="sudo" ; fi
else
root_var="sudo"
fi
Info "Checking for internet connection.."
! ping -c 1 1.1.1.1 >/dev/null 2>&1 && Error "Please connect to internet before continuing xd. Run the script again"
Info "Dependencies time.."
if command -v apt >/dev/null 2>&1 ; then
if ! ( command -v dnf >/dev/null 2>&1 || command -v emerge >/dev/null 2>&1 ) ; then
Info "Debian/Ubuntu detected, installing dependencies..."
Info "Please enter your password when asked"
Info "------------------------------------"
osid=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
if [ "$osid" == "debian" ] ; then
Info "Installing needed packages for dependencies.."
"$root_var" apt update && "$root_var" apt install -y software-properties-common
nonfreestatus="true"
"$root_var" dpkg --add-architecture i386
"$root_var" apt install -y steam || nonfreestatus="false"
if [ "$nonfreestatus" == "false" ]; then
Info "Looks like non-free repositories are not enabled on your system"
Info "Those are needed in order to install libraries to play osu! properly."
read -r -p "$(Info "Do you want to enable non-free repositories? (Y/N): ")" nonfreechoice
if [ "$nonfreechoice" == 'Y' ] || [ "$nonfreechoice" == 'y' ]; then
# Now checking for all lines supposed to be there, according to https://wiki.debian.org/Steam:
# Remember that Steam is necessary for apt to pull libGL and other libraries.
if grep "deb http://deb.debian.org/debian/ bullseye main contrib" /etc/apt/sources.list || grep "deb http://deb.debian.org/debian bullseye main contrib" /etc/apt/sources.list || grep "deb http://deb.debian.org/debian/ bullseye main" /etc/apt/sources.list; then
grepline=$(echo "$(grep -n -o '[0-9]*'"deb http://deb.debian.org/debian bullseye main contrib" /etc/apt/sources.list)" | cut -c1-3)
if [ "$grepline" == "" ]; then grepline=$(echo "$(grep -n -o '[0-9]*'"deb http://deb.debian.org/debian/ bullseye main contrib" /etc/apt/sources.list)" | cut -c1-3) ; fi
if [ "$grepline" == "" ]; then grepline=$(echo "$(grep -n -o '[0-9]*'"deb http://deb.debian.org/debian/ bullseye main" /etc/apt/sources.list)" | cut -c1-3) ; fi
linenumber=$(echo $grepline | grep -o '[0-9]*')
# Additional check to make sure sed doesn't really replace everything if non-free is already found for some reason
if ! grep "deb http://deb.debian.org/debian/ bullseye main contrib non-free" /etc/apt/sources.list || ! grep "deb http://deb.debian.org/debian bullseye main contrib non-free" /etc/apt/sources.list || ! grep "deb http://deb.debian.org/debian/ bullseye main non-free" /etc/apt/sources.list ; then
"$root_var" sh -c "sed -i.bak '${linenumber}s/$/ non-free/' /etc/apt/sources.list" && Info "non-free added successfully." ; fi
else
"$root_var" sh -c 'echo "deb http://deb.debian.org/debian bullseye main non-free" >> /etc/apt/sources.list'
fi
else
Error "non-free repositories are needed for the script to work properly. Closing the script.." ; fi
fi
Info "Installing packages and wine-staging dependencies.."
"$root_var" mkdir -pm755 /etc/apt/keyrings
"$root_var" wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
"$root_var" wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/bullseye/winehq-bullseye.sources
"$root_var" apt update
"$root_var" apt install -y --install-recommends winehq-staging || Error "Some libraries didn't install for some reason, check apt or your connection"
"$root_var" apt install -y git curl steam build-essential zstd p7zip-full zenity || Error "Some libraries didn't install for some reason, check apt or your connection"
else
Info "Installing packages and wine-staging dependencies.."
"$root_var" apt update && "$root_var" apt upgrade -y
"$root_var" dpkg --add-architecture i386
wget -nc https://dl.winehq.org/wine-builds/winehq.key
"$root_var" apt-key add winehq.key
"$root_var" apt-add-repository -y 'https://dl.winehq.org/wine-builds/ubuntu/'
"$root_var" apt update
"$root_var" apt install -y --install-recommends winehq-staging || Error "Some libraries didn't install for some reason, check apt or your connection"
"$root_var" apt install -y git curl steam build-essential zstd p7zip-full zenity || Error "Some libraries didn't install for some reason, check apt or your connection"
Info "Dependencies done, skipping.."
fi
fi
fi
if command -v emerge >/dev/null 2>&1 ; then
Info "Gentoo detected, installing dependencies..."
Info "Please enter your password when asked"
Info "------------------------------------"
"$root_var" mkdir -p /etc/portage/sets
Info "Creating @osu-winello package set.."
printf "dev-vcs/git\napp-arch/zstd\napp-arch/p7zip\nnet-misc/wget\ngnome-extra/zenity\nvirtual/wine\napp-emulation/winetricks\n" | "$root_var" tee /etc/portage/sets/osu-winello
Info "Adding required USE flags.."
printf "media-libs/libsdl2 haptic\n" | "$root_var" tee /etc/portage/package.use/osu-winello
if ! grep -q '@osu-winello' /var/lib/portage/world_sets; then
if ! emerge --info | grep -q 'ABI_X86="64 32"' && ! emerge --info | grep -q 'ABI_X86="32 64"'; then
Info "Error: Unsupported configuration."
Info "Enable abi_x86_32 globally *or* manually emerge the @osu-winello set."
Info
Info 'To enable it globally, set ABI_X86="64 32" in /etc/portage/make.conf and run "emerge --newuse @world".'
Error "Cannot continue, there *will* be circular dependencies to resolve!"
fi
fi
"$root_var" emerge --noreplace @osu-winello || Error "Some libraries didn't install for some reason, check portage or your connection"
Info "Dependencies done, skipping.."
fi
if command -v pacman >/dev/null 2>&1 ; then
Info "Arch Linux/SteamOS detected, installing dependencies..."
Info "Please enter your password when asked"
Info "------------------------------------"
osid=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
if [ "$osid" != "steamos" ] ; then
if ! grep -q -E '^\[multilib\]' '/etc/pacman.conf'; then
Info "Enabling multilib.."
printf "\n# Multilib repo enabled by osu-winello\n[multilib]\nInclude = /etc/pacman.d/mirrorlist\n" | "$root_var" tee -a /etc/pacman.conf
fi
Info "Installing packages and wine-staging dependencies.."
if command -v wine >/dev/null 2>&1 ; then
Info "Wine (possibly) already found, removing it to replace with staging.."
"$root_var" pacman -Rdd --noconfirm wine || Info "Looks like staging is already installed"
fi
"$root_var" pacman -Sy --noconfirm --needed git base-devel p7zip wget zenity wine-staging winetricks giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo libxcomposite lib32-libxcomposite libxinerama lib32-libxinerama ncurses lib32-ncurses opencl-icd-loader lib32-opencl-icd-loader libxslt lib32-libxslt libva lib32-libva gtk3 lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader cups samba dosbox || Error "Some libraries didn't install for some reason, check pacman or your connection"
Info "Dependencies done, skipping.."
else
deck_fs_check=$("$root_var" [ -w /usr ] && echo "rw" || echo "ro")
if [ "$deck_fs_check" = "ro" ]; then
Error "The Steam Deck's file system is in read-only mode, preventing further action. To continue, you must disable read-only mode. More information can be found on GitHub: https://github.com/NelloKudo/osu-winello#steam-deck-support"
else
"$root_var" pacman --needed -Sy libxcomposite lib32-libxcomposite gnutls lib32-gnutls wine winetricks || Error "Check your connection"
fi
fi
fi
if command -v dnf >/dev/null 2>&1 ; then
Info "Fedora/Nobara detected, installing dependencies..."
Info "Please enter your password when asked"
Info "------------------------------------"
Info "Installing packages and wine-staging dependencies.."
"$root_var" dnf install -y git zstd p7zip p7zip-plugins wget zenity || Error "Some libraries didn't install for some reason, check dnf or your connection"
osid=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
if [ "$osid" != "nobara" ] ; then
"$root_var" dnf install -y winetricks || Error "Some libraries didn't install for some reason, check dnf or your connection"
"$root_var" dnf install -y wine || Error "Some libraries didn't install for some reason, check dnf or your connection"
fi
Info "Dependencies done, skipping.."
fi
if command -v zypper >/dev/null 2>&1 ; then
Info "openSUSE detected, installing dependencies..."
Info "Please enter your password when asked"
Info "------------------------------------"
Info "Installing packages and wine-staging dependencies.."
"$root_var" zypper install -y git zstd 7zip wget zenity || Error "Some libraries didn't install for some reason, check zypper or your connection"
"$root_var" zypper install -y winetricks || Error "Some libraries didn't install for some reason, check zypper or your connection"
"$root_var" zypper install -y wine || Error "Some libraries didn't install for some reason, check zypper or your connection"
Info "Dependencies done, skipping.."
fi
Info "Installing game script:"
cp ./osu-wine "$HOME/.local/bin/osu-wine" && chmod 755 "$HOME/.local/bin/osu-wine"
Info "Installing icons:"
mkdir -p "$HOME/.local/share/icons"
cp "./stuff/osu-wine.png" "$HOME/.local/share/icons/osu-wine.png" && chmod 644 "$HOME/.local/share/icons/osu-wine.png"
Info "Installing .desktop:"
mkdir -p "$HOME/.local/share/applications"
echo "[Desktop Entry]
Name=osu!
Comment=osu! - Rhythm is just a *click* away!
Type=Application
Exec=/home/$USER/.local/bin/osu-wine %U
Icon=/home/$USER/.local/share/icons/osu-wine.png
Terminal=false
Categories=Wine;Game;" >> "$HOME/.local/share/applications/osu-wine.desktop"
chmod +x "$HOME/.local/share/applications/osu-wine.desktop"
Info "Installing wine-osu:"
if [ "$CURRENTGLIBC" \< "$MINGLIBC" ]; then
Info "Seems like your distro is too old and well, not supported by this wine build.."
Info "Do you want to use your system's Wine and continue the install? (assuming you have that)"
read -r -p "$(Info "Choose your option (Y/N):")" winechoice
if [ "$winechoice" = 'y' ] || [ "$winechoice" = 'Y' ]; then
mkdir -p "$HOME/.local/share/osuconfig/wine-osu"
ln -sf "/usr/bin" "$HOME/.local/share/osuconfig/wine-osu/bin"
else
Error "Exiting.."
fi
else
# Checking which link to use to download wine-osu
if wget --spider "$WINELINK" 2>/dev/null; then
Info "Wine link is working, skipping.."
else
Info "Wine download link seems to be down; using backup.."
WINELINK="$WINEBACKUPLINK"
fi
wget -O "/tmp/wine-osu-${WINEVERSION}-x86_64.pkg.tar.xz" "$WINELINK" && wgetcheck1="$?"
if [ ! "$wgetcheck1" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "/tmp/wine-osu-${WINEVERSION}-x86_64.pkg.tar.xz" "$WINELINK" || Error "Download failed, check your connection"
fi
tar -xf "/tmp/wine-osu-${WINEVERSION}-x86_64.pkg.tar.xz" -C "$HOME/.local/share/"
LASTWINEVERSION="$WINEVERSION"
if [ -d "$HOME/.local/share/osuconfig" ]; then
Info "Skipping osuconfig.."
else
mkdir "$HOME/.local/share/osuconfig"
fi
mv "$HOME/.local/share/wine-osu" "$HOME/.local/share/osuconfig"
rm -f "/tmp/wine-osu-${WINEVERSION}-x86_64.pkg.tar.xz"
Info "Installing script copy for updates.."
mkdir -p "$HOME/.local/share/osuconfig/update"
git clone https://github.com/NelloKudo/osu-winello.git "$HOME/.local/share/osuconfig/update" || Error "Git failed, check your connection.."
echo "$LASTWINEVERSION" >> "$HOME/.local/share/osuconfig/wineverupdate"
fi
if [ -d "$HOME/.local/share/lutris" ]; then
Info "Lutris was found, do you want to copy wine-osu there? (y/n)"
read -r -p "$(Info "Choose your option: ")" lutrischoice
if [ "$lutrischoice" = 'y' ] || [ "$lutrischoice" = 'Y' ]; then
mkdir -p "$HOME/.local/share/lutris/runners/wine"
if [ -d "$HOME/.local/share/lutris/runners/wine/wine-osu" ]; then
Info "wine-osu is already installed in Lutris, skipping..."
else
cp -r "$HOME/.local/share/osuconfig/wine-osu" "$HOME/.local/share/lutris/runners/wine" ; fi
if [ -d "$HOME/.var/app/net.lutris.Lutris/data/lutris" ]; then
mkdir -p "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine"
if [ -d "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu" ]; then
Info "wine-osu is already installed in Flatpak Lutris, skipping..."
else
cp -r "$HOME/.local/share/osuconfig/wine-osu" "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine" ; fi
fi
else
Info "Skipping.."; fi
fi
if [ -d "$HOME/.var/app/net.lutris.Lutris/data/lutris" ] && [ ! -d "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu" ]; then
Info "Flatpak Lutris was found, do you want to copy wine-osu there? (y/n)"
read -r -p "$(Info "Choose your option: ")" lutrischoice2
if [ "$lutrischoice2" = 'y' ] || [ "$lutrischoice2" = 'Y' ]; then
mkdir -p "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine"
if [ -d "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu" ]; then
Info "wine-osu is already installed in Flatpak Lutris, skipping..."
else
cp -r "$HOME/.local/share/osuconfig/wine-osu" "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine" ; fi
fi
else
Info "Skipping.."; fi
Info "Configuring osu! folder:"
Info "Where do you want to install the game?:
1 - Default path (~/.local/share/osu-wine)
2 - Custom path"
read -r -p "$(Info "Choose your option: ")" installpath
if [ "$installpath" = 1 ] || [ "$installpath" = 2 ] ; then
case "$installpath" in
'1')
if [ -d "$HOME/.local/share/osu-wine" ]; then
Info "osu-wine folder already exists: skipping.."
else
mkdir "$HOME/.local/share/osu-wine"
fi
GAMEDIR="$HOME/.local/share/osu-wine"
if [ -d "$GAMEDIR/OSU" ] || [ -d "$GAMEDIR/osu!" ]; then
Info "osu! folder already exists: skipping.."
if [ -d "$GAMEDIR/OSU" ]; then
OSUPATH="$GAMEDIR/OSU"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath" ; fi
if [ -d "$GAMEDIR/osu!" ]; then
OSUPATH="$GAMEDIR/osu!"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath" ; fi
else
mkdir "$GAMEDIR/osu!"
export OSUPATH="$GAMEDIR/osu!"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath"
fi
;;
'2')
Info "Choose your directory: "
GAMEDIR="$(zenity --file-selection --directory)"
if [ -d "$GAMEDIR/osu!" ] || [ -e "$GAMEDIR/osu!.exe" ]; then
Info "osu! folder/game already exists: skipping.."
if [ -d "$GAMEDIR/osu!" ]; then
OSUPATH="$GAMEDIR/osu!"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath" ; fi
if [ -e "$GAMEDIR/osu!.exe" ]; then
OSUPATH="$GAMEDIR"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath" ; fi
else
mkdir "$GAMEDIR/osu!"
OSUPATH="$GAMEDIR/osu!"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath"
fi
;;
esac
else
Info "No option chosen, installing to default.. (~/.local/share/osu-wine)"
if [ -d "$HOME/.local/share/osu-wine" ]; then
Info "osu-wine folder already exists: skipping.."
else
mkdir "$HOME/.local/share/osu-wine"
fi
GAMEDIR="$HOME/.local/share/osu-wine"
if [ -d "$GAMEDIR/OSU" ] || [ -d "$GAMEDIR/osu!" ]; then
Info "osu! folder already exists: skipping.."
if [ -d "$GAMEDIR/OSU" ]; then
OSUPATH="$GAMEDIR/OSU"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath" ; fi
if [ -d "$GAMEDIR/osu!" ]; then
OSUPATH="$GAMEDIR/osu!"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath" ; fi
else
mkdir "$GAMEDIR/osu!"
export OSUPATH="$GAMEDIR/osu!"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath"
fi
fi
Info "Configuring osu-mime and osu-handler:"
# Installing osu-mime from https://aur.archlinux.org/packages/osu-mime
wget -O "/tmp/osu-mime.tar.gz" "https://aur.archlinux.org/cgit/aur.git/snapshot/osu-mime.tar.gz" && wgetcheck3="$?"
if [ ! "$wgetcheck3" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "/tmp/osu-mime.tar.gz" "https://aur.archlinux.org/cgit/aur.git/snapshot/osu-mime.tar.gz" || Error "Download failed, check your connection or open an issue here: https://github.com/NelloKudo/osu-winello/issues"; fi
tar -xf "/tmp/osu-mime.tar.gz" -C "/tmp"
mkdir -p "$HOME/.local/share/mime"
mkdir -p "$HOME/.local/share/mime/packages"
cp "/tmp/osu-mime/osu-file-extensions.xml" "$HOME/.local/share/mime/packages/osuwinello-file-extensions.xml"
update-mime-database "$HOME/.local/share/mime"
rm -f "/tmp/osu-mime.tar.gz"
rm -rf "/tmp/osu-mime"
# Installing osu-handler from https://github.com/openglfreak/osu-handler-wine / https://aur.archlinux.org/packages/osu-handler
# Binary was compiled from source on Ubuntu 18.04
wget -O "$HOME/.local/share/osuconfig/osu-handler-wine" "https://github.com/NelloKudo/osu-winello/raw/main/stuff/osu-handler-wine" && wgetcheck4="$?"
if [ ! "$wgetcheck4" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "$HOME/.local/share/osuconfig/osu-handler-wine" "https://github.com/NelloKudo/osu-winello/raw/main/stuff/osu-handler-wine" || Error "Download failed, check your connection or open an issue here: https://github.com/NelloKudo/osu-winello/issues" ; fi
chmod +x "$HOME/.local/share/osuconfig/osu-handler-wine"
# Installing Winetricks from upstream
wget -O "$HOME/.local/share/osuconfig/winetricks" "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks" && wgetcheck41="$?"
if [ ! "$wgetcheck41" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "$HOME/.local/share/osuconfig/winetricks" "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks" || Error "Download failed, check your connection or open an issue here: https://github.com/NelloKudo/osu-winello/issues" ; fi
chmod +x "$HOME/.local/share/osuconfig/winetricks"
# Creating entries..
echo "[Desktop Entry]
Type=Application
Name=osu!
MimeType=application/x-osu-skin-archive;application/x-osu-replay;application/x-osu-beatmap-archive;
Exec=/home/$USER/.local/share/osuconfig/osu-handler-wine %f
NoDisplay=true
StartupNotify=true
Icon=/home/$USER/.local/share/icons/osu-wine.png" >> "$HOME/.local/share/applications/osuwinello-file-extensions-handler.desktop"
chmod +x "$HOME/.local/share/applications/osuwinello-file-extensions-handler.desktop"
echo "[Desktop Entry]
Type=Application
Name=osu!
MimeType=x-scheme-handler/osu;
Exec=/home/$USER/.local/share/osuconfig/osu-handler-wine %u
NoDisplay=true
StartupNotify=true
Icon=/home/$USER/.local/share/icons/osu-wine.png" >> "$HOME/.local/share/applications/osuwinello-url-handler.desktop"
chmod +x "$HOME/.local/share/applications/osuwinello-url-handler.desktop"
update-desktop-database "$HOME/.local/share/applications"
Info "Configuring Wineprefix:"
mkdir -p "$HOME/.local/share/wineprefixes"
if [ -d "$HOME/.local/share/wineprefixes/osu-wineprefix" ] ; then
Info "Wineprefix already exists; do you want to reinstall it?"
read -r -p "$(Info "Choose: (Y/N)")" prefchoice
if [ "$prefchoice" = 'y' ] || [ "$prefchoice" = 'Y' ]; then
rm -rf "$HOME/.local/share/wineprefixes/osu-wineprefix"
Info "Downloading and configuring Wineprefix: (take a coffee and wait e.e)"
manualprefix="false"
if [ ! -e "/tmp/WINE.win32.7z" ] ; then
wget -O "/tmp/WINE.win32.7z" "https://gitlab.com/NelloKudo/osu-winello-prefix/-/raw/master/osu-winello-prefix.7z" && wgetcheckprefix="$?" ; fi
if [ ! "$wgetcheckprefix" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "/tmp/WINE.win32.7z" "https://gitlab.com/NelloKudo/osu-winello-prefix/-/raw/master/osu-winello-prefix.7z" || (Info "Download failed, maybe GitLab is down?")
if [ ! -e "/tmp/WINE.win32.7z" ] ; then
manualprefix="true" ; fi
fi
if [ "$manualprefix" = "false" ] ; then
7z x -y -o/tmp/osu-wineprefix "/tmp/WINE.win32.7z"
cp -r "/tmp/osu-wineprefix/.osuwine/" "$HOME/.local/share/wineprefixes/osu-wineprefix"
rm -rf "/tmp/osu-wineprefix/"
else
export PATH="$HOME/.local/share/osuconfig/wine-osu/bin:$PATH"
WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix" "$HOME/.local/share/osuconfig/winetricks" -q -f dotnet48 gdiplus_winxp comctl32 win2k3 || Error "Winetricks failed, check your connection or open an issue here: https://github.com/NelloKudo/osu-winello/issues" ; fi
export WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix"
# Time to remove all the bloat there lmao
rm -rf "$WINEPREFIX/dosdevices"
rm -rf "$WINEPREFIX/drive_c/users/nellokudo"
mkdir -p "$WINEPREFIX/dosdevices"
ln -s "$WINEPREFIX/drive_c/" "$WINEPREFIX/dosdevices/c:"
ln -s / "$WINEPREFIX/dosdevices/z:"
export PATH="$HOME/.local/share/osuconfig/wine-osu/bin:$PATH"
Info "Installing fonts..."
# Using fonts from https://github.com/YourRandomGuy/ttf-ms-win10
mkdir -p "/tmp/tempfonts"
git clone "https://github.com/YourRandomGuy/ttf-ms-win10.git" "/tmp/tempfonts" || Error "Git failed, check your connection or open an issue at here: https://github.com/NelloKudo/osu-winello/issues"
mkdir -p "$HOME/.local/share/osuconfig/W10Fonts"
cp /tmp/tempfonts/*{.ttf,.ttc} "$HOME/.local/share/osuconfig/W10Fonts"
# Linking fonts to Wine
rm -rf "$HOME/.local/share/osuconfig/wine-osu/share/wine/fonts"
ln -s "$HOME/.local/share/osuconfig/W10Fonts" "$HOME/.local/share/osuconfig/wine-osu/share/wine/fonts"
rm -rf "/tmp/tempfonts"
# Checking for Lutris Wine
if [ -d "$HOME/.local/share/lutris/runners/wine/wine-osu" ]; then
rm -rf "$HOME/.local/share/lutris/runners/wine/wine-osu/share/wine/fonts"
ln -s "$HOME/.local/share/osuconfig/W10Fonts" "$HOME/.local/share/lutris/runners/wine/wine-osu/share/wine/fonts" ; fi
# Checking for Flatpak Lutris Wine
if [ -d "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu" ]; then
rm -rf "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu/share/wine/fonts"
ln -s "$HOME/.local/share/osuconfig/W10Fonts" "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu/share/wine/fonts" ; fi
#Integrating native file explorer by Maot: https://gist.github.com/maotovisk/1bf3a7c9054890f91b9234c3663c03a2
(cp "./stuff/folderfixosu" "$HOME/.local/share/osuconfig/folderfixosu" && chmod +x "$HOME/.local/share/osuconfig/folderfixosu") || (Info "Seems like the file wasn't found for some reason lol. Copying it from backup.." && cp "$HOME/.local/share/osuconfig/update/fixfolderosu" "$HOME/.local/share/osuconfig/folderfixosu" && chmod +x "$HOME/.local/share/osuconfig/folderfixosu")
WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix" wine reg add "HKEY_CLASSES_ROOT\folder\shell\open\command"
WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix" wine reg delete "HKEY_CLASSES_ROOT\folder\shell\open\ddeexec" /f
WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix" wine reg add "HKEY_CLASSES_ROOT\folder\shell\open\command" /f /ve /t REG_SZ /d "/home/$USER/.local/share/osuconfig/folderfixosu xdg-open \"%1\""
else
if [ ! -e "$HOME/.local/share/osuconfig/folderfixosu" ] ; then
(cp "./stuff/folderfixosu" "$HOME/.local/share/osuconfig/folderfixosu" && chmod +x "$HOME/.local/share/osuconfig/folderfixosu") || (Info "Seems like the file wasn't found for some reason lol. Copying it from backup.." && cp "$HOME/.local/share/osuconfig/update/fixfolderosu" "$HOME/.local/share/osuconfig/folderfixosu" && chmod +x "$HOME/.local/share/osuconfig/folderfixosu")
fi
Info "Skipping..." ; fi
else
Info "Downloading and configuring Wineprefix: (take a coffee and wait e.e)"
manualprefix="false"
if [ ! -e "/tmp/WINE.win32.7z" ] ; then
wget -O "/tmp/WINE.win32.7z" "https://gitlab.com/NelloKudo/osu-winello-prefix/-/raw/master/osu-winello-prefix.7z" && wgetcheckprefix="$?" ; fi
if [ ! "$wgetcheckprefix" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "/tmp/WINE.win32.7z" "https://gitlab.com/NelloKudo/osu-winello-prefix/-/raw/master/osu-winello-prefix.7z" || (Info "Download failed, maybe GitLab is down?")
if [ ! -e "/tmp/WINE.win32.7z" ] ; then
manualprefix="true" ; fi
fi
if [ "$manualprefix" = "false" ] ; then
7z x -y -o/tmp/osu-wineprefix "/tmp/WINE.win32.7z"
cp -r "/tmp/osu-wineprefix/.osuwine/" "$HOME/.local/share/wineprefixes/osu-wineprefix"
rm -rf "/tmp/osu-wineprefix/"
else
export PATH="$HOME/.local/share/osuconfig/wine-osu/bin:$PATH"
WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix" "$HOME/.local/share/osuconfig/winetricks" -q -f dotnet48 gdiplus_winxp comctl32 win2k3 || Error "Winetricks failed, check your connection or open an issue here: https://github.com/NelloKudo/osu-winello/issues" ; fi
export WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix"
# Time to remove all the bloat there lmao
rm -rf "$WINEPREFIX/dosdevices"
rm -rf "$WINEPREFIX/drive_c/users/nellokudo"
mkdir -p "$WINEPREFIX/dosdevices"
ln -s "$WINEPREFIX/drive_c/" "$WINEPREFIX/dosdevices/c:"
ln -s / "$WINEPREFIX/dosdevices/z:"
export PATH="$HOME/.local/share/osuconfig/wine-osu/bin:$PATH"
Info "Installing fonts..."
# Using fonts from https://github.com/YourRandomGuy/ttf-ms-win10
mkdir -p "/tmp/tempfonts"
git clone "https://github.com/YourRandomGuy/ttf-ms-win10.git" "/tmp/tempfonts" || Error "Git failed, check your connection or open an issue at here: https://github.com/NelloKudo/osu-winello/issues"
mkdir -p "$HOME/.local/share/osuconfig/W10Fonts"
cp /tmp/tempfonts/*{.ttf,.ttc} "$HOME/.local/share/osuconfig/W10Fonts"
# Linking fonts to Wine
rm -rf "$HOME/.local/share/osuconfig/wine-osu/share/wine/fonts"
ln -s "$HOME/.local/share/osuconfig/W10Fonts" "$HOME/.local/share/osuconfig/wine-osu/share/wine/fonts"
rm -rf "/tmp/tempfonts"
# Checking for Lutris Wine
if [ -d "$HOME/.local/share/lutris/runners/wine/wine-osu" ]; then
rm -rf "$HOME/.local/share/lutris/runners/wine/wine-osu/share/wine/fonts"
ln -s "$HOME/.local/share/osuconfig/W10Fonts" "$HOME/.local/share/lutris/runners/wine/wine-osu/share/wine/fonts" ; fi
# Checking for Flatpak Lutris Wine
if [ -d "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu" ]; then
rm -rf "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu/share/wine/fonts"
ln -s "$HOME/.local/share/osuconfig/W10Fonts" "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu/share/wine/fonts" ; fi
# Integrating native file explorer by Maot: https://gist.github.com/maotovisk/1bf3a7c9054890f91b9234c3663c03a2
(cp "./stuff/folderfixosu" "$HOME/.local/share/osuconfig/folderfixosu" && chmod +x "$HOME/.local/share/osuconfig/folderfixosu") || (Info "Seems like the file wasn't found for some reason lol. Copying it from backup.." && cp "$HOME/.local/share/osuconfig/update/fixfolderosu" "$HOME/.local/share/osuconfig/folderfixosu" && chmod +x "$HOME/.local/share/osuconfig/folderfixosu")
WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix" wine reg add "HKEY_CLASSES_ROOT\folder\shell\open\command"
WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix" wine reg delete "HKEY_CLASSES_ROOT\folder\shell\open\ddeexec" /f
WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix" wine reg add "HKEY_CLASSES_ROOT\folder\shell\open\command" /f /ve /t REG_SZ /d "/home/$USER/.local/share/osuconfig/folderfixosu xdg-open \"%1\""
fi
# Installing Winestreamproxy from https://github.com/openglfreak/winestreamproxy
if [ ! -d "$HOME/.local/share/wineprefixes/osu-wineprefix/drive_c/winestreamproxy" ] ; then
Info "Configuring Winestreamproxy (Discord RPC)"
wget -O "/tmp/winestreamproxy-2.0.3-amd64.tar.gz" "https://github.com/openglfreak/winestreamproxy/releases/download/v2.0.3/winestreamproxy-2.0.3-amd64.tar.gz" && wgetcheck5="$?"
if [ ! "$wgetcheck5" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "/tmp/winestreamproxy-2.0.3-amd64.tar.gz" "https://github.com/openglfreak/winestreamproxy/releases/download/v2.0.3/winestreamproxy-2.0.3-amd64.tar.gz" || Error "Download failed, check your connection or open an issue here: https://github.com/NelloKudo/osu-winello/issues" ; fi
mkdir -p "/tmp/winestreamproxy"
tar -xf "/tmp/winestreamproxy-2.0.3-amd64.tar.gz" -C "/tmp/winestreamproxy"
(WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix" wineserver -k && WINE="$HOME/.local/share/osuconfig/wine-osu/bin/wine" WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix" bash "/tmp/winestreamproxy/install.sh") || Info "Installing Winestreamproxy failed, try to install it yourself later"
rm -f "/tmp/winestreamproxy-2.0.3-amd64.tar.gz"
rm -rf "/tmp/winestreamproxy"
fi
Info "Downloading osu!"
if [ -s "$OSUPATH/osu!.exe" ]; then
Info "Installation is completed! Run 'osu-wine' to play osu!"
Info "WARNING: If 'osu-wine' doesn't work, just close and relaunch your terminal."
exit 0
else
wget -O "$OSUPATH/osu!.exe" "http://m1.ppy.sh/r/osu!install.exe" && wgetcheck6="$?"
if [ ! "$wgetcheck6" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "$OSUPATH/osu!.exe" "http://m1.ppy.sh/r/osu!install.exe" || Error "Download failed, check your connection or open an issue here: https://github.com/NelloKudo/osu-winello/issues" ; fi
Info "Installation is completed! Run 'osu-wine' to play osu!"
Info "WARNING: If 'osu-wine' doesn't work, just close and relaunch your terminal."
fi
}
Uninstall()
{
Info "Uninstalling icons:"
rm -f "$HOME/.local/share/icons/osu-wine.png"
Info "Uninstalling .desktop:"
rm -f "$HOME/.local/share/applications/osu-wine.desktop"
Info "Uninstalling game script, utilities & folderfix:"
rm -f "$HOME/.local/bin/osu-wine"
rm -f "$HOME/.local/bin/folderfixosu"
rm -f "$HOME/.local/share/mime/packages/osuwinello-file-extensions.xml"
rm -f "$HOME/.local/share/applications/osuwinello-file-extensions-handler.desktop"
rm -f "$HOME/.local/share/applications/osuwinello-url-handler.desktop"
Info "Uninstalling wine-osu:"
rm -rf "$HOME/.local/share/osuconfig/wine-osu"
read -r -p "$(Info "Do you want to uninstall Wineprefix? (y/n)")" wineprch
if [ "$wineprch" = 'y' ] || [ "$wineprch" = 'Y' ]; then
rm -rf "$HOME/.local/share/wineprefixes/osu-wineprefix"
else
Info "Skipping.." ; fi
read -r -p "$(Info "Do you want to uninstall game files? (y/n)")" choice
if [ "$choice" = 'y' ] || [ "$choice" = 'Y' ]; then
read -r -p "$(Info "Are you sure? This will delete your files! (y/n)")" choice2
if [ "$choice2" = 'y' ] || [ "$choice2" = 'Y' ]; then
Info "Uninstalling game:"
if [ -e "$HOME/.local/share/osuconfig/osupath" ]; then
OSUUNINSTALLPATH=$(<"$HOME/.local/share/osuconfig/osupath")
rm -rf "$OSUUNINSTALLPATH"
rm -rf "$HOME/.local/share/osuconfig"
else
rm -rf "$HOME/.local/share/osuconfig"; fi
else
rm -rf "$HOME/.local/share/osuconfig"
Info "Exiting.."
fi
else
rm -rf "$HOME/.local/share/osuconfig"
fi
Info "Uninstallation completed!"
}
Update()
{
if [ ! "$CURRENTGLIBC" \< "$MINGLIBC" ]; then
LASTWINEVERSION=$(</"$HOME/.local/share/osuconfig/wineverupdate")
if [ "$LASTWINEVERSION" \!= "$WINEVERSION" ]; then
wget -O "/tmp/wine-osu-${WINEVERSION}-x86_64.pkg.tar.xz" "$WINELINK" && wgetcheck7="$?"
if [ ! "$wgetcheck7" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "/tmp/wine-osu-${WINEVERSION}-x86_64.pkg.tar.xz" "$WINELINK" || Error "Download failed, check your connection or open an issue here: https://github.com/NelloKudo/osu-winello/issues"; fi
tar -xf "/tmp/wine-osu-${WINEVERSION}-x86_64.pkg.tar.xz" -C "$HOME/.local/share/"
rm -rf "$HOME/.local/share/osuconfig/wine-osu"
mv "$HOME/.local/share/wine-osu" "$HOME/.local/share/osuconfig/"
rm -f "/tmp/wine-osu-${WINEVERSION}-x86_64.pkg.tar.xz"
LASTWINEVERSION="$WINEVERSION"
rm -f "$HOME/.local/share/osuconfig/wineverupdate"
echo "$LASTWINEVERSION" >> "$HOME/.local/share/osuconfig/wineverupdate"
if [ -d "$HOME/.local/share/lutris/runners/wine/wine-osu" ]; then
read -r -p "$(Info "Do you want to update wine-osu in Lutris too? (y/n)")" lutrupdate
if [ "$lutrupdate" = 'y' ] || [ "$lutrupdate" = 'Y' ]; then
rm -rf "$HOME/.local/share/lutris/runners/wine/wine-osu"
cp -r "$HOME/.local/share/osuconfig/wine-osu" "$HOME/.local/share/lutris/runners/wine"
else
Info "Skipping...." ;fi
fi
if [ -d "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu" ] ; then
read -r -p "$(Info "Do you want to update wine-osu in Flatpak Lutris too? (y/n)")" lutrupdate2
if [ "$lutrupdate2" = 'y' ] || [ "$lutrupdate2" = 'Y' ]; then
rm -rf "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu"
cp -r "$HOME/.local/share/osuconfig/wine-osu" "$HOME/.var/app/net.lutris.Lutris/data/lutris/runners/wine/wine-osu"
else
Info "Skipping...." ;fi
fi
Info "Update is completed!"
else
Info "Your wine-osu is already up-to-date!"
fi
else
Info "Try updating your system.."
fi
}
Basic()
{
if [ "$USER" = "root" ] ; then Error "Please run the script without root" ; fi
Info "This is the basic installer, it will only install basic features to get the game running.."
if [ -e /usr/bin/osu-wine ] ; then Error "Please uninstall old osu-wine (/usr/bin/osu-wine) before installing!" ; fi #Checking DiamondBurned's osu-wine
if [ -e "$HOME/.local/bin/osu-wine" ] ; then Error "Please uninstall osu-wine before installing!" ; fi
#/.local/bin check
if [ ! -d "$HOME/.local/bin" ] ; then
mkdir -p "$HOME/.local/bin"
if (grep -q "bash" "$SHELL" || [[ -f "$HOME/.bashrc" ]]) && ! grep -q "PATH="$HOME/.local/bin/:$PATH"" "$HOME/.bashrc"; then
echo 'export PATH="$HOME/.local/bin/:$PATH"' >> "$HOME/.bashrc"
source "$HOME/.bashrc"
fi
if (grep -q "zsh" "$SHELL" || [[ -f "$HOME/.zshrc" ]]) && ! grep -q "PATH="$HOME/.local/bin/:$PATH"" "$HOME/.zshrc"; then
echo 'export PATH="$HOME/.local/bin/:$PATH"' >> "$HOME/.zshrc"
source "$HOME/.zshrc"
fi
if [[ -f "$HOME/.config/fish/config.fish" ]] && ! grep -q "PATH="$HOME/.local/bin/:$PATH"" "$HOME/.config/fish/config.fish"; then
echo 'export PATH="$HOME/.local/bin/:$PATH"' >> "$HOME/.config/fish/config.fish"
source "$HOME/.config/fish/config.fish"
fi
fi
Info "Checking for internet connection.."
! ping -c 1 1.1.1.1 >/dev/null 2>&1 && Error "Please connect to internet before continuing xd. Run the script again"
Info "Dependencies time.."
if command -v apt >/dev/null 2>&1 ; then
if ! ( command -v dnf >/dev/null 2>&1 || command -v emerge >/dev/null 2>&1 ) ; then
Info "Debian/Ubuntu detected, installing dependencies..."
Info "Please enter your password when asked"
Info "------------------------------------"
osid=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
if [ "$osid" == "debian" ] ; then
Info "Installing needed packages for dependencies.."
"$root_var" apt update && "$root_var" apt install -y software-properties-common
nonfreestatus="true"
"$root_var" dpkg --add-architecture i386
"$root_var" apt install -y steam || nonfreestatus="false"
if [ "$nonfreestatus" == "false" ]; then
Info "Looks like non-free repositories are not enabled on your system"
Info "Those are needed in order to install libraries to play osu! properly."
read -r -p "$(Info "Do you want to enable non-free repositories? (Y/N): ")" nonfreechoice
if [ "$nonfreechoice" == 'Y' ] || [ "$nonfreechoice" == 'y' ]; then
# Now checking for all lines supposed to be there, according to https://wiki.debian.org/Steam:
# Remember that Steam is necessary for apt to pull libGL and other libraries.
if grep "deb http://deb.debian.org/debian/ bullseye main contrib" /etc/apt/sources.list || grep "deb http://deb.debian.org/debian bullseye main contrib" /etc/apt/sources.list || grep "deb http://deb.debian.org/debian/ bullseye main" /etc/apt/sources.list; then
grepline=$(echo "$(grep -n -o '[0-9]*'"deb http://deb.debian.org/debian bullseye main contrib" /etc/apt/sources.list)" | cut -c1-3)
if [ "$grepline" == "" ]; then grepline=$(echo "$(grep -n -o '[0-9]*'"deb http://deb.debian.org/debian/ bullseye main contrib" /etc/apt/sources.list)" | cut -c1-3) ; fi
if [ "$grepline" == "" ]; then grepline=$(echo "$(grep -n -o '[0-9]*'"deb http://deb.debian.org/debian/ bullseye main" /etc/apt/sources.list)" | cut -c1-3) ; fi
linenumber=$(echo $grepline | grep -o '[0-9]*')
# Additional check to make sure sed doesn't really replace everything if non-free is already found for some reason
if ! grep "deb http://deb.debian.org/debian/ bullseye main contrib non-free" /etc/apt/sources.list || ! grep "deb http://deb.debian.org/debian bullseye main contrib non-free" /etc/apt/sources.list || ! grep "deb http://deb.debian.org/debian/ bullseye main non-free" /etc/apt/sources.list ; then
"$root_var" sh -c "sed -i.bak '${linenumber}s/$/ non-free/' /etc/apt/sources.list" && Info "non-free added successfully." ; fi
else
"$root_var" sh -c 'echo "deb http://deb.debian.org/debian bullseye main non-free" >> /etc/apt/sources.list'
fi
else
Error "non-free repositories are needed for the script to work properly. Closing the script.." ; fi
fi
Info "Installing packages and wine-staging dependencies.."
"$root_var" mkdir -pm755 /etc/apt/keyrings
"$root_var" wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
"$root_var" wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/bullseye/winehq-bullseye.sources
"$root_var" apt update
"$root_var" apt install -y --install-recommends winehq-staging || Error "Some libraries didn't install for some reason, check apt or your connection"
"$root_var" apt install -y git curl steam build-essential zstd p7zip-full zenity || Error "Some libraries didn't install for some reason, check apt or your connection"
else
Info "Installing packages and wine-staging dependencies.."
"$root_var" apt update && "$root_var" apt upgrade -y
"$root_var" dpkg --add-architecture i386
wget -nc https://dl.winehq.org/wine-builds/winehq.key
"$root_var" apt-key add winehq.key
"$root_var" apt-add-repository -y 'https://dl.winehq.org/wine-builds/ubuntu/'
"$root_var" apt update
"$root_var" apt install -y --install-recommends winehq-staging || Error "Some libraries didn't install for some reason, check apt or your connection"
"$root_var" apt install -y git curl steam build-essential zstd p7zip-full zenity || Error "Some libraries didn't install for some reason, check apt or your connection"
Info "Dependencies done, skipping.."
fi
fi
fi
if command -v emerge >/dev/null 2>&1 ; then
Info "Gentoo detected, installing dependencies..."
Info "Please enter your password when asked"
Info "------------------------------------"
"$root_var" mkdir -p /etc/portage/sets
Info "Creating @osu-winello package set.."
printf "dev-vcs/git\napp-arch/zstd\napp-arch/p7zip\nnet-misc/wget\ngnome-extra/zenity\nvirtual/wine\napp-emulation/winetricks\n" | "$root_var" tee /etc/portage/sets/osu-winello
Info "Adding required USE flags.."
printf "media-libs/libsdl2 haptic\n" | "$root_var" tee /etc/portage/package.use/osu-winello
if ! grep -q '@osu-winello' /var/lib/portage/world_sets; then
if ! emerge --info | grep -q 'ABI_X86="64 32"' && ! emerge --info | grep -q 'ABI_X86="32 64"'; then
Info "Error: Unsupported configuration."
Info "Enable abi_x86_32 globally *or* manually emerge the @osu-winello set."
Info
Info 'To enable it globally, set ABI_X86="64 32" in /etc/portage/make.conf and run "emerge --newuse @world".'
Error "Cannot continue, there *will* be circular dependencies to resolve!"
fi
fi
"$root_var" emerge --noreplace @osu-winello || Error "Some libraries didn't install for some reason, check portage or your connection"
Info "Dependencies done, skipping.."
fi
if command -v pacman >/dev/null 2>&1 ; then
Info "Arch Linux/SteamOS detected, installing dependencies..."
Info "Please enter your password when asked"
Info "------------------------------------"
osid=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
if [ "$osid" != "steamos" ] ; then
if ! grep -q -E '^\[multilib\]' '/etc/pacman.conf'; then
Info "Enabling multilib.."
printf "\n# Multilib repo enabled by osu-winello\n[multilib]\nInclude = /etc/pacman.d/mirrorlist\n" | "$root_var" tee -a /etc/pacman.conf
fi
Info "Installing packages and wine-staging dependencies.."
if command -v wine >/dev/null 2>&1 ; then
Info "Wine (possibly) already found, removing it to replace with staging.."
"$root_var" pacman -Rdd --noconfirm wine || Info "Looks like staging is already installed"
fi
"$root_var" pacman -Sy --noconfirm --needed git base-devel p7zip wget zenity wine-staging winetricks giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo libxcomposite lib32-libxcomposite libxinerama lib32-libxinerama ncurses lib32-ncurses opencl-icd-loader lib32-opencl-icd-loader libxslt lib32-libxslt libva lib32-libva gtk3 lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader cups samba dosbox || Error "Some libraries didn't install for some reason, check pacman or your connection"
Info "Dependencies done, skipping.."
else
deck_fs_check=$("$root_var" [ -w /usr ] && echo "rw" || echo "ro")
if [ "$deck_fs_check" = "ro" ]; then
Error "The Steam Deck's file system is in read-only mode, preventing further action. To continue, you must disable read-only mode. More information can be found on GitHub: https://github.com/NelloKudo/osu-winello#steam-deck-support"
else
"$root_var" pacman --needed -Sy libxcomposite lib32-libxcomposite gnutls lib32-gnutls wine winetricks || Error "Check your connection"
fi
fi
fi
if command -v dnf >/dev/null 2>&1 ; then
Info "Fedora/Nobara detected, installing dependencies..."
Info "Please enter your password when asked"
Info "------------------------------------"
Info "Installing packages and wine-staging dependencies.."
"$root_var" dnf install -y git zstd p7zip p7zip-plugins wget zenity || Error "Some libraries didn't install for some reason, check dnf or your connection"
osid=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
if [ "$osid" != "nobara" ] ; then
"$root_var" dnf install -y winetricks || Error "Some libraries didn't install for some reason, check dnf or your connection"
"$root_var" dnf install -y wine || Error "Some libraries didn't install for some reason, check dnf or your connection"
fi
Info "Dependencies done, skipping.."
fi