Skip to content

Commit

Permalink
Upstream.
Browse files Browse the repository at this point in the history
  • Loading branch information
mirage335 committed Nov 2, 2023
1 parent d5bac7a commit fc6ff6d
Show file tree
Hide file tree
Showing 3 changed files with 312 additions and 6 deletions.
77 changes: 76 additions & 1 deletion compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ _ub_cksum_special_derivativeScripts_contents() {
#export ub_setScriptChecksum_disable='true'
( [[ -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'
export ub_setScriptChecksum_header='2591634041'
export ub_setScriptChecksum_contents='1955220051'
export ub_setScriptChecksum_contents='2946160307'

# CAUTION: Symlinks may cause problems. Disable this test for such cases if necessary.
# WARNING: Performance may be crucial here.
Expand Down Expand Up @@ -2840,6 +2840,19 @@ _condition_lines_zero() {
return 1
}
_safe_declare_uid() {
unset _uid
_uid() {
local currentLengthUID
currentLengthUID="$1"
[[ "$currentLengthUID" == "" ]] && currentLengthUID=18
cat /dev/random 2> /dev/null | base64 2> /dev/null | tr -dc 'a-zA-Z0-9' 2> /dev/null | tr -d 'acdefhilmnopqrsuvACDEFHILMNOPQRSU14580' | head -c "$currentLengthUID" 2> /dev/null
return
}
export -f _uid
}
#Generates semi-random alphanumeric characters, default length 18.
_uid() {
local curentLengthUID
Expand Down Expand Up @@ -5840,6 +5853,8 @@ _init_deps() {
export enUb_dev=""
export enUb_dev_heavy=""

export enUb_generic=""

export enUb_cloud_heavy=""

export enUb_mount=""
Expand Down Expand Up @@ -5888,6 +5903,7 @@ _init_deps() {

export enUb_hardware=""
export enUb_enUb_x220t=""
export enUb_enUb_w540=""
export enUb_enUb_peripherial=""

export enUb_user=""
Expand All @@ -5906,7 +5922,13 @@ _init_deps() {
export enUb_calculators=""
}

_deps_generic() {
export enUb_generic="true"
}

_deps_dev() {
_deps_generic

export enUb_dev="true"
}

Expand Down Expand Up @@ -6196,6 +6218,12 @@ _deps_x220t() {
export enUb_x220t="true"
}

_deps_w540() {
_deps_notLean
_deps_hardware
export enUb_w540="true"
}

_deps_peripherial() {
_deps_notLean
_deps_hardware
Expand Down Expand Up @@ -6223,13 +6251,19 @@ _deps_linux() {
}

_deps_python() {
_deps_generic

export enUb_python="true"
}
_deps_haskell() {
_deps_generic

export enUb_haskell="true"
}

_deps_calculators() {
_deps_generic

export enUb_calculators="true"
}

Expand Down Expand Up @@ -6769,6 +6803,12 @@ _compile_bash_deps() {
_deps_getVeracrypt
_deps_linux

_deps_hardware
_deps_x220t
_deps_w540

_deps_generic

_deps_python
_deps_haskell

Expand Down Expand Up @@ -6824,6 +6864,8 @@ _compile_bash_deps() {
then
_deps_dev

_deps_generic

_deps_python
_deps_haskell

Expand Down Expand Up @@ -6919,6 +6961,8 @@ _compile_bash_deps() {
_deps_fakehome
_deps_abstractfs

_deps_generic

_deps_python
_deps_haskell

Expand Down Expand Up @@ -6952,6 +6996,7 @@ _compile_bash_deps() {

#_deps_hardware
#_deps_x220t
#_deps_w540
#_deps_peripherial

#_deps_user
Expand Down Expand Up @@ -7014,6 +7059,8 @@ _compile_bash_deps() {
_deps_fakehome
_deps_abstractfs

_deps_generic

_deps_python
_deps_haskell

Expand Down Expand Up @@ -7047,6 +7094,7 @@ _compile_bash_deps() {

#_deps_hardware
#_deps_x220t
#_deps_w540
#_deps_peripherial

#_deps_user
Expand Down Expand Up @@ -7109,6 +7157,8 @@ _compile_bash_deps() {
_deps_fakehome
_deps_abstractfs

_deps_generic

_deps_python
_deps_haskell

Expand Down Expand Up @@ -7142,6 +7192,7 @@ _compile_bash_deps() {

_deps_hardware
_deps_x220t
_deps_w540
_deps_peripherial

_deps_user
Expand Down Expand Up @@ -7321,6 +7372,8 @@ _compile_bash_utilities() {

[[ "$enUb_dev_heavy" == "true" ]] && includeScriptList+=( "instrumentation"/bashdb/bashdb.sh )
( [[ "$enUb_notLean" == "true" ]] || [[ "$enUb_stopwatch" == "true" ]] ) && includeScriptList+=( "instrumentation"/profiling/stopwatch.sh )

[[ "$enUb_generic" == "true" ]] && includeScriptList+=( "generic"/generic.sh )
}

# Specifically intended to support Eclipse as necessary for building existing software .
Expand Down Expand Up @@ -7607,6 +7660,7 @@ _compile_bash_user() {

_compile_bash_hardware() {
[[ "$enUb_hardware" == "true" ]] && [[ "$enUb_x220t" == "true" ]] && includeScriptList+=( "hardware/x220t"/x220_display.sh )
[[ "$enUb_hardware" == "true" ]] && [[ "$enUb_w540" == "true" ]] && includeScriptList+=( "hardware/w540"/w540_fan.sh )

[[ "$enUb_hardware" == "true" ]] && [[ "$enUb_peripherial" == "true" ]] && includeScriptList+=( "hardware/peripherial/h1060p"/h1060p.sh )
}
Expand Down Expand Up @@ -8332,6 +8386,8 @@ _wrap() {
[[ "$LANG" != "C" ]] && export LANG=C
. "$HOME"/.ubcore/.ubcorerc

_safe_declare_uid

if uname -a | grep -i 'microsoft' > /dev/null 2>&1 && uname -a | grep -i 'WSL2' > /dev/null 2>&1
then
local currentArg
Expand Down Expand Up @@ -8360,10 +8416,14 @@ _wrap() {

#Wrapper function to launch arbitrary commands within the ubiquitous_bash environment, including its PATH with scriptBin.
_bin() {
_safe_declare_uid

"$@"
}
#Mostly intended to launch bash prompt for MSW/Cygwin users.
_bash() {
_safe_declare_uid

local currentIsCygwin
currentIsCygwin='false'
[[ -e '/cygdrive' ]] && uname -a | grep -i cygwin > /dev/null 2>&1 && _if_cygwin && currentIsCygwin='true'
Expand All @@ -8375,10 +8435,13 @@ _bash() {
_visualPrompt
[[ "$ub_scope_name" != "" ]] && _scopePrompt

_safe_declare_uid


[[ "$1" == '-i' ]] && shift


_safe_declare_uid

if [[ "$currentIsCygwin" == 'true' ]] && grep ubcore "$HOME"/.bashrc > /dev/null 2>&1 && [[ "$scriptAbsoluteLocation" == *"lean.sh" ]]
then
Expand Down Expand Up @@ -8408,6 +8471,8 @@ _bash() {

#Mostly if not entirely intended for end user convenience.
_python() {
_safe_declare_uid

if [[ -e "$safeTmp"/lean.py ]]
then
"$safeTmp"/lean.py '_python()'
Expand All @@ -8428,23 +8493,33 @@ _python() {

#Launch internal functions as commands, and other commands, as root.
_sudo() {
_safe_declare_uid

sudo -n "$scriptAbsoluteLocation" _bin "$@"
}

_true() {
_safe_declare_uid

#"$scriptAbsoluteLocation" _false && return 1
# ! "$scriptAbsoluteLocation" _bin true && return 1
#"$scriptAbsoluteLocation" _bin false && return 1
true
}
_false() {
_safe_declare_uid

false
}
_echo() {
_safe_declare_uid

echo "$@"
}

_diag() {
_safe_declare_uid

echo "$sessionid"
}

Expand Down
Loading

0 comments on commit fc6ff6d

Please sign in to comment.