TEXT   30

Untitled

Guest on 22nd May 2021 08:59:35 PM

  1. #!/bin/bash
  2. folder=void-fs
  3. if [ -d "$folder" ]; then
  4.       first=1
  5.       echo "skipping downloading"
  6. fi
  7. tarball="void-rootfs.tar.xz"
  8. if [ "$first" != 1 ];then
  9.       if [ ! -f $tarball ]; then
  10.             echo "Download Rootfs, this may take a while base on your internet speed."
  11.             case `dpkg --print-architecture` in
  12.             aarch64)
  13.                   archurl="arm64" ;;
  14.             arm)
  15.                   archurl="armhf" ;;
  16.             amd64)
  17.                   archurl="amd64" ;;
  18.             x86_64)
  19.                   archurl="amd64" ;;     
  20.             i*86)
  21.                   archurl="i386" ;;
  22.             x86)
  23.                   archurl="i386" ;;
  24.             *)
  25.                   echo "unknown architecture"; exit 1 ;;
  26.             esac
  27.             wget "https://alpha.de.repo.voidlinux.org/live/current/void-x86_64-ROOTFS-20210218.tar.xz" -O $tarball
  28.       fi
  29.       cur=`pwd`
  30.       mkdir -p "$folder"
  31.       cd "$folder"
  32.       echo "Decompressing Rootfs, please be patient."
  33.       proot --link2symlink tar -xJf ${cur}/${tarball} --exclude='dev' 2> /dev/null||:
  34.       cd "$cur"
  35. fi
  36. mkdir -p void-binds
  37. bin=start-void.sh
  38. echo "writing launch script"
  39. cat > $bin <<- EOM
  40. #!/bin/bash
  41. cd \$(dirname \$0)
  42. ## unset LD_PRELOAD in case termux-exec is installed
  43. command="proot"
  44. command+=" --link2symlink"
  45. command+=" -0"
  46. command+=" -r $folder"
  47. if [ -n "\$(ls -A void-binds)" ]; then
  48.     for f in void-binds/* ;do
  49.       . \$f
  50.     done
  51. fi
  52. command+=" -b /dev"
  53. command+=" -b /proc"
  54. command+=" -b void-fs/root:/dev/shm"
  55. ## uncomment the following line to have access to the home directory of termux
  56. #command+=" -b /home/runner:/root"
  57. ## uncomment the following line to mount /sdcard directly to /
  58. #command+=" -b /sdcard"
  59. command+=" -w /root"
  60. command+=" /usr/bin/env -i"
  61. command+=" HOME=/root"
  62. command+=" PATH=PATH=/bin:/usr/bin:/sbin:/usr/sbin"
  63. command+=" TERM=\$TERM"
  64. command+=" LANG=C.UTF-8"
  65. command+=" /bin/bash --login"
  66. com="\$@"
  67. if [ -z "\$1" ];then
  68.     exec \$command
  69. else
  70.     \$command -c "\$com"
  71. fi
  72. EOM
  73.  
  74. echo "making $bin executable"
  75. chmod +x $bin
  76. echo "removing image for some space"
  77. rm $tarball
  78. echo "Preparing additional component for the first time, please wait..."
  79. wget "https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/Installer/Void/resolv.conf" -P void-fs/etc
  80. echo "You can now launch Void Linux with the ./${bin} script"

Raw Paste


Login or Register to edit or fork this paste. It's free.