Skip to content

Commit 6350e2d

Browse files
committed
Draft - upstream.
1 parent 6120ea8 commit 6350e2d

File tree

2 files changed

+68
-9
lines changed

2 files changed

+68
-9
lines changed

_lib/ubiquitous_bash

ubiquitous_bash.sh

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _ub_cksum_special_derivativeScripts_contents() {
3939
#export ub_setScriptChecksum_disable='true'
4040
( [[ -e "$0".nck ]] || [[ "${BASH_SOURCE[0]}" != "${0}" ]] || [[ "$1" == '--profile' ]] || [[ "$1" == '--script' ]] || [[ "$1" == '--call' ]] || [[ "$1" == '--return' ]] || [[ "$1" == '--devenv' ]] || [[ "$1" == '--shell' ]] || [[ "$1" == '--bypass' ]] || [[ "$1" == '--parent' ]] || [[ "$1" == '--embed' ]] || [[ "$1" == '--compressed' ]] || [[ "$0" == "/bin/bash" ]] || [[ "$0" == "-bash" ]] || [[ "$0" == "/usr/bin/bash" ]] || [[ "$0" == "bash" ]] ) && export ub_setScriptChecksum_disable='true'
4141
export ub_setScriptChecksum_header='3620520443'
42-
export ub_setScriptChecksum_contents='1482882224'
42+
export ub_setScriptChecksum_contents='3891783678'
4343

4444
# CAUTION: Symlinks may cause problems. Disable this test for such cases if necessary.
4545
# WARNING: Performance may be crucial here.
@@ -8485,6 +8485,43 @@ APT::AutoRemove::SuggestsImportant "true";' | tee /etc/apt/apt.conf.d/99autoremo
84858485

84868486

84878487

8488+
# ATTENTION
8489+
# NOTICE
8490+
# May be able to automatically respond to nix package manager file conflicts.
8491+
# WARNING: May be untested.
8492+
# ATTRIBUTION-AI: Suggested by CLI Codex (ie. _codexAuto) 2025-07-20 .
8493+
#
8494+
#_nixInstallRetry() {
8495+
#local -a cmd=( "$@" ) out status file
8496+
#if out=$( "${cmd[@]}" 2>&1 ); then
8497+
#printf '%s\n' "$out"
8498+
#return 0
8499+
#else
8500+
#status=$?
8501+
#if printf '%s\n' "$out" | grep -q "file conflict over '"; then
8502+
#file=$(printf '%s\n' "$out" | sed -n "s/.*file conflict over '\([^']*\)'.*/\1/p")
8503+
#_getMost_backend sudo -n -u "$currentUser" /bin/bash -l -c 'rm -f "$HOME/.nix-profile/'"$file"'"'
8504+
#"${cmd[@]}"
8505+
#return $?
8506+
#else
8507+
#printf '%s\n' "$out" >&2
8508+
#return $status
8509+
#fi
8510+
#fi
8511+
#}
8512+
#export -f _nixInstallRetry
8513+
#
8514+
#_nixInstallRetry _getMost_backend sudo -n -u "$currentUser" /bin/bash -l -c 'cd ; export NIXPKGS_ALLOW_INSECURE=1 ; nix-env -iA pcb -f https://github.com/NixOS/nixpkgs/archive/00a3a62a70f6c2ca919befeda4b8a7319ce8be2b.tar.gz'
8515+
8516+
8517+
8518+
8519+
8520+
8521+
8522+
8523+
8524+
84888525
# NOTICE
84898526
# https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=geda
84908527
# https://lazamar.co.uk/nix-versions/?package=geda&version=1.10.2&fullName=geda-1.10.2&keyName=geda&revision=9957cd48326fe8dbd52fdc50dd2502307f188b0d&channel=nixpkgs-unstable#instructions
@@ -8579,8 +8616,8 @@ _get_from_nix-user() {
85798616
# export LANG=C
85808617
# https://bbs.archlinux.org/viewtopic.php?id=23505
85818618

8582-
#nix-env --uninstall geda
8583-
#nix-env --uninstall pcb
8619+
nix-env --uninstall 'geda.*' || true
8620+
nix-env --uninstall 'pcb.*' || true
85848621

85858622

85868623

@@ -8593,6 +8630,9 @@ _get_from_nix-user() {
85938630
# CAUTION: Be wary if this file has changed recently.
85948631

85958632
# ###
8633+
# Remove previous geda and pcb to prevent overlapping file conflicts (e.g. gnet-pcbfwd.scm).
8634+
_getMost_backend sudo -n -u "$currentUser" /bin/bash -l -c 'cd ; nix-env --uninstall geda.* || true'
8635+
_getMost_backend sudo -n -u "$currentUser" /bin/bash -l -c 'cd ; nix-env --uninstall pcb.* || true'
85968636
# Seems to have removed xorn, python2.7 . May not have been tested through ubdist/WSL . May be accepted for now due to some apparently successful testing expected to match this specific version.
85978637
_getMost_backend sudo -n -u "$currentUser" /bin/bash -l -c 'cd ; export NIXPKGS_ALLOW_INSECURE=1 ; nix-env -iA geda -f https://github.com/NixOS/nixpkgs/archive/773a8314ef05364d856e46299722a9d849aacf8b.tar.gz'
85988638

@@ -8608,11 +8648,16 @@ _get_from_nix-user() {
86088648
_getMost_backend sudo -n -u "$currentUser" /bin/bash -l -c 'cd ; xdg-desktop-menu install "$HOME"/.nix-profile/share/applications/geda-gattrib.desktop'
86098649
_getMost_backend sudo -n -u "$currentUser" cp -a /home/"$currentUser"/.nix-profile/share/icons /home/"$currentUser"/.local/share/
86108650

8611-
_getMost_backend sudo -n -u "$currentUser" /bin/bash -l -c 'cd ; export NIXPKGS_ALLOW_INSECURE=1 ; nix-env -iA nixpkgs.pcb'
8651+
# nixpkgs.pcb
8652+
# Remove conflicting shared scheme file before installing pcb
8653+
#_getMost_backend sudo -n -u "$currentUser" /bin/bash -l -c 'cd; rm -f "$HOME"/.nix-profile/share/gEDA/gnet-pcbfwd.scm'
8654+
8655+
_getMost_backend sudo -n -u "$currentUser" /bin/bash -l -c 'cd ; export NIXPKGS_ALLOW_INSECURE=1 ; nix-env -iA pcb -f https://github.com/NixOS/nixpkgs/archive/00a3a62a70f6c2ca919befeda4b8a7319ce8be2b.tar.gz'
86128656

86138657

86148658
# Necessary, do NOT remove. Necessary for 'gsch2pcb' , 'gnetlist' , etc, since installation as a dependency does not make the necessary binaries available to the usual predictable PATH .
8615-
_getMost_backend sudo -n -u "$currentUser" /bin/bash -l -c 'cd ; export NIXPKGS_ALLOW_INSECURE=1 ; nix-env -iA nixpkgs.python2'
8659+
#nixpkgs.python2
8660+
_getMost_backend sudo -n -u "$currentUser" /bin/bash -l -c 'cd ; export NIXPKGS_ALLOW_INSECURE=1 ; nix-env -iA python2 -f https://github.com/NixOS/nixpkgs/archive/00a3a62a70f6c2ca919befeda4b8a7319ce8be2b.tar.gz'
86168661

86178662

86188663

@@ -9070,11 +9115,20 @@ _test_nix-env_sequence() {
90709115
cd "$safeTmp"
90719116

90729117
# https://ariya.io/2016/06/isolated-development-environment-using-nix
9118+
#cat << 'CZXWXcRMTo8EmM8i4d' > ./default.nix
9119+
#with import <nixpkgs> {};
9120+
#stdenv.mkDerivation rec {
9121+
#name = "env";
9122+
#env = buildEnv { name = name; paths = buildInputs; };
9123+
#buildInputs = [
9124+
#hello
9125+
#];
9126+
#}
9127+
#CZXWXcRMTo8EmM8i4d
9128+
90739129
cat << 'CZXWXcRMTo8EmM8i4d' > ./default.nix
90749130
with import <nixpkgs> {};
9075-
stdenv.mkDerivation rec {
9076-
name = "env";
9077-
env = buildEnv { name = name; paths = buildInputs; };
9131+
mkShell {
90789132
buildInputs = [
90799133
hello
90809134
];
@@ -23300,6 +23354,11 @@ _stop() {
2330023354
[[ -e "$scriptLocal"/python_cygwin.lock ]] && [[ $(head -c $(echo -n "$sessionid" | wc -c | tr -dc '0-9') "$scriptLocal"/python_cygwin.lock 2> /dev/null ) == "$sessionid" ]] && rm -f "$scriptLocal"/python_cygwin.lock > /dev/null 2>&1
2330123355

2330223356
_stop_stty_echo
23357+
23358+
# WARNING: CAUTION: Do NOT cause EXIT trap unset until 'exit' command cannot be called (eg. by user in an interactive shell).
23359+
# Unset the 'exit' trap before calling 'exit' command properly , hopefully prevent incorrect exit status in some unusual situations (eg. CI environment, 'set -e -o pipefail' , etc) .
23360+
trap - EXIT
23361+
2330323362
if [[ "$1" != "" ]]
2330423363
then
2330523364
exit "$1"

0 commit comments

Comments
 (0)