Skip to content

Instantly share code, notes, and snippets.

@paradigm
paradigm / brl-fetch-nixos.sh
Last active June 13, 2021 16:10
Broken attempt at adding NixOS support to `brl fetch`
#!/bedrock/libexec/busybox sh
#
# NixOS bootstrap support
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# Copyright (c) 2016-2018 Daniel Thau <danthau@bedrocklinux.org>
#
#!/bedrock/libexec/busybox sh
norm_color='\033[2;97m'
high_color='\033[0;97m'
drawing='__
\ \___
\ _ \
\___/
'
#!/bin/sh
#
# Finds redundant Bedrock packages
#
# Assumes `pmm` is set to mimic apt. Adjust accordingly for other pmm front-ends.
pmm-mark showmanual 2>/dev/null | awk '{
if ($2 in pkgs) {
redundant[pkgs[$2]]
redundant[$0]
#!/usr/bin/awk -f
#
# Full Bedrock logo draw in animation
#
function draw_char(x, y, char, color) {
printf(cursor_restore)
if (x > 1) {
printf("\033["(x-1)"C")
}
#!/bin/sh
norm_color='\033[2;97m'
high_color='\033[0;97m'
drawing='__
\ \___
\ _ \
\___/
'
prepare_target() {
notice "Setting up ebuild"
chroot "$target_dir" emerge-webrsync
mkdir -p "$target_dir/etc/portage/repos.conf"
cp "$target_dir/usr/share/portage/config/repos.conf" "$target_dir/etc/portage/repos.conf/gentoo.conf"
notice "Setting up locale"
if [ -n "$LANG" ] && [ "$LANG" != "C" ]
then
echo "### Added by Bedrock Linux when acquiring this stratum" >> "$target_dir/etc/locale.gen"
$ # literal because it's a single-quote string
$ echo '$HOME'
$HOME
$ # interpreted because it's a double-quote string
$ echo "$HOME"
/home/paradigm
$ # interpreted again because it's a double-quote string despite containing single quotes within it
$ echo "'$HOME'"
'/home/paradigm'
$ # to print the literal with the interpreted string, have to escape
# use vim ex commands in a UNIX pipe
# e.g.:
# $ printf "foo\nbar\nbaz\n" | vp 'g/^b/d'
# foo
#
vp() {
vim - -u NONE -es '+1' "+$*" '+%print' '+:qa!' | tail -n +2
}
# use vim normal mode commands in a UNIX pipe
sudo chmod a+rx /bedrock/strata/void-musl/var/db/xbps
sudo chmod a+r /bedrock/strata/void-musl/var/db/xbps/pkgdb-0.38.plist
$ cat ./bedrock_linux_1.0beta2_nyla.tar | tar --list --verbose | grep 'br[np].conf'
-rw-r--r-- root/root 3550 2017-06-11 16:05 bedrock/etc/brp.conf
-rw-r--r-- root/root 736 2017-06-11 16:05 bedrock/etc/brn.conf