s243a

DRAFT: RAM_LAUNCH_BROWSER.sh

Apr 16th, 2021
1,373
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. #
  3. # Launcher for 'portable' Iron browser
  4. #
  5. HERE="$(dirname "$(readlink -f "$0")")"
  6. IRON_DIR="${HERE}/iron32"
  7. SFS_Target=/initrd/mnt/tmpfs/Iron-portable32.sfs
  8. if [ ls -A iron32 ]; then
  9.  echo "Directory iron32 already mounted" >&2
  10.  
  11. else
  12.  if [ ! -d /initrd/mnt/tmpfs/iron32-profile/PROFILE ]; then
  13.    mkdir -p /initrd/mnt/tmpfs/iron32-profile/PROFILE/
  14.    cp -rf iron32-dir/PROFILE/ /initrd/mnt/tmpfs/iron32-profile/
  15.  fi
  16.  if [ ! -e /initrd/mnt/tmpfs/Iron-portable32.sfs ]; then
  17.    cp Iron-portable32.sfs "$SFS_Target"
  18.  fi
  19.  
  20. append_mnt_id_awk='
  21. function get_mnt_id(mnt_pt,loop){
  22.  if (length(mnt_pt) > 0 && length(loop)>0){
  23.    cmd="cat /proc/self/mountinfo | sort | grep '" loop "' | grep " mnt_pt " | head -n 1"
  24.  } else if (length(mnt_pt) > 0){
  25.    cmd="cat /proc/self/mountinfo | sort | grep '" mnt_pt "' | head -n 1"
  26.  } else if (length(loop)>0){
  27.    cmd="cat /proc/self/mountinfo | sort | grep '" loop "' | head -n 1"
  28.  }
  29.  while ((cmd | getline )){
  30.    mnt_id=$1
  31.    break  
  32.  }
  33.  close(cmd)
  34.  return mnt_id
  35. }
  36. {
  37.  mnt_pt=$1
  38.  loop=$2
  39.  mnt_id=get_mnt_id(mnt_pt,loop)
  40.  print mnt_id "|" mnt_pt "|" loop
  41. }'  
  42.  loop=$(losetup -a | grep  /initrd/mnt/tmpfs/Iron-portable32.sfs  | sed "s/:.*$//" )
  43.  if [ ! -z "$loop" ]; then #
  44.    sfs_MP="$(findmnt -o TARGET,SOURCE -D -n | grep $loop\$ | awk "$append_mnt_id_awk" | sort -t '|' -k1 | cut -d'|' -f2 | head -n 1)"
  45.  fi
  46.  if [ -z "$sfs_MP" ]; then
  47.    mkdir -p /initrd/mnt/tmpfs/Iron-portable32
  48.    sfs_MP=/initrd/mnt/tmpfs/Iron-portable32
  49.  fi
  50.  mkdir -p "$sfs_MP"
  51.  if [ ! "`ls -A "$sfs_MP"`" ]; then
  52.    mount -r -t squashfs "$SFS_Target" "$sfs_MP"
  53.  fi
  54.  BRANCHES=/initrd/mnt/tmpfs/iron32-profile:"$sfs_MP"
  55.  mkdir -p "$IRON_DIR"
  56.  mount -t aufs -o br="$BRANCHES" aufs "$IRON_DIR"
  57. fi
  58.  
  59. #
  60. "$IRON_DIR/iron-pup" "$@"
  61.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×