From 0e25c1b65ad653d2897990abc804a5c75fe35be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 15:05:34 -0400 Subject: [PATCH 01/32] Create `setup-env` https://gist.github.com/Rudxain/68ff980299a91b83b8a366c760f62cad --- setup-env | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 setup-env diff --git a/setup-env b/setup-env new file mode 100644 index 00000000000..43a0226d7e9 --- /dev/null +++ b/setup-env @@ -0,0 +1,41 @@ +#!/bin/bash +set -euf + +readonly HELP='$1 must be a path to a file +that contains old output from: +`apt-mark showmanual` +' + +if [[ $# -lt 1 ]] +then + printf '%s' "$HELP" + exit 1 +fi +readonly pack_ls="$(cat -- "$1")" + +# to reduce time between auto-marking & installing, +# we must config now +echo \ +'APT::Install-Recommends "0"; +APT::Install-Suggests "0";' \ +>> "${PREFIX:-}/etc/apt/apt.conf" +# Termux compatibility + +# cleanup +apt-mark auto \* + +apt update + +# mark manual if existent. +# "--" for extra safety +apt -y install -- $pack_ls + +# depends on: +# https://gist.github.com/Rudxain/2c4ac0ce7702da82da04707339c46a9c +apt-mark auto $(dpkg-list-essential) +# more cleanup, just-in-case +apt-mark -y minimize-manual + +apt -y autopurge + +apt -y upgrade From eb230440217ad180b215766caaf57eba3614392d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 15:12:46 -0400 Subject: [PATCH 02/32] explain `setup-env` --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index cb6029ab754..487fb934a27 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,11 @@ You can use `~/.sh/extra` (POSIX) and `~/.bash_extra` to: - override settings, fns, aliases, etc..., essentially treating the repo as a default. - it's probably better to [fork this repo](https://github.com/Rudxain/dotfiles/fork) instead +## Distro Setup +`setup-env` script isn't necessary, but if you're setting-up a clean install of a Debian-based distro it'll be handy. + +I'm considering switching to NixOS, to make this process seamless + ## Install > [!warning] > Review the code and remove things you don't want or need. From 63b19fe5f3d4d14b194d8d223d4352d33968a83a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 15:16:33 -0400 Subject: [PATCH 03/32] exclude `setup-env` in `install` --- install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install b/install index 7e19cde6f43..e51709f32b0 100755 --- a/install +++ b/install @@ -7,7 +7,8 @@ do_it() { rsync \ --exclude '.git/' \ --exclude '.gitattributes' \ - --exclude 'bootstrap.sh' \ + --exclude 'setup-env' \ + --exclude 'install' \ --exclude 'README.md' \ --exclude 'LICENSE' \ -avh --no-perms . ~ From af14f57b24bb20c2963d4f1392fdddcfb5805ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 15:18:20 -0400 Subject: [PATCH 04/32] exclude `setup-env` in min-deps --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 487fb934a27..5f02f4910e7 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Non-Termux: ```sh cd curl -#L https://github.com/Rudxain/dotfiles/tarball/main | \ -tar -xzv --strip-components 1 --exclude={.termux,bin/termux-\*,.gitattributes,install,README.md,LICENSE} \ +tar -xzv --strip-components 1 --exclude={.termux,bin/termux-\*,.gitattributes,setup-env,install,README.md,LICENSE} \ && . .profile ``` @@ -53,7 +53,7 @@ Termux: ```sh cd curl -#L https://github.com/Rudxain/dotfiles/tarball/main | \ -tar -xzv --strip-components 1 --exclude={.gitattributes,install,README.md,LICENSE} \ +tar -xzv --strip-components 1 --exclude={.gitattributes,setup-env,install,README.md,LICENSE} \ && . .profile ``` From f712f4321d19581bac19f0317c83393e7fdefd62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 15:48:18 -0400 Subject: [PATCH 05/32] Create `etc_path.sh` --- etc_path.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 etc_path.sh diff --git a/etc_path.sh b/etc_path.sh new file mode 100644 index 00000000000..3e1422967c0 --- /dev/null +++ b/etc_path.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Android +if [ -d /system/bin ]; then + PATH="$PATH:/system/bin" +fi + +if [ -d "${PREFIX=/usr}/local/bin" ]; then + PATH="$PATH:${PREFIX=/usr}/local/bin" +fi + +export PATH From af18e2893efac4c112ca2722eac08cb8fe0e41ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 15:50:50 -0400 Subject: [PATCH 06/32] rm Android bin in `.sh/path` Now the user path exclusively contains user stuff --- .sh/path | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.sh/path b/.sh/path index e492be3ab2b..433dd06238b 100644 --- a/.sh/path +++ b/.sh/path @@ -1,8 +1,4 @@ #!/bin/sh -# Android -if [ -d /system/bin ]; then - PATH="$PATH:/system/bin" -fi if [ -d "$HOME/bin" ]; then PATH="$HOME/bin:$PATH" From 25cf93b6d1e297252ec7f727550c52c379f84965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 15:59:54 -0400 Subject: [PATCH 07/32] avoid assigning to `PREFIX` in `etc_path.sh` --- etc_path.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc_path.sh b/etc_path.sh index 3e1422967c0..41ad0305aed 100644 --- a/etc_path.sh +++ b/etc_path.sh @@ -5,7 +5,7 @@ if [ -d /system/bin ]; then PATH="$PATH:/system/bin" fi -if [ -d "${PREFIX=/usr}/local/bin" ]; then +if [ -d "${PREFIX:-/usr}/local/bin" ]; then PATH="$PATH:${PREFIX=/usr}/local/bin" fi From f19c3bbeb3992beac8ab60ad71c8feed02f41dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 16:36:44 -0400 Subject: [PATCH 08/32] =?UTF-8?q?forgor=20=F0=9F=92=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- etc_path.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc_path.sh b/etc_path.sh index 41ad0305aed..cd1168a8c1b 100644 --- a/etc_path.sh +++ b/etc_path.sh @@ -6,7 +6,7 @@ if [ -d /system/bin ]; then fi if [ -d "${PREFIX:-/usr}/local/bin" ]; then - PATH="$PATH:${PREFIX=/usr}/local/bin" + PATH="$PATH:${PREFIX:-/usr}/local/bin" fi export PATH From 5ffdeeae71dcd40f136588628880eb5eb8ab4fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 16:56:02 -0400 Subject: [PATCH 09/32] setup moves etc_path.sh to profile.d --- setup-env | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup-env b/setup-env index 43a0226d7e9..8c059c0482a 100644 --- a/setup-env +++ b/setup-env @@ -39,3 +39,8 @@ apt-mark -y minimize-manual apt -y autopurge apt -y upgrade + +mv etc_path.sh "${PREFIX:-}/etc/profile.d/" + + + From c338c5fed8c70553198e699df5d09914cada244e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 16:57:04 -0400 Subject: [PATCH 10/32] Rename setup-env to setup-distro/main --- setup-env => setup-distro/main | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename setup-env => setup-distro/main (100%) diff --git a/setup-env b/setup-distro/main similarity index 100% rename from setup-env rename to setup-distro/main From 1d8e3156316e102f9627f5417fad510d57a50125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 16:59:01 -0400 Subject: [PATCH 11/32] Rename etc_path.sh to setup-distro/path.sh --- etc_path.sh => setup-distro/path.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename etc_path.sh => setup-distro/path.sh (100%) diff --git a/etc_path.sh b/setup-distro/path.sh similarity index 100% rename from etc_path.sh rename to setup-distro/path.sh From a8b196031fc3417575b8f187e32b7a735796d6fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 17:00:41 -0400 Subject: [PATCH 12/32] Update setup --- setup-distro/main | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-distro/main b/setup-distro/main index 8c059c0482a..bfd76d510a2 100644 --- a/setup-distro/main +++ b/setup-distro/main @@ -40,7 +40,7 @@ apt -y autopurge apt -y upgrade -mv etc_path.sh "${PREFIX:-}/etc/profile.d/" +mv path.sh "${PREFIX:-}/etc/profile.d/" From ecafad6727b0ee52d4997670ccf85888843747c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 17:06:30 -0400 Subject: [PATCH 13/32] setup shouldn't be explained in root `README` --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 5f02f4910e7..3b20c8787a2 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,6 @@ You can use `~/.sh/extra` (POSIX) and `~/.bash_extra` to: - override settings, fns, aliases, etc..., essentially treating the repo as a default. - it's probably better to [fork this repo](https://github.com/Rudxain/dotfiles/fork) instead -## Distro Setup -`setup-env` script isn't necessary, but if you're setting-up a clean install of a Debian-based distro it'll be handy. - -I'm considering switching to NixOS, to make this process seamless - ## Install > [!warning] > Review the code and remove things you don't want or need. From 16915ab053ad40e158c54dfa941abd3ee91b18b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 16 May 2024 17:12:16 -0400 Subject: [PATCH 14/32] Create README.md for setup --- setup-distro/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 setup-distro/README.md diff --git a/setup-distro/README.md b/setup-distro/README.md new file mode 100644 index 00000000000..06a824b96b0 --- /dev/null +++ b/setup-distro/README.md @@ -0,0 +1,3 @@ +This sub-repo isn't necessary, but if you're setting-up a clean install of a Debian-based distro it'll be very convenient. + +I'm considering switching to NixOS, to make this process seamless From f2632a720dd0f454f12fe269d223edfdec23e972 Mon Sep 17 00:00:00 2001 From: rudxain Date: Thu, 16 May 2024 17:16:58 -0400 Subject: [PATCH 15/32] exclude `setup-distro` on `install` & min-deps --- README.md | 4 ++-- install | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3b20c8787a2..ed9af4e91ce 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Non-Termux: ```sh cd curl -#L https://github.com/Rudxain/dotfiles/tarball/main | \ -tar -xzv --strip-components 1 --exclude={.termux,bin/termux-\*,.gitattributes,setup-env,install,README.md,LICENSE} \ +tar -xzv --strip-components 1 --exclude={.termux,bin/termux-\*,.gitattributes,setup-distro,install,README.md,LICENSE} \ && . .profile ``` @@ -48,7 +48,7 @@ Termux: ```sh cd curl -#L https://github.com/Rudxain/dotfiles/tarball/main | \ -tar -xzv --strip-components 1 --exclude={.gitattributes,setup-env,install,README.md,LICENSE} \ +tar -xzv --strip-components 1 --exclude={.gitattributes,setup-distro,install,README.md,LICENSE} \ && . .profile ``` diff --git a/install b/install index e51709f32b0..4af7decda2d 100755 --- a/install +++ b/install @@ -7,7 +7,7 @@ do_it() { rsync \ --exclude '.git/' \ --exclude '.gitattributes' \ - --exclude 'setup-env' \ + --exclude 'setup-distro' \ --exclude 'install' \ --exclude 'README.md' \ --exclude 'LICENSE' \ From f085a066267095fce00a788345dff990f36347bd Mon Sep 17 00:00:00 2001 From: rudxain Date: Thu, 16 May 2024 17:26:47 -0400 Subject: [PATCH 16/32] fix perms --- bin/termux-url-opener | 0 setup-distro/main | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/termux-url-opener mode change 100644 => 100755 setup-distro/main diff --git a/bin/termux-url-opener b/bin/termux-url-opener old mode 100644 new mode 100755 diff --git a/setup-distro/main b/setup-distro/main old mode 100644 new mode 100755 From 6baf52ad932e633da94fe0355ef161a0b999de57 Mon Sep 17 00:00:00 2001 From: rudxain Date: Thu, 16 May 2024 18:53:07 -0400 Subject: [PATCH 17/32] add purge-retro. warn about non-idemp --- setup-distro/README.md | 8 +++++++- setup-distro/apt-purge-retro | 2 ++ setup-distro/main | 7 ++++--- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100755 setup-distro/apt-purge-retro diff --git a/setup-distro/README.md b/setup-distro/README.md index 06a824b96b0..4c385cd0b9e 100644 --- a/setup-distro/README.md +++ b/setup-distro/README.md @@ -1,3 +1,9 @@ This sub-repo isn't necessary, but if you're setting-up a clean install of a Debian-based distro it'll be very convenient. -I'm considering switching to NixOS, to make this process seamless +I'm considering switching to NixOS, to make this process seamless. + +> [!warning] +> `main` isn't idempotent! +> You should only run it once. +> +> I'm considering to make it idempotent by default, with an opt-in flag to use old behavior diff --git a/setup-distro/apt-purge-retro b/setup-distro/apt-purge-retro new file mode 100755 index 00000000000..213f01b6539 --- /dev/null +++ b/setup-distro/apt-purge-retro @@ -0,0 +1,2 @@ +#!/bin/sh +apt-get purge $(dpkg -l | grep \^rc | awk '{print $2}') diff --git a/setup-distro/main b/setup-distro/main index bfd76d510a2..f6b6d243438 100755 --- a/setup-distro/main +++ b/setup-distro/main @@ -41,6 +41,7 @@ apt -y autopurge apt -y upgrade mv path.sh "${PREFIX:-}/etc/profile.d/" - - - +mv apt-purge-retro "${PREFIX:-/usr}/local/bin/" +# are these needed? +#chmod 755 apt-purge-retro +#chown root:root apt-purge-retro From 8318df31e7e108602d3dc168202728df09db2183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Sat, 25 May 2024 04:15:13 -0400 Subject: [PATCH 18/32] Create Enable_AppArmor --- setup-distro/Enable_AppArmor | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 setup-distro/Enable_AppArmor diff --git a/setup-distro/Enable_AppArmor b/setup-distro/Enable_AppArmor new file mode 100644 index 00000000000..ba2c1f7aa4c --- /dev/null +++ b/setup-distro/Enable_AppArmor @@ -0,0 +1,9 @@ +#!/bin/sh +set -euf +# https://wiki.debian.org/AppArmor/HowToUse#Enable_AppArmor +sudo mkdir -p /etc/default/grub.d +echo 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT apparmor=1 security=apparmor"' \ + | sudo tee /etc/default/grub.d/apparmor.cfg +sudo update-grub +# user should choose when to do so +#sudo reboot From 165add938c8e321b26a4ecb798cc9083993584c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Sat, 25 May 2024 04:19:32 -0400 Subject: [PATCH 19/32] enable AA end main --- setup-distro/main | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup-distro/main b/setup-distro/main index f6b6d243438..ee36a801962 100755 --- a/setup-distro/main +++ b/setup-distro/main @@ -45,3 +45,5 @@ mv apt-purge-retro "${PREFIX:-/usr}/local/bin/" # are these needed? #chmod 755 apt-purge-retro #chown root:root apt-purge-retro + +./Enable_AppArmor From 511a3566cf4b11d96e7d8238d767f2ec7e524e39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Sat, 25 May 2024 04:22:05 -0400 Subject: [PATCH 20/32] Create `dpkg-list-essential` https://gist.github.com/Rudxain/2c4ac0ce7702da82da04707339c46a9c --- setup-distro/dpkg-list-essential | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 setup-distro/dpkg-list-essential diff --git a/setup-distro/dpkg-list-essential b/setup-distro/dpkg-list-essential new file mode 100644 index 00000000000..c18255f1524 --- /dev/null +++ b/setup-distro/dpkg-list-essential @@ -0,0 +1,6 @@ +#!/bin/sh +set -euf + +dpkg-query -Wf '${Package;-40}${Essential}\n' \ +| grep yes \ +| awk '{print $1}' From e996b3a9549ae1d5eb9a674754e65ebfe1cb8c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Sat, 25 May 2024 04:26:40 -0400 Subject: [PATCH 21/32] use local ls-essential --- setup-distro/main | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup-distro/main b/setup-distro/main index ee36a801962..c319e0a25b4 100755 --- a/setup-distro/main +++ b/setup-distro/main @@ -30,9 +30,7 @@ apt update # "--" for extra safety apt -y install -- $pack_ls -# depends on: -# https://gist.github.com/Rudxain/2c4ac0ce7702da82da04707339c46a9c -apt-mark auto $(dpkg-list-essential) +apt-mark auto $(./dpkg-list-essential) # more cleanup, just-in-case apt-mark -y minimize-manual From 439653c362142044385517cfbe6406a487588174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Sat, 25 May 2024 04:32:19 -0400 Subject: [PATCH 22/32] Create `apt-autopurge-busybox-dupes` https://gist.github.com/Rudxain/5f12ec098bbe6d4c383a3ac1170a90f2 --- setup-distro/apt-autopurge-busybox-dupes | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 setup-distro/apt-autopurge-busybox-dupes diff --git a/setup-distro/apt-autopurge-busybox-dupes b/setup-distro/apt-autopurge-busybox-dupes new file mode 100644 index 00000000000..806027c800a --- /dev/null +++ b/setup-distro/apt-autopurge-busybox-dupes @@ -0,0 +1,23 @@ +#!/bin/bash +set -euf -o pipefail +# https://wiki.debian.org/ReduceDebian#Use_busybox_built-ins_instead_of_full_packages + +# auto-marks packs that installed same cmds as busybox subcmds, then autopurges + +# to-do: +# filter cmds that belong to "Essential" & "Required" packs, +# for optimization. +readonly bb="$(busybox --list)" + +readonly c="$(wc -l <<< "$bb")" +i=0 +for cmd in $bb +do + echo "$i / $c" + if pack="$(dpkg -S "$(type -P "$cmd")" 2> /dev/null)" + then + apt-mark auto "$(cut -d: -f1 <<< "$pack")" > /dev/null + fi + ((i++)) +done +apt -y autopurge From 04a58c7e00e19092085b49c65949be54f51d39ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Thu, 30 May 2024 07:05:25 -0400 Subject: [PATCH 23/32] add Helix system-wide updater --- setup-distro/hx-update | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 setup-distro/hx-update diff --git a/setup-distro/hx-update b/setup-distro/hx-update new file mode 100644 index 00000000000..729db01f544 --- /dev/null +++ b/setup-distro/hx-update @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +#shellcheck disable=2317 +set -euf -o pipefail + +readonly RELEASE_URL='https://github.com/helix-editor/helix/releases/' +wget "${RELEASE_URL}latest" -O - | \ +grep -E 'download/\d+\.\d+/helix-\d+\.\d+-x86_64\.AppImage' +#to-do check version before download + +exit 0 + +readonly ROOT_URL='https://raw.githubusercontent.com/helix-editor/helix/master/' +readonly ROOT_DIR='/usr/share/' +readonly ICO="${ROOT_DIR}icons/" + +wget "${ROOT_URL}contrib/helix.png" -P "$ICO" +wget "${ROOT_URL}logo.svg" -O "${ICO}helix.svg" +unset ICO + +wget "${ROOT_URL}contrib/Helix.desktop" -P "${ROOT_DIR}applications" || true + +wget "${ROOT_URL}contrib/completion/hx.bash" -P '/etc/bash_completion.d' || true + From fb80325f52146d1b55b4ba94380933103b5dc87e Mon Sep 17 00:00:00 2001 From: rudxain Date: Mon, 10 Jun 2024 14:17:47 -0400 Subject: [PATCH 24/32] rename setup dir --- {setup-distro => post-install}/Enable_AppArmor | 0 {setup-distro => post-install}/README.md | 0 {setup-distro => post-install}/apt-autopurge-busybox-dupes | 0 {setup-distro => post-install}/apt-purge-retro | 0 {setup-distro => post-install}/dpkg-list-essential | 0 {setup-distro => post-install}/hx-update | 0 {setup-distro => post-install}/main | 0 {setup-distro => post-install}/path.sh | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename {setup-distro => post-install}/Enable_AppArmor (100%) rename {setup-distro => post-install}/README.md (100%) rename {setup-distro => post-install}/apt-autopurge-busybox-dupes (100%) rename {setup-distro => post-install}/apt-purge-retro (100%) rename {setup-distro => post-install}/dpkg-list-essential (100%) rename {setup-distro => post-install}/hx-update (100%) rename {setup-distro => post-install}/main (100%) rename {setup-distro => post-install}/path.sh (100%) diff --git a/setup-distro/Enable_AppArmor b/post-install/Enable_AppArmor similarity index 100% rename from setup-distro/Enable_AppArmor rename to post-install/Enable_AppArmor diff --git a/setup-distro/README.md b/post-install/README.md similarity index 100% rename from setup-distro/README.md rename to post-install/README.md diff --git a/setup-distro/apt-autopurge-busybox-dupes b/post-install/apt-autopurge-busybox-dupes similarity index 100% rename from setup-distro/apt-autopurge-busybox-dupes rename to post-install/apt-autopurge-busybox-dupes diff --git a/setup-distro/apt-purge-retro b/post-install/apt-purge-retro similarity index 100% rename from setup-distro/apt-purge-retro rename to post-install/apt-purge-retro diff --git a/setup-distro/dpkg-list-essential b/post-install/dpkg-list-essential similarity index 100% rename from setup-distro/dpkg-list-essential rename to post-install/dpkg-list-essential diff --git a/setup-distro/hx-update b/post-install/hx-update similarity index 100% rename from setup-distro/hx-update rename to post-install/hx-update diff --git a/setup-distro/main b/post-install/main similarity index 100% rename from setup-distro/main rename to post-install/main diff --git a/setup-distro/path.sh b/post-install/path.sh similarity index 100% rename from setup-distro/path.sh rename to post-install/path.sh From 032bcb1d450c4e648e0a8ef6a44c88cb07e03f15 Mon Sep 17 00:00:00 2001 From: rudxain Date: Mon, 10 Jun 2024 14:23:20 -0400 Subject: [PATCH 25/32] add `apt` & `nft` config --- post-install/main | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/post-install/main b/post-install/main index c319e0a25b4..a829f8261c7 100755 --- a/post-install/main +++ b/post-install/main @@ -15,10 +15,7 @@ readonly pack_ls="$(cat -- "$1")" # to reduce time between auto-marking & installing, # we must config now -echo \ -'APT::Install-Recommends "0"; -APT::Install-Suggests "0";' \ ->> "${PREFIX:-}/etc/apt/apt.conf" +cp apt.conf "${PREFIX:-}/etc/apt/apt.conf" # Termux compatibility # cleanup From 445a643ca770fa8135ca2a882ceda55c2bce1dd5 Mon Sep 17 00:00:00 2001 From: rudxain Date: Mon, 10 Jun 2024 14:23:32 -0400 Subject: [PATCH 26/32] add `apt` & `nft` config --- post-install/apt.conf | 3 +++ post-install/nftables.conf | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 post-install/apt.conf create mode 100644 post-install/nftables.conf diff --git a/post-install/apt.conf b/post-install/apt.conf new file mode 100644 index 00000000000..b7e7e6a21ee --- /dev/null +++ b/post-install/apt.conf @@ -0,0 +1,3 @@ +APT::Install-Recommends "0"; +APT::Install-Suggests "0"; +APT::AutoRemove::SuggestsImportant "0"; diff --git a/post-install/nftables.conf b/post-install/nftables.conf new file mode 100644 index 00000000000..d7a352f52f0 --- /dev/null +++ b/post-install/nftables.conf @@ -0,0 +1,20 @@ +#!/usr/sbin/nft -f + +flush ruleset + +table inet filter { + # 9 December 2021, at 00:51 + # https://wiki.nftables.org/wiki-nftables/index.php/Simple_ruleset_for_a_workstation#fw.inet.basic + chain input { + type filter hook input priority 0; policy drop; + iif lo accept + ct state established,related accept + icmpv6 type { nd-neighbor-solicit, nd-router-advert, nd-neighbor-advert } accept + } + chain forward { + type filter hook forward priority filter; + } + chain output { + type filter hook output priority filter; + } +} From 2e42085c2c58678b1146fdeca3f96e648ebe1bed Mon Sep 17 00:00:00 2001 From: rudxain Date: Thu, 13 Jun 2024 22:42:55 -0400 Subject: [PATCH 27/32] `update` is now only useful for admin --- bin/update | 38 ------------------------ post-install/Enable_AppArmor | 0 post-install/apt-autopurge-busybox-dupes | 0 post-install/dpkg-list-essential | 0 post-install/{hx-update => update-hx} | 0 5 files changed, 38 deletions(-) delete mode 100755 bin/update mode change 100644 => 100755 post-install/Enable_AppArmor mode change 100644 => 100755 post-install/apt-autopurge-busybox-dupes mode change 100644 => 100755 post-install/dpkg-list-essential rename post-install/{hx-update => update-hx} (100%) mode change 100644 => 100755 diff --git a/bin/update b/bin/update deleted file mode 100755 index 2da921a1174..00000000000 --- a/bin/update +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -set -euf - -if [ -z "${TERMUX_VERSION:-}" ]; then - # should I use apt-get? - # "unstable API" doesn't seem to matter here - if apt update && apt upgrade - then - apt autoclean || true - apt autopurge || true - - # https://github.com/pypa/pip/issues/4551 - - # if `apt` fails, - # it's likely `npm` will also fail - npm update -g || true # for LSPs - fi - - rustup upgrade - # https://github.com/rust-lang/cargo/issues/9527 - crates="$(\ - cargo install --list |\ - # assume stable Cargo API - grep -E '^[a-z0-9_-]+ v[0-9.]+:$' |\ - cut -f1 -d' ' \ - )" - # shellcheck disable=SC2086 - [ -n "$crates" ] && cargo install $crates -else - # https://wiki.termux.com/wiki/Package_Management - if pkg upgrade; then - # I have backups, no worries - pkg autoclean || true - apt autopurge || true - - npm update -g || true # for LSPs - fi -fi diff --git a/post-install/Enable_AppArmor b/post-install/Enable_AppArmor old mode 100644 new mode 100755 diff --git a/post-install/apt-autopurge-busybox-dupes b/post-install/apt-autopurge-busybox-dupes old mode 100644 new mode 100755 diff --git a/post-install/dpkg-list-essential b/post-install/dpkg-list-essential old mode 100644 new mode 100755 diff --git a/post-install/hx-update b/post-install/update-hx old mode 100644 new mode 100755 similarity index 100% rename from post-install/hx-update rename to post-install/update-hx From b8a5ee3a35da604f66c5c753cdadf808fa6a7b4e Mon Sep 17 00:00:00 2001 From: rudxain Date: Thu, 13 Jun 2024 22:43:10 -0400 Subject: [PATCH 28/32] `update` is now only useful for admin --- post-install/update-packs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 post-install/update-packs diff --git a/post-install/update-packs b/post-install/update-packs new file mode 100755 index 00000000000..f70542992e2 --- /dev/null +++ b/post-install/update-packs @@ -0,0 +1,21 @@ +#!/bin/sh +set -uf + +if [ -n "${TERMUX_VERSION:-}" ]; then + # https://wiki.termux.com/wiki/Package_Management + if pkg upgrade; then + # I'm aware of the consequences + pkg autoclean + apt-get autopurge + + npm update -g # for LSPs + fi +else + if apt-get update && apt-get upgrade + then + apt-get autoclean + apt-get autopurge + + npm update -g # for LSPs + fi +fi From 7d333075e48c5bfffb442fe5a1e9af4808de0145 Mon Sep 17 00:00:00 2001 From: Rudxain Date: Sat, 29 Jun 2024 10:06:52 -0400 Subject: [PATCH 29/32] add `dpkg-list-sizes` --- post-install/dpkg-list-sizes | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 post-install/dpkg-list-sizes diff --git a/post-install/dpkg-list-sizes b/post-install/dpkg-list-sizes new file mode 100755 index 00000000000..fb317d8f09e --- /dev/null +++ b/post-install/dpkg-list-sizes @@ -0,0 +1,8 @@ +#!/bin/sh +set -euf + +n="${1-16}" + +dpkg-query -Wf '${Installed-size}\t${Package}\n' | + sort -rn | + head "-n$((n))" From d3f1c02202d48e53c4e3abb3d33bf2580daab78d Mon Sep 17 00:00:00 2001 From: Rudxain Date: Mon, 1 Jul 2024 13:04:56 -0400 Subject: [PATCH 30/32] improve `main` post-install, enable FF touch --- post-install/main | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/post-install/main b/post-install/main index a829f8261c7..73de1a27edf 100755 --- a/post-install/main +++ b/post-install/main @@ -1,5 +1,5 @@ #!/bin/bash -set -euf +set -euf -o pipefail readonly HELP='$1 must be a path to a file that contains old output from: @@ -21,24 +21,27 @@ cp apt.conf "${PREFIX:-}/etc/apt/apt.conf" # cleanup apt-mark auto \* -apt update +apt-get update # mark manual if existent. # "--" for extra safety -apt -y install -- $pack_ls +apt-get -y install -- $pack_ls apt-mark auto $(./dpkg-list-essential) # more cleanup, just-in-case -apt-mark -y minimize-manual +apt-mark minimize-manual -apt -y autopurge +apt autopurge -apt -y upgrade +apt-get -y upgrade mv path.sh "${PREFIX:-}/etc/profile.d/" + mv apt-purge-retro "${PREFIX:-/usr}/local/bin/" -# are these needed? -#chmod 755 apt-purge-retro -#chown root:root apt-purge-retro +chown root:root apt-purge-retro +chmod 755 "${PREFIX:-/usr}/local/bin/"* + +# touchscreen support +echo 'MOZ_USE_XINPUT2 DEFAULT=1' >>/etc/security/pam_env.conf ./Enable_AppArmor From 1c153de08de6e41198a3dd46f10b5f4d63d00577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Sat, 26 Oct 2024 16:29:02 -0400 Subject: [PATCH 31/32] FF `XINPUT` no longer needed The latest versions of Firefox ESR (distributed by Mozilla, not Debian) already use Wayland by default, so there's no need to enable experimental touch-screen support --- post-install/main | 3 --- 1 file changed, 3 deletions(-) diff --git a/post-install/main b/post-install/main index 73de1a27edf..19037bda7c1 100755 --- a/post-install/main +++ b/post-install/main @@ -41,7 +41,4 @@ mv apt-purge-retro "${PREFIX:-/usr}/local/bin/" chown root:root apt-purge-retro chmod 755 "${PREFIX:-/usr}/local/bin/"* -# touchscreen support -echo 'MOZ_USE_XINPUT2 DEFAULT=1' >>/etc/security/pam_env.conf - ./Enable_AppArmor From ce0f1484966663cf5de0db5d843d35067cf2b311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Sat, 26 Oct 2024 16:31:46 -0400 Subject: [PATCH 32/32] `hx` should be fetched using GH API --- post-install/update-hx | 1 + 1 file changed, 1 insertion(+) diff --git a/post-install/update-hx b/post-install/update-hx index 729db01f544..acc49d3c3ac 100755 --- a/post-install/update-hx +++ b/post-install/update-hx @@ -2,6 +2,7 @@ #shellcheck disable=2317 set -euf -o pipefail +# to-do: use official GH API rather than scraping readonly RELEASE_URL='https://github.com/helix-editor/helix/releases/' wget "${RELEASE_URL}latest" -O - | \ grep -E 'download/\d+\.\d+/helix-\d+\.\d+-x86_64\.AppImage'