Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/ash
- #THIS_DIR=$PWD
- #ROOT="${THIS_DIR%%/tazpupsave/*}/tazpupsave"
- export ROOT='/mnt/home/devX_TazPup_s243a_1.0'
- export TMP='/tmp/InstallAndBuild'
- export FirstInstall=true
- export BuildDevX=false
- export BashAsSh=true
- export InstallCoreUtils=true
- export InstallDev=true
- export Large=false
- export tinypy=true
- export runEvals=true
- export icu=false #Globalization Libraries (Ignored if Large=true)
- export InstallPackages=true
- export InstallCoreUtils=true
- export extractPackages=true
- export GCC_VERSION=1
- mkdir -p "$TMP"
- rm "$TMP"/To_Install
- rm "$TMP"/For_DevX
- rm "$TMP"/Should_Be_Standard
- rm "$TMP"/To_Eval
- rm "$TMP"/To_Extract
- #cd $THIS_DIR
- #https://stackoverflow.com/questions/2337616/can-i-read-line-from-a-heredoc-in-bash
- while read line; do
- echo "$line"
- line=$( echo "$line" | tr -s [:blank:] )
- case "$line" in
- "#"*)
- #do nothing
- ;;
- "I "*) #Install if this is the first time running this script (New Installation)
- [ $FirstInstall ] && echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> $TMP/To_Install
- ;;
- "Id "*)
- #Install if this is the first time running this script (New Installation)
- [ $FirstInstall ] && [ $InstallDev ] && echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> "$TMP/To_Install"
- echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> "$TMP/For_DevX"
- ;;
- "i "*)
- echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> "$TMP/To_Install"
- ;;
- "id "*)
- [ $InstallDev ] && echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> "$TMP/To_Install"
- echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> "$TMP/For_DevX"
- ;;
- "d *")
- echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> "$TMP/For_DevX"
- ;;
- "L_i "*)
- [ $Large ] && echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> "$TMP/To_Install"
- ;;
- "L_id "*)
- [ $Large ] && [ $InstallDev ] && echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> "$TMP/To_Install"
- [ $Large ] && echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> "$TMP/For_DevX"; ;;
- "s "*) #Check if these are installed, I flagged them because they are important and should be standard but I don't know for sure
- echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> "$TMP/Should_Be_Standard"; ;;
- "!eval "*) #To Eval
- echo "$line" | tr -s [:blank:] | cut -d' ' -f2-10 >> "$TMP/To_Eval"; ;;
- "e "*) #Extract a package
- echo "$line" | tr -s [:blank:] | cut -d' ' -f2 >> "$TMP/To_Extract"; ;;
- esac
- #done < <( echo <<EOM
- done <<EOM
- # First any glib changes
- /var/lib/tazpkg/installed/bash
- $( if [ $BashAsSh == true ]; then
- echo "i /var/lib/tazpkg/installed/bash
- !eval cd /bin;
- !eval rm 'sh';
- !eval ln -s bash sh
- !eval changeSheBang /usr/sbin/snapmergepuppy /bin/bash"
- fi )
- $( if [ $InstallCoreUtils == true ]; then
- echo "e /tazpkg/installed/coreutils-multicall
- !eval copyExtracted coreutils-multicall /usr/bin/readlink
- !eval copyExtracted coreutils-multicall /usr/libexec/coreutils/libstdbuf.so
- !eval copyExtracted coreutils-multicall /usr/bin/coreutils
- !eval cd /usr/bin; rm readlink; ln -s coreutils readlink"
- fi )
- s /var/lib/tazpkg/installed/libssl
- s /var/lib/tazpkg/installed/lz4
- s /var/lib/tazpkg/installed/lzlib
- s /var/lib/tazpkg/installed/openssl
- i /var/lib/tazpkg/installed/get-palemoon
- i /var/lib/tazpkg/installed/perl-core
- s /var/lib/tazpkg/installed/pygtk
- i /var/lib/tazpkg/installed/qt4
- i /var/lib/tazpkg/installed/rox-default-icons
- i /var/lib/tazpkg/installed/rox-filer
- i /var/lib/tazpkg/installed/rox-filer-locales
- i /var/lib/tazpkg/installed/tinypy
- EOM
- copyExtracted(){
- PKG_Name="$( basename "$1" )"
- DIR_NAME="$( dirname $2)"
- VERSION=`tazpkg info $PKG_Name | grep 'Version' | sed 's/.*://'|cut -c 6-`
- cd "$TMP"/"$PKG_Name"-"$VERSION/fs"
- pwd
- mkdir -p "$DIR_NAME"
- cp -a -u ."$2" "$2"
- }
- changeSheBang(){
- if [ -f $1 ]; then
- cp $1 $1-old
- CHMOD_VAL="$( stat -c %a $1 )"
- rm $1
- line_num=1
- while read line; do
- if [ $line_num -eq 1 ]; then
- echo "#!$2" >> "$1"
- else
- echo "$line" >> "$1"
- fi
- line_num=`expr $line_num + 1`
- done <"$1-old"
- chmod "$CHMOD_VAL" "$1"
- fi
- }
- if [ $InstallPackages == true ]; then
- echo '============ INSTALLING PACKAGES ====================='
- while read PKG; do
- [ -f "$PKG" ] || tazpkg get-install "$( basename "$PKG" )"
- done <"$TMP/To_Install"
- while read PKG; do
- [ -f "$PKG" ] || tazpkg get-install "$( basename "$PKG" )"
- done <"$TMP/Should_Be_Standard"
- fi
- if [ $extractPackages == true ]; then
- echo '============ EXTRACTING PACKAGES ====================='
- cd "$TMP"
- while read PKG; do
- PKG_Name="$( basename "$PKG" )"
- tazpkg get $PKG_Name
- VERSION=`tazpkg info $PKG_Name | grep 'Version' | sed 's/.*://'|cut -c 6-`
- tazpkg extract "$PKG_Name"-"$VERSION".tazpkg "."
- done <"$TMP/To_Extract"
- fi
- copyPackage(){
- PACKAGE=$1
- if [ -n "$2" ]; then
- aRoot="$2"
- else
- aROOT="$ROOT"
- fi
- if [ -f $PACKAGE/files.list ]; then
- while read line; do
- DIR=$( dirname "$line" )
- mkdir -p "$aROOT$DIR"
- cp -a -u "$line" "$aROOT$line"
- done <"$PACKAGE/files.list"
- else
- #mkdir -p /t
- cd "$TMP"
- PKG_Name="$( basename "$PACKAGE" )"
- tazpkg get $PKG_Name
- VERSION=`tazpkg info $PKG_Name | grep 'Version' | sed 's/.*://'|cut -c 6-`
- tazpkg extract "$PKG_Name"-"$VERSION".tazpkg "$ROOT"
- fi
- }
- if [ $BuildDevX == true ]; then
- echo '============ BUILDING DEVX ====================='
- while read PKG; do
- copyPackage "$PKG"
- done <"$TMP/For_DevX"
- mksquashfs "$ROOT" devX_TazPup_s243a_1.0.sfs -comp xz -Xbcj arm -noappend
- fi
- if [ $runEvals == true ]; then
- echo '============ RUNNING EVALS ====================='
- while read toEval; do
- eval "$toEval"
- done <"$TMP/To_Eval"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement