Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
#!/bin/bash ######################### Intializations ########################### curdir=`pwd` #Not sure if we need this OUT="/tmp/map_distro/" TMP='/tmp/map_distro' declare -a ROOTS=\ ( "/mnt/home/stretch/chroot" \ "/mnt/home/stretch/initrdport" \ ) declare -a dirs_to_link_and_bind=\ ( "/bin" "/etc" "/lib" "m" "memory" \ "/opt" "porteus" "run" "/root" "union" "/usr" "/var" \ ) TARGET_ROOT="/chroot" if [ ! -d $TARGET_ROOT ]; then #https://www.hecticgeek.com/2015/12/create-ram-disk-ubuntu-linux/ mount -t tmpfs -o size=250M,nr_inodes=5k,mode=1777 tmpfs2 $TARGET_ROOT fi declare -a HOST_MOUNT_T_POINTS=\ ( "/proc" \ ) declare -a HOST_COPY=\ ( "/etc/resolv.conf" "/etc/hosts" \ ) declare -a HOST_RBIND_POINTS=\ ( "/sys" \ "/dev" \ ) declare -a HOST_RBIND_MAP=\ ( "/" "/mnt/host" \ ) #ROOT_REL_PATH #Variable not yet defined decode_id "$ROOT_UUI" ######################### MAKE DIRECTORIES ########################### for aDIR in ${HOST_RBIND_POINTS[@]}; do mkdir -p "$TARGET_ROOT$aDIR" mount --rbind "$aDIR" "$TARGET_ROOT$aDIR" done for aDIR in ${HOST_MOUNT_T_POINTS[@]}; do mkdir -p "$TARGET_ROOT$aDIR" mount -t proc "$aDIR" "$TARGET_ROOT$aDIR" done for aFile in ${HOST_COPY[@]}; do mkdir -p "$TARGET_ROOT$aFile" cp -a -u "$aFile" "$TARGET_ROOT$aFile" done while read SOURCE; read TARGET; do mkdir -p "$TARGET_ROOT$TARGET" cd "$TARGET_ROOT"; cd "$SOURCE" mount --rbind . "$TARGET_ROOT$TARGET" done <<EOF `for a in ${HOST_RBIND_MAP[@]}; do echo "$a"; done` EOF #mkdir $OUT mkdir -p "$OUT" ######################### FUNCTIONS ########################### ###################### Functions ############ bind_and_link_array(){ local -n one=${1} # https://stackoverflow.com/questions/16461656/how-to-pass-array-as-an-argument-to-a-function-in-bash if [ $# -lt 2 ]; then SR="$SAVE_ROOT" else SR=$2 fi one=${one[*]} #https://stackoverflow.com/questions/3348443/a-confusion-about-array-versus-array-in-the-context-of-a-bash-comple?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa one=${one#'('} #https://stackoverflow.com/questions/16623835/remove-a-fixed-prefix-suffix-from-a-string-in-bash?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa one=${one%')#'} echo "Ln 45 one=${one[@]}" #example from: https://stackoverflow.com/questions/34555278/bash-read-a-looping-on-null-delimited-string-variable #while IFS= read -r -d '' myvar; do echo $myvar; done < <(find . -type f -print0) #while IFS= read -r -d '' a; do # echo "LN#43 bind_and_link $a" # bind_and_link "$a" "$SR" #done < <( "${one[@]}" ) for a in $one; do echo "LN#43 bind_and_link $a" bind_and_link "$a" "$SR" done } bind_and_link_dir(){ #local -n one=$1 if [ $# -lt 2 ]; then export SR="$SAVE_ROOT" else export SR=$2 fi one="$1" echo "LN#65 one=$one" #echo "LN#63 one=${one[@]}" #declair -A DIRS #https://stackoverflow.com/questions/1063347/passing-arrays-as-parameters-in-bash [ ! `/bin/mountpoint -q "$one"` ] || return _ #example from: https://stackoverflow.com/questions/34555278/bash-read-a-looping-on-null-delimited-string-variable #while IFS= read -r -d '' myvar; do echo $myvar; done < <(find . -type f -print0) #DIRS=`find "$SR$one" -mindepth 1 -maxdepth 1 -print0 -name '*' ` #decliar -A DIRS2 #DIRS2=() #DIRS=`while IFS= read -r -d '' myvar; do echo "${myvar#$SR}"; done < <( "${DIRS[@]}" )` #find $SR$one -mindepth 1 -maxdepth 1 -print0 -name '*' | DIRS2=( $( find "$SR$one" -mindepth 1 -maxdepth 1 -print0 -name '*' | removePrefix "$SR" ) )# #IFS="$'\0'" #for a in $DIRS; do # echo "a=$a" # DIRS2+=( $a ) # echo "LN#82 DIRS2=${DIRS2[@]}" bind_and_link_array DIRS2 $2 } bind_and_link(){ f="$1"; f=/${f#/} if [ $# -gt 1 ]; then SR="$2" else SR="$SAVE_ROOT" fi if [ $# -lt 3 ]; then export TR="$TARGET_ROOT" else export TR=$3 fi #https://stackoverflow.com/questions/4561153/check-for-symbolic-link #https://unix.stackexchange.com/questions/167610/determining-if-a-file-is-a-hard-link-or-symbolic-link #http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html IsBind="True" mountpoint -q "$f" || IsBind="False" echo "f=$f IsBind=$IsBind" if [ "$IsBind" = "False" ]; then echo "Ln 74 Not a mount point" if [ -L "$SR$f" ]; then #$f should start w/ slash TODO add slash if missing echo "LN#76 Copying $f" cp -a -u "$SR$f" "$TR$f" echo "$f" >> $OUT/coppied_links elif [ -d "$SR$f" ]; then if [ -d "$TR$f" ]; then echo "LN#85 bind_and_link_dir $f" #Could user findmnt instead of cat /proc/self/mountinfo if [[ "`mountpoint $TR$f`" == *" is a "* ]]; then PATH2=`cat /proc/self/mountinfo | grep "$TR$f" | cut -d" " -f4` PATH_DrvMnt=`cat /proc/self/mountinfo | grep /chroot/var | cut -d" " -f9` PATH_DrvMnt=/mnt${PATH_DrvMnt#/dev} PATH3=$PATH_DrvMnt$PATH2 SAVE_ROOT_NEW=${PATH3%$f} umount "$TR$f" mkdir "$TR$f" SAVE_ROOT_OLD=$SAVE_ROOT SAVE_ROOT=$SAVE_ROOT_NEW bind_and_link_dir $f SAVE_ROOT=$SAVE_ROOT_OLD bind_and_link_dir $f else bind_and_link_dir $f fi else echo "LN# 84 binding $f" mkdir -p "$TR$f" mount --bind "$SR$f" "$TR$f" #Was bind_dir "$SR/$a" $f echo "$f" >> $OUT/bound_dirs fi elif [ -f "$SR$f" ]; then echo "LN#236 linking $f" echo "LN#127 links is `readlink $SR$f`" RP=`realpath $SR$f` ln -s "/mnt/host$RP" "$TR$f" #Was link_file "$SR/$a" $a echo "$f" >> $OUT/linked_dirs fi fi } #echo $(dirname $(readlink -f "$fname")) # get directory name https://stackoverflow.com/questions/6121091/get-file-directory-path-from-file-path ######################### MAIN ########################### if [ -e `which removePrefix` ]; then cat <<-'EOF' > /usr/sbin/removePrefix #!/bin/bash #bla=$IFS #FS=$'\0' while read -r -d '' a; do echo "a=$a">>/mnt/sdc6/removePrefixLog echo "${a#$1}" echo "${a#$1}">>/mnt/sdc6/removePrefixLog done EOF chmod go+x /usr/sbin/removePrefix #http://fideloper.com/user-group-permissions-chmod-apache fi for aRoot in ${ROOTS[@]}; do ROOT_REL_PATH=$aRoot SAVE_ROOT="$aRoot" for dir in ${dirs_to_link_and_bind[@]}; do #mkdir -p dir bind_and_link $dir done done #indexgen.sh #http://murga-linux.com/puppy/viewtopic.php?p=990215#990215 #fixmenus #jwm -reload
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
⭐⭐ Crypto Swap Glitch ✅ Easy money ⭐⭐
JavaScript | 5 min ago | 0.67 KB
⭐⭐ Free Crypto Method ⭐⭐ ✅
JavaScript | 15 min ago | 0.67 KB
Nano_button_led_hc05
C++ | 23 min ago | 1.50 KB
Infinite Money Glitch
JavaScript | 25 min ago | 0.67 KB
🔥🔥🔥 Swapzone Trading Glitch 🔥🔥🔥
JavaScript | 35 min ago | 0.67 KB
⭐⭐ Instant Money Method ⭐⭐ ✅
JavaScript | 46 min ago | 0.67 KB
⭐⭐ FREE BTC GUIDE ✅ Working ⭐⭐
JavaScript | 56 min ago | 0.67 KB
VanillaAmmoCraftsRecipes.json
JSON | 59 min ago | 78.72 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!