-
Notifications
You must be signed in to change notification settings - Fork 2
/
update_apps.nu
984 lines (814 loc) · 23.4 KB
/
update_apps.nu
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
#update nushell
export def "apps-update nushell" [
--repo(-r) #install from repo instead of cargo
--plugins(-p) #install e3rd party plugins
] {
print (echo-g "deleting plugins...")
plugin list | get filename | each {|p| plugin rm $p}
print (echo-g "updating nushell...")
cd ~/software/nushell
git pull
if $repo {
bash scripts/install-all.sh
} else {
cargo install-update nu
}
cargo clean
print (echo-g "updating config file...")
update-nu-config
print (echo-g "now restart nushell...")
}
#update nushell default plugins
export def "apps-update nushell-plugins" [] {
cargo install-update nu_plugin_inc nu_plugin_gstat nu_plugin_query nu_plugin_formats
cargo install nu_plugin_polars
plugin add ~/.cargo/bin/nu_plugin_inc
plugin add ~/.cargo/bin/nu_plugin_gstat
plugin add ~/.cargo/bin/nu_plugin_query
plugin add ~/.cargo/bin/nu_plugin_formats
plugin add ~/.cargo/bin/nu_plugin_polars
plugin use ~/.cargo/bin/nu_plugin_inc
plugin use ~/.cargo/bin/nu_plugin_gstat
plugin use ~/.cargo/bin/nu_plugin_query
plugin use ~/.cargo/bin/nu_plugin_formats
plugin use ~/.cargo/bin/nu_plugin_polars
}
#update nushell 3rd party plugins
#
#nu_plugin_net nu_plugin_highlight nu_plugin_units nu_plugin_port_scan nu_plugin_image
export def "apps-update nushell-external-plugins" [] {
cargo install-update nu_plugin_highlight
cargo install --git https://github.com/Euphrasiologist/nu_plugin_plot
cargo install --git https://github.com/FMotalleb/nu_plugin_port_scan.git
cargo install --git https://github.com/FMotalleb/nu_plugin_image.git
plugin add ~/.cargo/bin/nu_plugin_highlight
plugin add ~/.cargo/bin/nu_plugin_port_scan
plugin add ~/.cargo/bin/nu_plugin_image
plugin add ~/.cargo/bin/nu_plugin_plot
plugin use ~/.cargo/bin/nu_plugin_highlight
plugin use ~/.cargo/bin/nu_plugin_port_scan
plugin use ~/.cargo/bin/nu_plugin_image
plugin use ~/.cargo/bin/nu_plugin_plot
}
#update nu config (after nushell update)
export def update-nu-config [] {
#config
let default = (
ls ($env.MY_ENV_VARS.nushell_dir + "/**/*" | into glob)
| find -i default_config
| get name
| ansi strip
| get 0
)
cp -f $default $nu.config-path
open ([$env.MY_ENV_VARS.linux_backup "append_to_config.nu"] | path join)
| str replace kira $env.USER -a
| save --append $nu.config-path
#env
let default = (
ls ($env.MY_ENV_VARS.nushell_dir + "/**/*" | into glob)
| find -i default_env
| update name {|n|
$n.name | ansi strip
}
| get name
| get 0
)
cp $default $nu.env-path
nu -c $"source-env ($nu.config-path)"
}
#patch font with nerd font
export def patch-font [file? = "Monocraft.ttc"] {
let nerd_font = "~/software/nerd-fonts"
let folder = $env.MY_ENV_VARS.appImages
let font_folder = $env.MY_ENV_VARS.linux_backup
cd $folder
cp ($font_folder | path join "Monocraft.ttc" | path expand) .
./fontforge.AppImage -script ([$nerd_font font-patcher] | path join | path expand) ([$env.PWD $file] | path join) --complete --careful --output "Monocraft_updated.ttc" --outputdir $env.PWD
mv -f (ls *.ttc | sort-by modified | last | get name) $"($file | path parse | get stem)-nerd-fonts-patched_by_me.ttc"
cp -f $"($file | path parse | get stem)-nerd-fonts-patched_by_me.ttc" ($font_folder | path expand)
mv -f $"($file | path parse | get stem)-nerd-fonts-patched_by_me.ttc" $file
sudo mv -f $file /usr/local/share/fonts
fc-cache -fv;sudo fc-cache -fv
}
#update-upgrade system
export def supgrade [--old(-o),--apps(-a),--cargo_aps(-c)] {
if not $old {
print (echo-g "updating and upgrading...")
sudo nala upgrade -y
print (echo-g "autoremoving...")
sudo nala autoremove -y
} else {
print (echo-g "updating...")
sudo apt update -y
print (echo-g "upgrading...")
sudo apt upgrade -y
print (echo-g "autoremoving...")
sudo apt autoremove -y
}
print (echo-g "updating rust...")
rustup update
if $cargo_aps {
print (echo-g "updating cargo apps...")
cargo install-update -a
}
if $apps {
print (echo-g "updating off apt apps...")
apps-update
}
# echo-g "upgrading pip3 packages..."
# pip3-upgrade
}
#update off-package manager apps
export def apps-update [] {
try {
apps-update sejda
} catch {
print (echo-r "Something went wrong with sejda instalation!")
}
try {
apps-update ttyplot
} catch {
print (echo-r "Something went wrong with ttyplot instalation!")
}
try {
apps-update nyxt
} catch {
print (echo-r "Something went wrong with nyxt instalation!")
}
try {
apps-update pandoc
} catch {
print (echo-r "Something went wrong with pandoc instalation!")
}
try {
apps-update taskerpermissions
} catch {
print (echo-r "Something went wrong with taskerpermissions instalation!")
}
try {
apps-update lutris #ignore if ppa works again
} catch {
print (echo-r "Something went wrong with lutris instalation!")
}
try {
apps-update mpris
} catch {
print (echo-r "Something went wrong with mpris instalation!")
}
try {
apps-update monocraft
} catch {
print (echo-r "Something went wrong with monocraft instalation!")
}
try {
apps-update yandex
} catch {
print (echo-r "Something went wrong with yandex instalation!")
}
try {
apps-update earth
} catch {
print (echo-r "Something went wrong with earth instalation!")
}
try {
apps-update vivaldi
} catch {
print (echo-r "Something went wrong with vivaldi instalation!")
}
try {
apps-update zoom
} catch {
print (echo-r "Something went wrong with zoom instalation!")
}
# try {
# apps-update chrome
# } catch {
# print (echo-r "Something went wrong with chrome instalation!")
# }
# try {
# apps-update nmap
# } catch {
# print (echo-r "Something went wrong with nmap instalation!")
# }
# try {
# apps-update join
# } catch {
# print (echo-r "Something went wrong with taskerpermissions instalation!")
# }
}
#get latest release info in github repo
export def get-github-latest [
owner:string
repo:string
--file_type(-f):string = "deb"
] {
let git_token = $env.MY_ENV_VARS.api_keys.github.api_key
let assets_url = {
scheme: "https",
host: "api.github.com",
path: $"/repos/($owner)/($repo)/releases/latest",
}
| url join
| http get $in -H ["Authorization", $"Bearer ($git_token)"] -H ['Accept', 'application/vnd.github+json']
| select assets_url tag_name
let info = (
http get $assets_url.assets_url -H ["Authorization", $"Bearer ($git_token)"] -H ['Accept', 'application/vnd.github+json']
| select name browser_download_url
| upsert version $assets_url.tag_name
| find $file_type
)
if ($info | length) > 0 {
$info | get 0
} else {
[]
}
}
#update github app release
export def github-app-update [
owner:string
repo:string
--file_type(-f):string = "deb"
--down_dir(-d):string
--alternative_name(-a):string
--version_from_json(-j)
] {
let down_dir = if ($down_dir | is-empty) {$env.MY_ENV_VARS.debs} else {$down_dir}
cd $down_dir
let info = get-github-latest $owner $repo -f $file_type
if ($info | is-empty) {return}
let url = $info | get browser_download_url | ansi strip
let app = (
if ($alternative_name | is-empty) {
$repo
} else {
$alternative_name
}
)
let app_file = (
if $version_from_json {
[$down_dir $"($app).json"] | path join
} else {
""
}
)
let find_ = (
$info
| get name
| find _
| is-empty
)
let new_version = (
if $version_from_json {
$info
| get version
} else {
$info
| get name
| path parse
| get stem
| split row (if not $find_ {"_"} else {"-"})
| get 1
}
)
let exists = (ls | find $app | find $file_type | length) > 0
if $exists {
let current_version = (
if $version_from_json {
open --raw $app_file
| from json
| get version
} else {
ls ($"*.($file_type)" | into glob)
| find $app
| get 0
| get name
| ansi strip
| path parse
| get stem
| split row (if not $find_ {"_"} else {"-"})
| get 1
}
)
if $current_version == $new_version {
print (echo-g $"($repo) is already in its latest version!")
return
}
print (echo-g $"\nupdating ($repo)...")
rm ($"*($app)*.($file_type)" | into glob) | ignore
aria2c --download-result=hide $url
if $version_from_json {
open --raw $app_file
| from json
| upsert version $new_version
| save -f $app_file
}
if $file_type != "deb" {
print (echo-g "file downloaded...")
return
}
let install = (input (echo-g "Would you like to install it now? (y/n): "))
if $install == "y" {
sudo gdebi -n ($info.name | ansi strip)
}
return
}
print (echo-g $"\ndownloading ($repo)...")
aria2c --download-result=hide $url
if $file_type == "deb" {
let install = (input (echo-g "Would you like to install it now? (y/n): "))
if $install == "y" {
sudo gdebi -n ($info.name | ansi strip)
}
}
}
#update nyxt deb
export def "apps-update nyxt" [] {
github-app-update atlas-engineer nyxt -f flatpak
}
#update pandoc deb
export def "apps-update pandoc" [] {
github-app-update jgm pandoc
}
#update pandoc cross-ref
export def "apps-update pandoc-cross-ref" [] {
cd ~/software/pandoc-crossref
try {
git pull
stack install
} catch {
cd ~/software
rm -rf pandoc-crossref
git clone https://github.com/lierdakil/pandoc-crossref.git
cd pandoc-crossref
stack install
}
}
#update tasker helper deb
export def "apps-update taskerpermissions" [] {
github-app-update joaomgcd Tasker-Permissions -a taskerpermissions
}
#update join deb
export def "apps-update join" [] {
github-app-update joaomgcd JoinDesktop -a join
}
#update lutris deb
export def "apps-update lutris" [] {
github-app-update lutris lutris
}
#update mpris (for mpv)
export def "apps-update mpris" [] {
github-app-update hoyon mpv-mpris -f so -d ([$env.MY_ENV_VARS.linux_backup "scripts"] | path join) -a mpris -j
}
#update monocraft font
export def "apps-update monocraft" [
--to_patch(-p) = true #to patch Monocraft.otf, else to use patched ttf
--type(-t):string = "ttc" #"otf" if -p, else "ttf"
] {
let current_version = (
open --raw ([$env.MY_ENV_VARS.linux_backup Monocraft.json] | path join)
| from json
| get version
)
github-app-update IdreesInc Monocraft -f $type -d $env.MY_ENV_VARS.linux_backup -j
let new_version = (
open ([$env.MY_ENV_VARS.linux_backup Monocraft.json] | path join)
| get version
)
if $current_version == $new_version {
print (echo-g "Monocraft is already in its latest version...")
return
}
if $to_patch {
print (echo-g "New version of Monocraft downloaded, now patching nerd fonts...")
patch-font
} else {
let font = [$env.MY_ENV_VARS.linux_backup (ls ($"($env.MY_ENV_VARS.linux_backup)/*.($type)" | into glob) | sort-by modified | last | get name | ansi strip)] | path join
print (echo-g $"New version of Monocraft downloaded, now installing ($font | path parse | get stem)...")
install-font $font
}
}
#update zoom
export def "apps-update zoom" [] {
cd $env.MY_ENV_VARS.debs
let current_version = open zoom.json | get version
print ("current version: " + $current_version)
print (echo-g "go to https://us05web.zoom.us/support/down4j")
let release_url = input (echo-g "paste deb url here: ")
if ($release_url | is-empty) {
return
}
let last_version = (
$release_url
| split row "/"
| get 4
)
if $current_version == $last_version {
print (echo-g "zoom is already in its latest version!")
return
}
ls | find zoom | find deb | rm-pipe | ignore
print (echo-g "\ndownloading zoom...")
aria2c --download-result=hide $release_url
sudo gdebi -n (ls *.deb | find zoom | get 0 | get name | ansi strip)
open ([$env.MY_ENV_VARS.debs zoom.json] | path join)
| upsert version $last_version
| save -f ([$env.MY_ENV_VARS.debs zoom.json] | path join)
apps-update chrome
}
#update chrome deb
export def "apps-update chrome" [] {
cd $env.MY_ENV_VARS.debs
if (ls *.deb | find chrome | length) > 0 {
ls *.deb | find chrome | rm-pipe | ignore
}
print (echo-g "\ndownloading chrome...")
aria2c --download-result=hide https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
}
#update google earth deb
export def "apps-update earth" [] {
cd $env.MY_ENV_VARS.debs
let new_version = (
http get "https://support.google.com/earth/answer/40901#zippy=%2Cearth-version"
| query web -q a
| find version
| first
| ansi strip
)
let current_version = open ([$env.MY_ENV_VARS.debs earth.json] | path join) | get version
if $current_version == $new_version {
print (echo-g "earth is already in its latest version!")
return
}
if (ls *.deb | find earth | length) > 0 {
ls *.deb | find earth | rm-pipe | ignore
}
print (echo-g "\ndownloading google earth...")
aria2c --download-result=hide https://dl.google.com/dl/earth/client/current/google-earth-pro-stable_current_amd64.deb
sudo gdebi -n google-earth-pro-stable_current_amd64.deb
}
#update yandex deb
export def "apps-update yandex" [] {
cd $env.MY_ENV_VARS.debs
let file = [$env.MY_ENV_VARS.debs yandex.json] | path join
let new_date = (
http get http://repo.yandex.ru/yandex-disk/?instant=1
| lines
| find amd64
| get 0
| split row </a>
| last
| str trim
| split row " "
| first 2
| str join " "
| into datetime
)
let old_date = open $file | get date | into datetime
if $old_date >= $new_date {
print (echo-g "yandex is already in its latest version!")
return
}
if (ls *.deb | find yandex | length) > 0 {
ls *.deb | find yandex | rm-pipe | ignore
}
if (ls *.rpm | find yandex | length) > 0 {
ls *.rpm | find yandex | rm-pipe | ignore
}
print (echo-g "\ndownloading yandex...")
aria2c --download-result=hide http://repo.yandex.ru/yandex-disk/yandex-disk_latest_amd64.deb
aria2c --download-result=hide https://repo.yandex.ru/yandex-disk/yandex-disk-latest.x86_64.rpm
sudo gdebi -n yandex-disk_latest_amd64.deb
open $file
| upsert date (date now | format date)
| save -f $file
}
#update sejda deb
export def "apps-update sejda" [] {
cd $env.MY_ENV_VARS.debs
let new_file = (
http get https://www.sejda.com/es/desktop
| lines
| find linux
| find deb
| str trim
| str replace -a "\'" ""
| split row ': '
| get 1
)
let new_version = $new_file | split row _ | get 1
let url = $"https://downloads.sejda-cdn.com/($new_file)"
let sedja = (ls *.deb | find sejda | length) > 0
if $sedja {
let current_version = (
ls *.deb
| find "sejda"
| get 0
| get name
| split row _
| get 1
)
if $current_version == $new_version {
print (echo-g "sedja is already in its latest version!")
return
}
print (echo-g "\nupdating sedja...")
rm sejda*.deb | ignore
aria2c --download-result=hide $url
sudo gdebi -n $new_file
} else {
print (echo-g "\ndownloading sedja...")
aria2c --download-result=hide $url
sudo gdebi -n $new_file
}
}
#update nmap
export def "apps-update nmap" [] {
cd $env.MY_ENV_VARS.debs
let new_file = (
http get https://nmap.org/dist
| lines
| find "href=\"nmap"
| find rpm
| find x86_64
| get 0
| split row "href="
| get 1
| split row >
| get 0
| str replace -a "\"" ""
)
let url = $"https://nmap.org/dist/($new_file)"
let new_version = $new_file | split row .x | get 0 | str replace nmap- ""
let nmap_list = (ls *.deb | find nmap | length) > 0
if $nmap_list {
let current_version = (
ls *.deb
| find nmap
| get 0
| get name
| split row _
| get 1
)
if $current_version == $new_version {
print (echo-g "nmap is already in its latest version!")
return
}
print (echo-g "\nupdating nmap...")
rm nmap*.deb | ignore
aria2c --download-result=hide $url
sudo alien -v -k $new_file
let new_deb = ls *.deb | find nmap | get 0 | get name | ansi strip
sudo gdebi -n $new_deb
ls $new_file | rm-pipe | ignore
} else {
print (echo-g "\ndownloading nmap...")
aria2c --download-result=hide $url
sudo alien -v -k $new_file
let new_deb = (ls *.deb | find nmap | get 0 | get name | ansi strip)
sudo gdebi -n $new_deb
ls $new_file | rm-pipe | ignore
}
}
#update ttyplot
export def "apps-update ttyplot" [] {
cd $env.MY_ENV_VARS.debs
let current_version = (
ls
| find tty
| get name
| get 0
| ansi strip
| split row _
| get 1
)
let url = (
http get https://packages.debian.org/sid/amd64/ttyplot/download
| lines
| find .deb
| find http
| find ttyplot
| first
| split row "href=\""
| last
| split row "\">"
| first
)
let filename = $url | split row / | last
let new_version = $filename | split row _ | get 1
if $current_version == $new_version {
print (echo-g "ttyplot is already in the latest version!")
return
}
print (echo-g $"\nupdating ttyplot...")
ls *.deb | find ttyplot | rm-pipe
aria2c --download-result=hide $url
sudo gdebi -n $filename
}
#update vivaldi
export def "apps-update vivaldi" [] {
cd $env.MY_ENV_VARS.debs
let release_url = (
http get "https://vivaldi.com/download/"
| query web -q .download-link -a href
| find deb
| find amd64
| get 0
| ansi strip
)
if ($release_url | length) == 0 {
return-error "no releases found!"
}
let last_version = (
$release_url
| split row _
| get 1
)
if (ls | find vivaldi | length) == 0 {
aria2c --download-result=hide $release_url
return
}
let current_version = (
ls
| where name =~ vivaldi
| get 0
| get name
| split row _
| get 1
)
if $current_version == $last_version {
print (echo-g "vivaldi is already in its latest version!")
return
}
ls | find vivaldi | find deb | rm-pipe | ignore
print (echo-g "\ndownloading vivaldi...")
aria2c --download-result=hide $release_url
}
#update cmdg
export def "apps-update gmail" [] {
cd ~/software/cmdg
git pull
go build ./cmd/cmdg
sudo cp cmdg /usr/local/bin
}
#upgrade pip3 packages
export def pip3-upgrade [] {
pip3 list --outdated --format=freeze
| lines
| split column "=="
| each {|pkg|
print (echo-g $"upgrading ($pkg.column1)...")
pip3 install --upgrade $pkg.column1
}
}
#install font
export def install-font [file] {
sudo cp -f $file /usr/local/share/fonts
fc-cache -fv;sudo fc-cache -fv
}
#update maestral
export def "apps-update maestral" [] {
pipx upgrade maestral
}
#update guake
export def "apps-update guake" [] {
pipx upgrade guake
}
#update whisper
export def "apps-update whisper" [] {
if (sys host | get os_version) == 20.04 {
pip install --upgrade --no-deps --force-reinstall git+https://github.com/openai/whisper.git
} else {
pipx install git+https://github.com/openai/whisper.git --force
}
}
#update yewtube
export def "apps-update yewtube" [] {
if (sys host | get os_version) == 20.04 {
pip3 install --user yewtube --upgrade
} else {
pipx upgrade yewtube
}
}
#update yt-dlp (youtube-dl fork)
export def "apps-update yt-dlp" [] {
if (sys host | get os_version) == "20.04" {
python3 -m pip install --force-reinstall https://github.com/yt-dlp/yt-dlp/archive/master.tar.gz
} else {
return-error "only available in Ubuntu 20.04. In 24.04 is system-wide via package manager."
}
}
#update nchat (wsp)
export def "apps-update nchat" [] {
sudo rm (which nchat | get path | get 0)
cd ~/software/nchat
git pull
^mkdir -p build; cd build; cmake -DHAS_WHATSAPP=ON -DHAS_TELEGRAM=OFF ..; make -s
sudo make install
}
#update ffmpeg with cuda
export def "apps-update myffmpeg" [--force(-f)] {
cd ~/software/nvidia/nv-codec-headers
let pull = git pull
if $pull != "Already up to date." or $force {
print (echo-g "updating nv-codec-headers...")
git pull
sudo make install
} else {
echo-g "nv-codec-headers already up to date!"
}
cd ~/software/nvidia/ffmpeg
let pull = git pull
if $pull == "Already up to date." and (not $force) {
print (echo-g "ffmpeg already up to date!")
return
}
print (echo-g "updating ffmpeg...")
git pull
./configure --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
./ffmpeg -h
}
#update evernote-backuo tool
export def "apps-update evernote-backup" [] {
pip install --user --upgrade evernote-backup
}
#update joplin
export def "apps-update joplin" [] {
print (echo-g "updating joplin ui...")
wget -O - https://raw.githubusercontent.com/laurent22/joplin/dev/Joplin_install_and_update.sh | bash
print (echo-g "updating jopling cli...")
bash -c "NPM_CONFIG_PREFIX=~/.joplin-bin npm install -g joplin"
sudo rm -f /usr/bin/joplin
bash -c "sudo ln -s ~/.joplin-bin/bin/joplin /usr/bin/joplin"
}
#update tiv
export def "apps-update tiv" [] {
cd ~/software/TerminalImageViewer/
git pull; cd src/
make; sudo make install
}
#update mermaid filter
export def "apps-update mermaid" [] {
sudo npm update --global mermaid-filter
}
#update mermaid-cli
export def "apps-update mermaid-cli" [] {
sudo npm update -g @mermaid-js/mermaid-cli
}
#update ddgr (gg)
export def "apps-update ddgr" [] {
cd ~/software/ddgr
git pull
sudo make install
}
#update rclone
export def "apps-update rclone" [] {
bash -c "sudo -v ; curl -s# https://rclone.org/install.sh | sudo bash"
}
#update matlab lsp server
export def "apps-update matlab-lsp" [] {
cd ~/software/MATLAB-language-server
git pull
npm install; npm run compile; npm run package
}
#update glow
export def "apps-update glow" [] {
go install github.com/charmbracelet/glow@latest
}
#update obsidian
export def "apps-update obsidian" [] {
github-app-update obsidianmd obsidian-releases -a obsidian
}
#update ox
export def "apps-update ox" [] {
cargo install --git https://github.com/curlpipe/ox ox
#download plugins
let git_token = $env.MY_ENV_VARS.api_keys.github.api_key
# cd $env.MY_ENV_VARS.ox_plugins
# {
# scheme: "https",
# host: "api.github.com",
# path: $"/repos/curlpipe/ox/contents/plugins",
# }
# | url join
# | http get $in -H ["Authorization", $"Bearer ($git_token)"] -H ['Accept', 'application/vnd.github+json']
# | get download_url
# | each {|url| aria2c --allow-overwrite=true $url}
#updating help in programmer system message
# if (sys host | get hostname) == "deathnote" {
# cd /home/kira/software/ox.wiki
# git pull
# let ox_config = open Configuration.md
# let p_system_file = [$env.MY_ENV_VARS.chatgpt_config system programmer.md] | path join
# let r_line = grp "ox editor lua scripting reference" $p_system_file | get line.0 | into int
# let p_system = open $p_system_file | lines | first $r_line | to text
# $p_system ++ "\n" ++ $ox_config | save -f $p_system_file
# }
}
#update rustc
export def "apps-update rustc" [] {
rustup default stable-x86_64-unknown-linux-gnu
rustup override set stable-x86_64-unknown-linux-gnu
rustup update
# rustup self uninstall
}