Repo Browser

bashcards/bashcards-android
cards/338890172111--foux-installer/assets/raw.sh
#!/usr/bin/env bash
set -euo pipefail;bash -c $'R="\\e[31m";G="\\e[32m";Y="\\e[33m";B="\\e[34m";M="\\e[35m";C="\\e[36m";A="\\e[90m";Z="\\e[0m";H="\\e[1m";W="\\e[97m"\nP=(lib gnome linux python3 node docker k8s vim gcc openssl systemd mesa amd intel)\nS=(core dev utils common bin libs daemon plugin base engine mod)\nRPS=("http://archive.ubuntu.com/ubuntu" "http://security.ubuntu.com/ubuntu" "https://packages.cloud.google.com/apt")\nD=(focal jammy noble bionic)\nX=(main universe multiverse restricted)\nV="${V:-1.0}"\nMDE="${MDE:-mix}"\nr(){ shuf -i "$1"-"$2" -n 1; }\ni(){ local a=("$@"); echo "${a[$(r 0 $((${#a[@]}-1)))]}"; }\nn(){ echo "$(i "${P[@]}")-$(i "${S[@]}")"; }\nv(){ echo "$(r 0 9).$(r 0 20).$(r 0 99)-$(r 1 5)ubuntu$(r 1 4)"; }\np(){\n  t=$(awk -v a="$1" -v b="$2" \'BEGIN{srand();print a+rand()*(b-a)}\')\n  awk -v t="$t" -v s="$V" \'BEGIN{printf "%.3f\\n",t*s}\' | xargs sleep\n}\nb(){\n  l="$1";w=38;echo -ne "\\e[?25l"\n  for j in $(seq 0 "$(r 95 100)"); do\n    f=$((j*w/100)); e=$((w-f))\n    printf "\\r${H}%s${Z} " "$l"\n    printf "${W}"; printf "█%.0s" $(seq 1 "$f")\n    printf "${A}"; printf "░%.0s" $(seq 1 "$e")\n    printf "${Z} ${G}%d%%%s" "$j" "$Z"\n    p 0.01 0.05\n  done\n  echo -ne "\\r${H}$l${Z} "; printf "█%.0s" $(seq 1 "$w")\n  echo -e " ${G}100%${Z}"; echo -ne "\\e[?25h"\n}\nq(){ echo -e "${G}➜${Z} ${C}~${Z} ${A}git:(${R}main${A})${Z} $1"; p 0.15 0.35; }\nu(){\n  q "sudo apt-get update"\n  for j in $(seq 1 "$(r 15 40)"); do\n    t=Get;c="$B";k=$(r 1 100)\n    [[ $k -gt 90 ]]&&t=Ign&&c="$A"\n    [[ $k -gt 75 && $k -le 90 ]]&&t=Hit&&c="$G"\n    rp="$(i "${RPS[@]}")"; d="$(i "${D[@]}")"; x="$(i "${X[@]}")"\n    s=""; [[ $t == Get ]]&&s=" [${Y}$(r 1000 50000) B${Z}]"\n    echo -e "${c}${t}:${j}${Z} $rp ${C}$d${Z} $x$s"\n    p 0.02 0.12\n  done\n  echo -e "Fetched ${Y}$(r 3000 90000) kB${Z} in $(r 1 3)s"\n  echo -e "${A}Reading package lists...${Z} Done"\n}\nI(){\n  c=$(r 3 12); a=()\n  for _ in $(seq 1 "$c"); do a+=("$(n)"); done\n  q "sudo apt-get install -y ${a[*]}"\n  echo "Reading package lists... Done"\n  echo "Building dependency tree..."\n  echo "Reading state information... Done"\n  echo -e "${C}The following NEW packages will be installed:${Z}"\n  echo -e "  ${H}${a[*]}${Z}"\n  echo "Need to get $(r 10 400) MB of archives."\n  echo "After this operation, $(r 200 1500) MB of disk space will be used."\n  p 0.5 1\n  for k in "${a[@]}"; do\n    echo -e "${B}Get:${Z} $k $(v) [${Y}$(r 100 8000) kB${Z}]"\n    p 0.03 0.15\n  done\n  echo -e "${A}------------------------------------------------------------${Z}"\n  b "Reading database ..."\n  for k in "${a[@]}"; do\n    vv="$(v)"\n    echo "Preparing to unpack .../$k-$vv.deb ..."\n    p 0.03 0.12\n    echo "Unpacking $k ($vv) ..."\n    p 0.04 0.2\n  done\n  for k in "${a[@]}"; do\n    echo -e "Setting up ${G}${k}${Z} ($(v)) ..."\n    [[ "$(r 0 100)" -gt 75 ]] && b "Compiling $k"\n    p 0.05 0.25\n  done\n}\nh(){\n  clear\n  echo -e "${G}User:${Z} $USER"\n  echo -e "${G}Host:${Z} $(hostname)"\n  echo -e "${A}System Check: OK${Z}\\n"\n}\no(){\n  case "$MDE" in\n    update) u;;\n    install) I;;\n    *) (( $(r 1 100) > 50 )) && u || I;;\n  esac\n}\ntrap \'echo -e "\\n\'"${R}"\'ABORTED\'"${Z}"\'"; tput cnorm 2>/dev/null; exit\' SIGINT\nwhile true; do\n  h\n  echo -e "${H}${C}APT MIRAGE${Z}"\n  echo -e "${W}Mode:${Y} $MDE${Z}   ${W}Speed:${Y} x$V${Z}\\n"\n  echo -e "1) Endless run"\n  echo -e "2) One cycle"\n  echo -e "3) Update only"\n  echo -e "4) Install only"\n  echo -e "5) Set mode"\n  echo -e "6) Set speed"\n  echo -e "q) Quit\\n"\n  read -r -p "> " c\n  case "$c" in\n    1) while true; do o; p 0.4 1.2; done;;\n    2) o; read -r;;\n    3) u; read -r;;\n    4) I; read -r;;\n    5) read -r -p "mix/update/install: " MDE;;\n    6) read -r -p "speed: " V;;\n    q) exit 0;;\n  esac\ndone\n'
NameTypeSize
auto-art.pngfile1,472,744
back-data-url.txtfile222,102
back-thumb.pngfile176,410
back.pngfile166,560
front-data-url.txtfile246,682
front-thumb.pngfile107,195
front.pngfile184,994
manifest.txtfile184
qr-payload.txtfile2,427
raw.shfile3,832