forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
distro post-install #11
Draft
Rudxain
wants to merge
32
commits into
main
Choose a base branch
from
setup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 23 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
0e25c1b
Create `setup-env`
Rudxain eb23044
explain `setup-env`
Rudxain 63b19fe
exclude `setup-env` in `install`
Rudxain af14f57
exclude `setup-env` in min-deps
Rudxain f712f43
Create `etc_path.sh`
Rudxain af18e28
rm Android bin in `.sh/path`
Rudxain 25cf93b
avoid assigning to `PREFIX` in `etc_path.sh`
Rudxain f19c3bb
forgor 💀
Rudxain 5ffdeea
setup moves etc_path.sh to profile.d
Rudxain c338c5f
Rename setup-env to setup-distro/main
Rudxain 1d8e315
Rename etc_path.sh to setup-distro/path.sh
Rudxain a8b1960
Update setup
Rudxain ecafad6
setup shouldn't be explained in root `README`
Rudxain 16915ab
Create README.md for setup
Rudxain f2632a7
exclude `setup-distro` on `install` & min-deps
f085a06
fix perms
6baf52a
add purge-retro. warn about non-idemp
8318df3
Create Enable_AppArmor
Rudxain 165add9
enable AA end main
Rudxain 511a356
Create `dpkg-list-essential`
Rudxain e996b3a
use local ls-essential
Rudxain 439653c
Create `apt-autopurge-busybox-dupes`
Rudxain 04a58c7
add Helix system-wide updater
Rudxain fb80325
rename setup dir
032bcb1
add `apt` & `nft` config
445a643
add `apt` & `nft` config
2e42085
`update` is now only useful for admin
b8a5ee3
`update` is now only useful for admin
7d33307
add `dpkg-list-sizes`
d3f1c02
improve `main` post-install, enable FF touch
1c153de
FF `XINPUT` no longer needed
Rudxain ce0f148
`hx` should be fetched using GH API
Rudxain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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. | ||
|
||
> [!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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
apt-get purge $(dpkg -l | grep \^rc | awk '{print $2}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
set -euf | ||
|
||
dpkg-query -Wf '${Package;-40}${Essential}\n' \ | ||
| grep yes \ | ||
| awk '{print $1}' |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should use |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/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 | ||
|
||
apt-mark auto $(./dpkg-list-essential) | ||
# more cleanup, just-in-case | ||
apt-mark -y minimize-manual | ||
|
||
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 | ||
|
||
./Enable_AppArmor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should prompt the user