-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatbirdlinux-convert.sh
More file actions
executable file
·1648 lines (1426 loc) · 53.9 KB
/
catbirdlinux-convert.sh
File metadata and controls
executable file
·1648 lines (1426 loc) · 53.9 KB
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
# Copyright (c) 2025 by Philip Collier, github.com/AB9IL
# This script is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version. There is NO warranty; not even for
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Run this script as root user (use sudo). This installer converts an existing
# Debian minimal or desktop system with Xfce into an opinionated respin with
# the same roster of features as in the Catbird Linux iso builds.
#
# Catbird Linux is a respin of Debian Sid. It will work on some, if not most,
# Debian variants. This version uses the Dynamic Window Manager (DWM), but it
# has been tested with i3,Sway, and Awesomewm.
#
# Refs:
# https://blog.aktsbot.in/swaywm-on-debian-11.html
# https://github.com/natpen/awesome-wayland
# https://github.com/swaywm/sway/wiki#gtk-applications-take-20-seconds-to-start
# https://lists.debian.org/debian-live/
#
# Switching to the Xanmod kernels:
# 1. Download the debs from SourceForge (image, headers, libc)
# 2. Install with dpkg -i *.deb
# 3. Purge the old linux-image and linux-image-amd64
# 4. Purge the old linux-headers and linux-headers-amd64
# 5. Pay attention to proper filenames for the initrd and vmlinuz files.
###############################################################################
# ROOT USER CHECK
###############################################################################
SCRIPT_VERSION="0.9"
echo -e "\nCatbird Linux Converter v$SCRIPT_VERSION"
# exit if not root
[[ $EUID -ne 0 ]] && echo -e "\nYou must be root to run this script." && exit
echo -e "You are about to make substantal changes to this system!\n"
echo -e "\n\nAre you sure you want to continue?"
echo ""
echo 'Please answer "yes" or "no"'
read line
case "$line" in
yes | Yes) echo "Okay, starting the conversion process!" ;;
*)
echo '"yes" not received, exiting the script.'
exit 0
;;
esac
###############################################################################
# SET VARIABLES
###############################################################################
USERNAME="$(logname)"
# most installations will go under the "working directory"
export working_dir="/usr/local/src"
export USERNAME
export ARCH="amd64"
export ARCH2="x86_64"
export GOTGPT_VER="2.10.0"
export HARP_VER="0.29.1"
export OBSIDIAN_VER="1.8.9"
export MeshChatVersion="v1.21.0"
export VPNGateVersion="0.3.1"
export LF_VER="34"
export LAZYGIT_VER="0.48.0"
export CYAN_VER="1.2.4"
export STARSH_VER="1.22.1"
export FONT_VER="3.3.0"
export FONTS="Arimo.tar.xz FiraCode.tar.xz Inconsolata.tar.xz \
NerdFontsSymbolsOnly.tar.xz"
###############################################################################
# START INSTALLING
###############################################################################
# Start this section with an apt configuration
# Then install nala for speed and aptitude for dependency resolution
echo 'APT::Install-Recommends "false";
APT::AutoRemove::RecommendsImportant "false";
APT::AutoRemove::SuggestsImportant "false";' >/etc/apt/apt.conf.d/99_norecommends
echo 'APT::Periodic::Update-Package-Lists "false";
APT::Periodic::Download-Upgradeable-Packages "false";
APT::Periodic::AutocleanInterval "false";
APT::Periodic::Unattended-Upgrade "false";' >/etc/apt/apt.conf.d/10periodic
echo '# Modernized from /etc/apt/sources.list
Types: deb deb-src
URIs: http://deb.debian.org/debian/
Suites: unstable
Components: main contrib non-free-firmware non-free
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
# Modernized from /etc/apt/sources.list
Types: deb deb-src
URIs: http://deb.debian.org/debian/
Suites: experimental
Components: main contrib non-free-firmware non-free
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
' >/etc/apt/sources.list.d/debian.sources
apt update
apt -y install nala aptitude git aria2
# uv is a great tool for Python. Use the installer script:
curl -fsSL https://astral.sh/uv/install.sh | sh
# Replace UFW with firewalld then set rules:
nala purge --autoremove -y ufw
nala install -y firewalld
firewall-cmd --permanent --add-service={ssh,http,https}
systemctl reload firewalld
# Set up DNS over HTTPS:
nala install -y dnss
sed -i "s/^.*supersede domain-name-servers.*;/supersede domain-name-servers 127.0.0.1" /etc/dhcp/dhclient.conf
echo '[main]
plugins=ifupdown,keyfile
dns=127.0.0.1
rc-manager=unmanaged
[ifupdown]
managed=false
[device]
wifi.scan-rand-mac-address=no' >/etc/NetworkManager/NetworkManager.conf
# Configure dnss to use alternative servers on 9981:
echo '# dnss can be run in 3 different modes, depending on the flags given to it:
# DNS to HTTPS (default), DNS to GRPC, and GRPC to DNS.
# This variable controls the mode, and its parameters.
# The default is DNS to HTTPS mode, which requires no additional
# configuration. For the other modes, see dnss documentation and help.
MODE_FLAGS="--enable_dns_to_https"
# Flag to configure monitoring.
# By default, we listen on 127.0.0.1:9981, but this variable allows you to
# change that. To disable monitoring entirely, leave this empty.
MONITORING_FLAG="--monitoring_listen_addr=127.0.0.1:9981 --https://anycast.uncensoreddns.org/dns-query"
' >/etc/default/dnss
systemctl enable dnss
# Force DNS nameserver to 127.0.0.1 (for dnss):
echo '#!/bin/bash
# This script exists because there seems to be no config which prevents
# from trying to use Google servers, which are blocked in certain regions.
# stop the dnss daemon
systemctl stop dnss
# overwrite Network Managers auto-generated resolv.conf files
ADDR="nameserver 127.0.0.1"
DNS_SERV="91.239.100.100"
FILES=(/run/resolvconf/resolv.conf /run/resolvconf/interface/systemd-resolved /etc/resolv.conf)
IFACEDIR="/run/resolvconf/interfaces"
[[ -d "$IFACEDIR" ]] && rm -rf "$IFACEDIR"/*
for FILE in "${FILES[@]}";do
[[ -f "$FILE" ]] && echo "$ADDR" > $FILE
done
sleep 0.5
# start dnss socket
dnss --enable_dns_to_https -https_upstream https://"$DNS_SERV"/dns-query
' >/etc/network/if-up.d/zz-resolvconf
chmod +x /etc/network/if-up.d/zz-resolvconf
# Install wireguard-tools from the git mirror:
# https://github.com/WireGuard/wireguard-tools
# Clone the repo, cd into wireguard-tools/src, execute make && make install
(
git clone https://github.com/WireGuard/wireguard-tools
cd wireguard-tools/src || exit
make
make -j4 install
)
###############################################################################
# START OF GENERIC / CATBIRD PACKAGE INSTALLS (BASED ON DEBIAN WITH XFCE)
###############################################################################
# Map Caps Lock with ESC key (Get ESC when Caps Lock is pressed)
# Overwrite the file /etc/default/keyboard
echo '# KEYBOARD CONFIGURATION FILE
# Consult the keyboard(5) manual page.
XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS="terminate:ctrl_alt_bksp,caps:escape"
BACKSPACE="guess"
' >/etc/default/keyboard
# set x11 resolution:
echo 'Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
EndSection' >/etc/X11/xorg.conf.d/99-screen-resolution.conf
# set up the touchpad:
echo 'Section "InputClass"
Identifier "touchpad"
MatchIsTouchpad "on"
Driver "libinput"
Option "Tapping" "on"
Option "TappingButtonMap" "lrm"
Option "NaturalScrolling" "on"
Option "ScrollMethod" "twofinger"
EndSection' >/etc/X11/xorg.conf.d/90-touchpad.conf
# create the /etc/environment file
echo 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
LC_ALL="en_US.UTF-8"
LANG="en_US.UTF-8"
VISUAL="vi"
export VISUAL
EDITOR="$VISUAL"
export EDITOR
NO_AT_BRIDGE=1
NLTK_DATA="/usr/share/nltk_data"
export STARSHIP_CONFIG="/etc/xdg/starship/starship.toml"
PIPEWIRE_LATENCY=256/48000
export PIPEWIRE_LATENCY' >/etc/environment
# enforce sourcing of environmental variables
echo '# make sure key environmental variables are
# picked up in minimalist environments
[ -f /etc/profile ] && . /etc/profile
[ -f /etc/environment ] && . /etc/environmen
' >/etc/X11/Xsession.d/91x11_source_profile
# Set X11 to have a higher key repeat rate
echo '#!/bin/sh
exec /usr/bin/X -nolisten tcp -ardelay 400 -arinterval 17 "$@"
' >/etc/X11/xinit/xserverrc
# Install editors and other items:
PKGS="fzf ripgrep fd-find glow qalc gimp gimp-plugin-registry icc-profiles \
inkscape shotcut libreoffice libreoffice-gtk3 libreoffice-script-provider-python \
default-jre default-jre-headless ffmpeg lsp-plugins chrony pandoc pandoc-citeproc \
poppler-utils p7zip ruby-dev picom rng-tools-debian haveged irssi newsboat \
zathura zathura-ps zathura-djvu zathura-cb odt2txt atool w3m mediainfo parallel \
thunar thunar-volman ristretto libmpv2 mpv mplayer firmware-misc-nonfree \
firmware-iwlwifi firmware-brcm80211 firmware-intel-graphics firmware-intel-misc \
firmware-marvell-prestera firmware-mediatek firmware-nvidia-graphics meld \
gnome-screenshot gnome-keyring cmake libgtk-3-common audacity shellcheck shfmt \
luarocks black ruff tidy yamllint pypy3 dconf-editor net-tools blueman sqlite3 \
dbus-x11 obs-studio filezilla htop fastfetch tmux rofi proxychains4 sshuttle \
tor torsocks obfs4proxy snowflake-client seahorse surfraw surfraw-extra usbreset
squashfs-tools genisoimage syslinux-utils xorriso"
for PKG in $PKGS; do sudo apt -y install "$PKG"; done
# lsp-plugins should be hidden, but are not.
# append code in the launchers
sed -i '$aHidden=true' /usr/share/applications/in.lsp_plug*.desktop
# Note: use xfce4-appearance-settings to configure themes, icons, and fonts.
# get useful python tools:
PKGS="python3-numpy python3-scipy python3-sympy python3-bs4 python3-sql \
python3-pandas python3-html5lib python3-seaborn python3-matplotlib python3-pep8 \
python3-ruff python3-ijson python3-lxml python3-aiomysql python3-astropy \
python3-metpy python3-h5netcdf python3-h5py python3-pynvim python3-neovim \
python3-ipython python3-pygame python3-scrapy python3-metpy python3-pyaudio \
python3-selenium python3-venv python3-virtualenv python3-virtualenvwrapper \
python3-nltk python3-numba python3-mypy python3-xmltodict python3-dask \
python3-sqlalchemy"
for PKG in $PKGS; do sudo apt -y install "$PKG"; done
# use pip for packages not in the regular repos
# execute as a loop so broken packages don't break the whole process
PKGS="pandas-datareader \
polars duckdb sqlitebiter hq iq jq siphon sympad aria2p lastversion castero \
textblob vadersentiment jupyterlab jupyter-book jupyter-lsp jupytext \
cookiecutter bash_kernel ilua types-seaborn pandas-stubs sounddevice nomadnet \
rns lxmf chunkmuncher"
for PKG in $PKGS; do
python3 -m pip install --upgrade --break-system-packages "$PKG"
done
# use pip for a beta version:
#python3 -m pip install --upgrade --break-system-packages --pre <packagename>
# Install Nodejs and associated packages:
# read latest info: https://github.com/nodesource/distributions
NODE_MAJOR=22
curl -fsSL https://deb.nodesource.com/setup_$NODE_MAJOR.x -o nodesource_setup.sh
chmod +x nodesource_setup.sh
./nodesource_setup.sh
apt install -y nodejs
# Test with: nodejs --version
# Use npm as the node package manager.
PKGS="prettier @fsouza/prettierd eslint_d jsonlint markdownlint readability-cli"
for PKG in $PKGS; do npm install -g "$PKG"; done
# Update node and prune cruft with:
npm update -g
npm prune
# Install yarn if desired
# npm install -g yarn
# install golang
# IMPORTANT:
# Updating golang will cause deletions of these:
# gophernotes -- for Jupyterlab
# gofmt -- code formatter for Neovim
# See other notes for instructions to reinstall.
# The code below preserves current versions of gophernotes and gofmt
cp /usr/local/go/bin/{gofmt,gophernotes} /tmp/
wget -c "https://golang.org/dl/go1.21.1.linux-"$ARCH".tar.gz"
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.1.linux-"$ARCH".tar.gz
cp /tmp/{gofmt,gophernotes} /usr/local/go/bin/
# Add the following code to user's .profile:
# golang
# export GOROOT=/usr/local/go
# export GOPATH=$GOROOT
# export GOBIN=$GOPATH/bin
# export PATH=$PATH:$GOROOT
# Create symlink for gofmt
ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt
# Install Harper (English grammar checker)
(
cd "$working_dir" || exit
mkdir harper-ls
cd harper-ls || exit
wget -c https://github.com/Automattic/harper/releases/download/v"$HARP_VER"/harper-ls-"$ARCH2"-unknown-linux-gnu.tar.gz
tar -xvzf --overwrite harper-ls-"$ARCH2"-unknown-linux-gnu.tar.gz
chmod +x "$working_dir"/harper-ls/harper-ls
ln -sf "$working_dir"/harper-ls/harper-ls /usr/local/bin/harper-ls
)
# Install the latest Neovim
(
cd "$working_dir" || exit
wget -c https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-"$ARCH2".tar.gz
tar -xvzf --overwrite nvim-linux-"$ARCH2".tar.gz
cd nvim-linux-"$ARCH2" || exit
chown -R root:root ./*
cp bin/* /usr/bin/
cp -r share/{applications,icons,locale,man} /usr/share/
rsync -avhc --delete --inplace --mkpath lib/nvim/ /usr/lib/nvim/
rsync -avhc --delete --inplace --mkpath share/nvim/ /usr/share/nvim/
# Install the Neovim configuration
cd "$working_dir" || exit
git clone https://github.com/AB9IL/nvim-configs
cd nvim-configs || exit
rsync -avhc --delete --inplace --mkpath nvim-minimal/ /root/.config/nvim/
rsync -avhc --delete --inplace --mkpath nvim-minimal/ /etc/xdg/nvim/
rsync -avhc --delete --inplace --mkpath nvim/ /home/"$USERNAME"/.config/nvim/
chown -R "$USERNAME":"$USERNAME" /home/"$USERNAME"/.config/nvim/
# get some npm and perl nvim assets
npm install -g neovim
curl -L https://cpanmin.us | perl - App::cpanminus
cpanm Neovim::Ext
)
# Get dotfiles
printf "\nDownloading dot files"
(
cd "$working_dir" || exit
git clone https://github.com/AB9IL/Dotfiles
cd Dotfiles || exit
DIRS=".bashrc.d .w3m"
for DIR in $DIRS; do
cp -r "$DIR" /home/"$USERNAME"/
done
FILES=".bashrc .fzf.bash .inputrc .nanorc \
.vimrc .wgetrc .Xresources"
for FILE in $FILES; do
cp "$FILE" /home/"$USERNAME"/
done
FOLDERS="alacritty dconf castero dunst networkmanager-dmenu newsboat \
picom rofi tmux wezterm sxhkd systemd zathura"
for FOLDER in $FOLDERS; do
cp -r "$FOLDER" /home/"$USERNAME"/.config/"$FOLDER"
done
XDGFOLDERS="alacritty wezterm dunst"
for XDGFOLDER in $XDGFOLDERS; do
cp -r "$XDGFOLDER" /etc/xdg/"$XDGFOLDER"
done
)
# set up the menu / app launcher
printf "\n Setting up the menu / app launcher"
(
echo '#!/bin/bash
rofi -i \
-modi combi \
-show combi \
-combi-modi "window,drun" \
-display-drun "" \
-monitor -1 \
-columns 2 \
-show-icons \
-drun-match-fields "exec" \
' >/usr/bin/run-rofi
chmod +x /usr/bin/run-rofi
)
# install nerd fonts
(
printf "\nInstalling Nerd Fonts"
cd "$working_dir" || exit
for FONTPKG in $FONTS; do
aria2c -x5 -s5 \
https://github.com/ryanoasis/nerd-fonts/releases/download/v"$FONT_VER"/"$FONTPKG"
tar -xvJf "$FONTPKG" -C /usr/share/fonts/truetype
rm "$FONTPKG"
done
fc-cache -fv
)
# install the git updater
(
cd "$working_dir" || exit
git clone https://github.com/AB9IL/Updater-for-Gits-Etc
chmod +x Updater-for-Gits-Etc/getgits.sh
ln -sf "$working_dir"/Updater-for-Gits-Etc/getgits.sh \
"$working_dir"/getgits.sh
)
###############################################################################
# END OF GENERIC / CATBIRD PACKAGE INSTALLS
###############################################################################
###############################################################################
# CONFIGURE JUPYTERLAB
###############################################################################
# NLTK needs extra data to work. Get it by using the Python REPL:
# >>> import nltk
# >>> nltk.download()
# Navigate through the download settings:
# d) Download --> c) Config -->
# d) Set Data Dir ) and set the data download directory to
# "/usr/share/nltk_data" then ( m) Main Menu --> q) Quit )
# >>> nltk.download('popular')
# >>> nltk.download('vader_lexicon')
# Textblob is also an NLP tool.
# For selenium, get the Firefox (gecko) webdriver from:
# https://github.com/mozilla/geckodriver
# The latest chromedriver can be downloaded from
# https://googlechromelabs.github.io/chrome-for-testing/
# Keep the actual executable at /usr/local/src/chromedriver-linux64/chromedriver
# and symlink to /usr/bin/chromedriver
# Check either driver by calling with the --version argument
# The path is FUBAR for each of {flake8,isort,yapf}:
# Fixed with wrappers (little bash scripts which execute the Python):
# /usr/local/bin/flake8 containing "python -m flake8"
# /usr/local/bin/isort containing "python -m isort"
# /usr/local/bin/yapf containing "python -m yapf"
# The Bash kernel is in package bash_kernel
# Complete insallation with:
python3 -m bash_kernel.install
# The Lua kernel is in package ilua
# Just pip install; no further action needed
# Add go kernel to jupyterlab
# use gophernotes, placed binary in /usr/local/go/bin/
# kernel files in /usr/local/share/jupyter/kernels/gophernotes
# kernel.json has full path to the gophernotes binary
mkdir -p "$(go env GOPATH)"/src/github.com/gopherdata
(
cd "$(go env GOPATH)"/src/github.com/gopherdata || exit
git clone https://github.com/gopherdata/gophernotes
cd gophernotes || exit
git checkout -f v0.7.5
go install
mkdir -p ~/.local/share/jupyter/kernels/gophernotes
cp kernel/* ~/.local/share/jupyter/kernels/gophernotes
cd ~/.local/share/jupyter/kernels/gophernotes || exit
chmod +w ./kernel.json # in case copied kernel.json has no write permission
sed "s|gophernotes|$(go env GOPATH)/bin/gophernotes|" <kernel.json.in >kernel.json
)
# Add typescript and javascript kernels to Jupyterlab
npm install -g tslab
tslab install --python=python3
# As desired, verify that the kernels are installed
# jupyter kernelspec list
# Remove redundant ijavascript Kernel
npm uninstall -g --unsafe-perm ijavascript
npm uninstall ijavascript
# Add language server extension to Jupyterlab
python3 -m pip install jupyter-lsp
# old method (deprecated): jupyter labextension install @krassowski/jupyterlab-lsp
# old method (deprecated): jupyter labextension uninstall @krassowski/jupyterlab-lsp
# If installed, remove unified-language-server, vscode-html-languageserver-bin
# After finishing all other work on Jupyterlab, rebuild it.
jupyter-lab build
################################################################################
# WINDOW MANAGERS
###############################################################################
# Remove xfce, bloat, and some Wayland apps I had installed...
# Don't replace lightdm with sddm (draws in too much KDE)
PKGS="lightdm* liblightdm* lightdm-gtk-greeter light-locker sddm* gdm xfce* \
libxfce* xfburn xfconf xfdesktop4 parole sway swaybg waybar greybird-gtk-theme \
yelp timeshift dosbox grsync remmina wofi kwayland geoclue* \
gnome-accessibility-themes gnome-desktop3-data gnome-icon-theme gnome-menus \
gnome-settings-daemon gnome-settings-daemon-common gnome-system* systemsettings"
for PKG in $PKGS; do sudo apt -y autoremove --purge "$PKG"; done
# For Wayland / Sway
# Sway Components to install:
# sway swaybg sway-notification-center waybar xwayland nwg-look
# For screenshots in Sway:
# Get the grimshot script
# https://github.com/swaywm/sway/blob/master/contrib/grimshot
# apt install grim slurp
# Make the clipboard functional
# apt install wl-clipboard clipman
# Here is some sway config code:
# configure clipboard functions:
# exec wl-paste -t text --watch clipman store
# exec wl-paste -p -t text --watch clipman store -P --histpath="~/.local/share/clipman-primary.json"
# acces the history with a keybind:
# bindsym $mod+h exec clipman pick -t wofi
# clear the clipboard with:
# bindsym Sshift+$mod+h exec clipman clear --all
###############################################################################
# For Awesomewm:
# nala install -y awesome awesome-extra
###############################################################################
# For DWM:
# install dependencies DWM and the patches
# apt install libxft-dev libx11-dev libxinerama-dev libxcb-xkb-dev \
# libx11-xcb-dev libxcb-res0-dev libxcb-xinerama0
# install DWM
# Download the latest release from suckless.org and extract it.
# Place the folder in /usr/local/src
# patch DWM
# example command: patch -p1 < dwm-my-new-patch.diff
# actual patches used:
# alwayscenter
# attachbottom
# pertag
# scratchpads
# swallow
# vanity gaps
### USE DWM-FLEXIPATCH ###
# After getting the patches to work well together, save a
# diff file for these:
# config.def.h
# config.mk
# patches.def.h
#
#
# Here is a command to save the patch:
# (one file) diff -u orig.config.def.h latest.config.def.h > config.patch
# (directories) diff -rubN original/ new/ > rockdove.patch
# Uncomment some lines in config.mk:
# # uncomment near line 32:
# XRENDER = -lXrender
# # uncomment near line 49
# XCBLIBS = -lX11-xcb -lxcb -lxcb-res
# Make the binary with: rm config.h; make clean; make
# A complete DWM setup is available through git:
(
cd "$working_dir" || exit
git clone https://github.com/AB9IL/dwm-flexipatch
git clone https://github.com/AB9IL/dwm-bar
# Simlink the dwm binary to /usr/local/bin/dwm
ln -sf "$working_dir"/dwm-flexipatch/dwm /usr/local/bin/dwm
)
# Install the .profile and .xinitrc files
(
cd "$working_dir"/Dotfiles || exit
FILES=".profile .xinitrc"
for FILE in $FILES; do
cp "$FILE" /home/"$USERNAME"/
done
)
# Configure some systemd items as necessary
# Check the default target with:
systemctl get-default
# If it is "geaphical.target" then set it to "multiuser.target":
# systemctl set-default multi-user.target
# For X11 window managers, create a systemd unit file to reliably start X
echo '[Unit]
Description=Start X11 for the user
After=network.target
[Service]
Environment=DISPLAY=:0
ExecStart=/usr/bin/startx %h/.xinitrc
Restart=on-failure
[Install]
WantedBy=default.target
' >/etc/systemd/user/startx.service
# Create the enabling symlink for the normal user:
mkdir -p /home/"$USERNAME"/.config/systemd/user/default.target.wants
ln -sf /etc/systemd/user/startx.service \
/home/"$USERNAME"/.config/systemd/user/default.target.wants/startx.service
# Alternatively, as the normal user (not root or sudo):
# reload the daemon, enable, and activate
# systemctl --user daemon-reload
# systemctl --user enable startx.service
# systemctl --user start startx.service
# make sure the user owns newly created items in the home folder
chown -R "$USERNAME":"$USERNAME" /home/"$USERNAME"
###############################################################################
# END WINDOW MANAGERS
###############################################################################
#set the cpu governor
echo 'GOVERNOR="performance"' >/etc/default/cpufrequtils
# configure rng-tools
sed -i "11s/.*/HRNGDEVICE=/dev/urandom/" /etc/default/rng-tools
# configure rng-tools-debian
sed -i "s|^.*\#HRNGDEVICE=/dev/null|HRNGDEVICE=/dev/urandom/|" /etc/default/rng-tools-debian
# Performance tuning settings in sysctl:
echo 'fs.file-max = 51200
vm.swappiness = 10
vm.dirty_ratio = 50
vm.dirty_background_ratio = 5
vm.vfs_cache_pressure = 100
vm.max_map_count = 1048576' >/etc/sysctl.d/98_system-tuning.conf
echo 'net.core.somaxconn = 4096
net.core.netdev_max_backlog = 50000
net.core.rmem_default = 16777216
net.core.rmem_max = 31457280
net.core.wmem_default = 16777216
net.core.wmem_max = 31457280
net.ipv4.tcp_window_scaling=1
net.ipv4.ip_local_port_range = 10240 65535
net.ipv4.icmp_echo_ignore_all = 1
net.ipv4.tcp_wmem = 16384 12582912 16777216
net.ipv4.udp_wmem_min = 16384
net.ipv4.udp_rmem = 16384 12582912 16777216
net.ipv4.udp_rmem_min = 16384
net.ipv4.tcp_max_syn_backlog = 8096
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_low_latency = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_congestion_control = bbr
' >/etc/sysctl.d/99_network-tuning.conf
# configure chrony for better performance
# comment out lines in chrony config
sed -i 's|^pool 2.debian|#pool 2.debian|; \
s|^sourcedir /run/chrony-dhcp|#sourcedir /run/chrony-dhcp|' \
/usr/share/chrony/chrony.conf
echo '# Enable hardware timestamping on all compatible interfaces.
hwtimestamp *' >/etc/chrony/conf.d/99_custom-settings.conf
echo 'pool 0.pool.ntp.org iburst minpoll 4 maxpoll 10 maxsources 3 xleave extfield F323 extfield F324
pool 1.pool.ntp.org iburst minpoll 4 maxpoll 10 maxsources 3 xleave extfield F323 extfield F324
pool 2.pool.ntp.org iburst minpoll 4 maxpoll 10 maxsources 3 xleave extfield F323 extfield F324
pool 3.pool.ntp.org iburst minpoll 4 maxpoll 10 maxsources 3 xleave extfield F323 extfield F324
' >/etc/chrony/sources.d/ntp-server.sources
# Create a script for items to set up during boot time:
echo '#!/bin/bash
# usbfs memory
echo 0 > /sys/module/usbcore/parameters/usbfs_memory_mb
# set clocksource
# Note: timer freqs in /etc/sysctl.conf
echo "tsc" > /sys/devices/system/clocksource/clocksource0/current_clocksource
#configure for realtime audio
echo '@audio - rtprio 95
@audio - memlock 512000
@audio - nice -19' > /etc/security/limits.d/10_audio.conf
' >/usr/sbin/startup-items
# make the script executable:
chmod +x /usr/sbin/startup-items
# Set up a a systemd unit for startup-items:
echo '[Unit]
Description=Startup Items and Debloat Services
After=getty.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/startup-items
[Install]
WantedBy=default.target
' >/etc/systemd/system/startup-items.service
# Enable by creating a symlink to the unit (accomplish manually or with systemctl enable <unit name>)
ln -sf /etc/systemd/user/startup-items.service \
/etc/systemd/system/default.target.wants/startup-items.service
# Create a script to accomplish tasks immediately prior to
# starting the graphical environment.
echo '#!/bin/bash
# copy skel to home because live build stopped doing it
cp -r /etc/skel/. /home/user/
chown -R user:user /home/user
# fix a potential driver issue causing xserver to fail
setcap CAP_SYS_RAWIO+eip /usr/lib/xorg/Xorg
' >/usr/sbin/session-items
# Create a systemd service for session-itsms:
echo '[Unit]
Description=Session-items before window manager
After=multi-user.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/session-items
[Install]
WantedBy=default.target
' >/etc/systemd/system/session-items.service
# Enable by creating a symlink to the unit (accomplish manually or with systemctl enable <unit name>)
ln -sf /etc/systemd/user/session-items.service \
/etc/systemd/system/default.target.wants/session-items.service
# Move some environmental variables out of ~/.profile and into the realm
# of systemd:
mkdir -p /etc/systemd/user/environment.d
echo '[User]
Environment="BROWSER=x-www-browser"
Environment="BROWSERCLI=w3m"
Environment="PISTOL_CHROMA_FORMATTER=terminal256"
Environment="JAVA_HOME=/usr/lib/jvm/default-java"
Environment="PIPEWIRE_LATENCY=256/48000"
' >/etc/systemd/user/environment.d/environment.conf
# Note that these are persistent, not reset on user login.
# The systemd units listed above are helpful, but the pivotal change was
# resetting the default target away from "graphical.target" and back to
# "multi-user.target" since we do not run a display manager.
#
# Check the default target with:
# systemctl get-default
# If it is "geaphical.target" then set it to "multiuser.target":
# systemctl set-default multi-user.target
###############################################################################
# INSTALL ACCESSORIES
###############################################################################
printf "\nInstalling some accessories"
# Do most of the work from /usr/local/src
cd "$working_dir" || exit
# install obsidian
printf "\nInstalling Obsidian"
(
aria2c -x5 -s5 \
https://github.com/obsidianmd/obsidian-releases/releases/download/v"$OBSIDIAN_VER"/obsidian_"$OBSIDIAN_VER"_"$ARCH".deb
dpkg -i obsidian*.deb
rm obsidian*.deb
)
# apt install brightnessctl light
# install pipewire
# See the guide: https://trendoceans.com/install-pipewire-on-debian-11/
nala install -y pipewire pipewire-audio-client-libraries pipewire-jack
# Setting up Wezterm as the main terminal emulator:
# - create a new alternative for x-terminal-emulator
# update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/wezterm 60
# - then:
# update-alternatives --config editor
# - Select "wezterm" (not "open-wezterm-here"
# - use either syntax to launch apps in the terminal:
# x-terminal-emulator -e <app-command>
# x-terminal-emulator start -- <app-cammand>
# Install Rclone
printf "\nInstalling rclone"
(
cd "$working_dir" || exit
curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip -d rclone-current-linux-amd64
rm rclone-current-linux-amd64.zip
cd rclone-current-linux-amd64 || exit
cp rclone /usr/bin/
chmod 755 /usr/bin/rclone
mkdir -p /usr/local/share/man/man1
cp rclone.1 /usr/local/share/man/man1/
mandb
)
# Install rclone Browser
# AppImage: https://github.com/kapitainsky/RcloneBrowser
# ( https://github.com/kapitainsky/RcloneBrowser/releases/download/1.8.0/rclone-browser-1.8.0-a0b66c6-linux-"$ARCH2".AppImage )
###############################################################################
# FLATPAK - PACSTALL - MAKEDEB
###############################################################################
printf "\nInstalling alternative software installers: Flatpak / Pacstall / Makedeb"
# Install Flatpak
apt install flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# Install Pacstall
# bash -c "$(curl -fsSL https://pacstall.dev/q/install)"
# Optional: install makedeb and get software from makedeb.org
# Must install and make debs as normal user
# You may install the deb packages as root
# bash -ci "$(wget -qO - 'https://shlink.makedeb.org/install')"
# rsynced catbird nvim with debian nvim
# Install the Python support for Neovim:
# apt install python3-neovim python3-pynvim
# (use pip if the repos don't have them)
#
# Install Ruby support for Neovim:
# gem install neovim
#
# Set up Perl support for Neovim:
# curl -L https://cpanmin.us | perl - App::cpanminus
# cpanm Neovim::Ext;
#
# for Lua formatting, install Stylua binary from:
# https://github.com/JohnnyMorganz/Stylua/releases
#
# - get luacheck: apt install luarocks; luarocks install luacheck
# - get shellcheck and shfmt: apt install shellcheck shfmt
# - get black, python3-ruff, and ruff: apt install black python3-ruff ruff
# - get markdownlint: apt install ruby-mdl
# - get golangci_lint: https://github.com/golangci/golangci-lint/releases/
# Install Brave Browser
printf "\nInstalling Brave Browser"
# The deb package is available on GitHub: https://github.com/brave/brave-browser/releases
curl -fsSLo /usr/share/keyrings/brave-browser-beta-archive-keyring.gpg https://brave-browser-apt-beta.s3.brave.com/brave-browser-beta-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-beta-archive-keyring.gpg] https://brave-browser-apt-beta.s3.brave.com/ stable main" | tee /etc/apt/sources.list.d/brave-browser-beta.list
apt update
apt install -y brave-browser-beta
# Plugins for GIMP
# Install GMIC and Elsamuko scripts and GIMP plugins!
# Note: may need a workaround because gimp-gmic cannot be installed
# Install LinuxBeaver's GEGL plugins for GIMP
# Download, extract, and copy to proper directory as per instructions.
# Install Cyan (converts CMYK color profiles better than GIMP)
(
cd "$working_dir" || exit
aria2c -x5 -s5 \
https://github.com/rodlie/cyan/releases/download/"$CYAN_VER"/Cyan-"$CYAN_VER"-Linux-"$ARCH2".tgz
tar -xvzf --overwrite Cyan*.tgz
mv Cyan*/* cyan/
rm -r Cyan*
chmod +x cyan/Cyan
ln -sf "$working_dir"/cyan/Cyan \
/usr/local/bin/Cyan
)
# Install Lazygit
(
cd "$working_dir" || exit
mkdir lazygit
aria2c -x5 -s5 \
https://github.com/jesseduffield/lazygit/releases/download/v"$LAZYGIT_VER"/lazygit_"$LAZYGIT_VER"_Linux_"$ARCH2".tar.gz
tar -xvzf --overwrite lazygit_* -C lazygit/
rm lazygit_*.tar.gz
chmod +x lazygit/lazygit
ln -sf "$working_dir"/lazygit/lazygit \
/usr/local/bin/lazygit
)
# Install Reticulum Meshchat
printf "\nInstalling Reticulum Meshchat"
# The meshchat appimage is large - over 150 MB !!
# Consider the CLI option for meshchat:
# https://github.com/liamcottle/reticulum-meshchat
mkdir /opt/reticulum
(
cd /opt/reticulum || exit
aria2c -x5 -s5 \
https://github.com/liamcottle/reticulum-meshchat/releases/download/"$MeshChatVersion"/ReticulumMeshChat-"$MeshChatVersion"-linux.AppImage
chmod +x ReticulumMeshChat*
)
# create a meshchat launcher:
echo '[Desktop Entry]
Type=Application
Name=Reticulum Meshchat
GenericName=Reticulum Mesh Chat
Comment=Mesh network communications powered by the Reticulum Network Stack.
Exec=/opt/reticulum/ReticulumMeshChat.AppImage
Icon=reticulum-meshchat.ico
Terminal=false
Categories=Network;
Keywords=network;chat;meshchat;meshnet;
' >/home/"$USERNAME"/.local/share/applications/reticulum-meshchat.desktop
# Install Python-tgpt
printf "\nInstalling Python-tgpt"
# Reference https://pypi.org/project/python-tgpt/
# Manually delete the old tgpt symlink and binary.
# Use uv pip install and set a virtual environment in /opt.
mkdir /opt/python-tgpt
uv venv /opt/python-tgpt
# edit /opt/python-tgpt/pyenv.cfg to allow use of system site packages:
sed -i "s/include-system-site-packages = false/include-system-site-packages = true/" /opt/python-tgpt/pyenv.cfg
# Install the radiostreamer and create a launcher
printf "\nInstalling the Internet Radio Streamer"
(
cd "$working_dir" || exit
git clone https://github.com/AB9IL/radiostreamer
chmod +x "$working_dir"/radiostreamer/radiostreamer
chmod 664 "$working_dir"/radiostreamer/radiostreams
ln -sf "$working_dir"/radiostreamer/radiostreamer /usr/local/bin/radiostreamer
ln -sf "$working_dir"/radiostreamer/radiostreams /home/"$USERNAME"/.config/radiostreams
# create a radiostreamer launcher:
echo '[Desktop Entry]
Version=1.0
Name=Internet Radio Playlist
GenericName=Internet Radio Playlist
Comment=Open an internet radio stream
Exec=radiostreamer gui
Icon=radio-icon
Terminal=false
Type=Application
Categories=AudioVideo;Player;Recorder;Network
' >/home/"$USERNAME"/.local/share/applications/radiostreamer.desktop
)
# Install networkmanager-dmenu