├── tools ├── mac │ ├── bin │ │ └── make_ext4fs │ ├── lib │ │ ├── liblog.dylib │ │ ├── libcutils.dylib │ │ ├── libpcre2.dylib │ │ └── libselinux.dylib │ └── lib64 │ │ ├── liblog.dylib │ │ ├── libpcre2.dylib │ │ ├── libcutils.dylib │ │ └── libselinux.dylib └── linux │ └── bin │ ├── make_ext4fs_32 │ └── make_ext4fs_64 ├── Extra ├── sGSI-ify.sh ├── AB2A.sh └── sGSI-ify_ab.sh ├── CLT-ify.sh └── CLT-ify_ab.sh /tools/mac/bin/make_ext4fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erfanoabdi/Capire-Le-Treble/HEAD/tools/mac/bin/make_ext4fs -------------------------------------------------------------------------------- /tools/mac/lib/liblog.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erfanoabdi/Capire-Le-Treble/HEAD/tools/mac/lib/liblog.dylib -------------------------------------------------------------------------------- /tools/linux/bin/make_ext4fs_32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erfanoabdi/Capire-Le-Treble/HEAD/tools/linux/bin/make_ext4fs_32 -------------------------------------------------------------------------------- /tools/linux/bin/make_ext4fs_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erfanoabdi/Capire-Le-Treble/HEAD/tools/linux/bin/make_ext4fs_64 -------------------------------------------------------------------------------- /tools/mac/lib/libcutils.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erfanoabdi/Capire-Le-Treble/HEAD/tools/mac/lib/libcutils.dylib -------------------------------------------------------------------------------- /tools/mac/lib/libpcre2.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erfanoabdi/Capire-Le-Treble/HEAD/tools/mac/lib/libpcre2.dylib -------------------------------------------------------------------------------- /tools/mac/lib/libselinux.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erfanoabdi/Capire-Le-Treble/HEAD/tools/mac/lib/libselinux.dylib -------------------------------------------------------------------------------- /tools/mac/lib64/liblog.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erfanoabdi/Capire-Le-Treble/HEAD/tools/mac/lib64/liblog.dylib -------------------------------------------------------------------------------- /tools/mac/lib64/libpcre2.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erfanoabdi/Capire-Le-Treble/HEAD/tools/mac/lib64/libpcre2.dylib -------------------------------------------------------------------------------- /tools/mac/lib64/libcutils.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erfanoabdi/Capire-Le-Treble/HEAD/tools/mac/lib64/libcutils.dylib -------------------------------------------------------------------------------- /tools/mac/lib64/libselinux.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erfanoabdi/Capire-Le-Treble/HEAD/tools/mac/lib64/libselinux.dylib -------------------------------------------------------------------------------- /Extra/sGSI-ify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Project Capire le treble (CLT) by Erfan Abdi 4 | 5 | usage() 6 | { 7 | echo "Usage: $0 " 8 | echo -e "\tPath to GSI system : Mount GSI and set mount point" 9 | echo -e "\tSystem Partition Size : set system Partition Size" 10 | echo -e "\tOutput File : set Output file path (system.img)" 11 | } 12 | 13 | if [ "$3" == "" ]; then 14 | echo "ERROR: Enter all needed parameters" 15 | usage 16 | exit 1 17 | fi 18 | 19 | gsi=$1 20 | syssize=$2 21 | output=$3 22 | 23 | LOCALDIR=`pwd` 24 | tempdirname="tmp" 25 | tempdir="$LOCALDIR/$tempdirname" 26 | systemdir="$tempdir/system" 27 | toolsdir="$LOCALDIR/../tools" 28 | 29 | echo "Create Temp dir" 30 | mkdir -p "$systemdir" 31 | 32 | echo "Copy GSI Rom Files" 33 | ( cd "$gsi" ; sudo tar cf - . ) | ( cd "$systemdir" ; sudo tar xf - ) 34 | cd "$LOCALDIR" 35 | 36 | echo "Edit whatever you want and" 37 | read -n 1 -s -r -p "Press any key to continue" 38 | 39 | echo "Prepare File Contexts" 40 | p="/plat_file_contexts" 41 | n="/nonplat_file_contexts" 42 | for f in "$systemdir/etc/selinux" "$systemdir/vendor/etc/selinux"; do 43 | if [[ -f "$f$p" ]]; then 44 | sudo cat "$f$p" >> "$tempdir/file_contexts" 45 | fi 46 | if [[ -f "$f$n" ]]; then 47 | sudo cat "$f$n" >> "$tempdir/file_contexts" 48 | fi 49 | done 50 | 51 | if [[ -f "$tempdir/file_contexts" ]]; then 52 | fcontexts="-S $tempdir/file_contexts" 53 | fi 54 | 55 | if [[ "$OSTYPE" == "linux-gnu" ]]; then 56 | if [[ $(getconf LONG_BIT) = "64" ]]; then 57 | make_ext4fs="$toolsdir/linux/bin/make_ext4fs_64" 58 | else 59 | make_ext4fs="$toolsdir/linux/bin/make_ext4fs_32" 60 | fi 61 | elif [[ "$OSTYPE" == "darwin"* ]]; then 62 | make_ext4fs="$toolsdir/mac/bin/make_ext4fs" 63 | else 64 | echo "Not Supported OS for make_ext4fs" 65 | echo "Removing Temp dir" 66 | sudo rm -rf "$tempdir" 67 | exit 1 68 | fi 69 | 70 | echo "Create Image" 71 | sudo $make_ext4fs -T 0 $fcontexts -l $syssize -L system -a system -s "$output" "$systemdir/" 72 | 73 | echo "Remove Temp dir" 74 | #sudo rm -rf "$tempdir" 75 | -------------------------------------------------------------------------------- /Extra/AB2A.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Convert AB to A-only by Erfan Abdi 4 | 5 | declare -a abfiles=( 6 | etc/init/bufferhubd.rc 7 | etc/init/cppreopts.rc 8 | etc/init/otapreopt.rc 9 | etc/init/performanced.rc 10 | etc/init/recovery-persist.rc 11 | etc/init/recovery-refresh.rc 12 | etc/init/update_engine.rc 13 | etc/init/update_verifier.rc 14 | etc/init/virtual_touchpad.rc 15 | bin/update_engine 16 | bin/update_verifier 17 | ) 18 | 19 | usage() 20 | { 21 | echo "Usage: $0 " 22 | echo -e "\tPath to AB system : Mount AB system image and set mount point" 23 | echo -e "\tSystem Partition Size : set system Partition Size" 24 | echo -e "\tOutput File : set Output file path (system.img)" 25 | } 26 | 27 | if [ "$3" == "" ]; then 28 | echo "ERROR: Enter all needed parameters" 29 | usage 30 | exit 1 31 | fi 32 | 33 | ab="$1/system" 34 | syssize=$2 35 | output=$3 36 | 37 | LOCALDIR=`pwd` 38 | tempdirname="tmp" 39 | tempdir="$LOCALDIR/$tempdirname" 40 | systemdir="$tempdir/system" 41 | toolsdir="$LOCALDIR/../tools" 42 | 43 | echo "Create Temp dir" 44 | mkdir -p "$systemdir" 45 | 46 | echo "Copy AB Rom Files" 47 | ( cd "$ab" ; sudo tar cf - . ) | ( cd "$systemdir" ; sudo tar xf - ) 48 | cd "$LOCALDIR" 49 | 50 | for abfile in "${abfiles[@]}" 51 | do 52 | rm -rf "$systemdir/$abfile" 53 | done 54 | 55 | echo "Prepare File Contexts" 56 | p="/plat_file_contexts" 57 | n="/nonplat_file_contexts" 58 | for f in "$systemdir/etc/selinux" "$systemdir/vendor/etc/selinux"; do 59 | if [[ -f "$f$p" ]]; then 60 | sudo cat "$f$p" >> "$tempdir/file_contexts" 61 | fi 62 | if [[ -f "$f$n" ]]; then 63 | sudo cat "$f$n" >> "$tempdir/file_contexts" 64 | fi 65 | done 66 | 67 | if [[ -f "$tempdir/file_contexts" ]]; then 68 | fcontexts="-S $tempdir/file_contexts" 69 | fi 70 | 71 | if [[ "$OSTYPE" == "linux-gnu" ]]; then 72 | if [[ $(getconf LONG_BIT) = "64" ]]; then 73 | make_ext4fs="$toolsdir/linux/bin/make_ext4fs_64" 74 | else 75 | make_ext4fs="$toolsdir/linux/bin/make_ext4fs_32" 76 | fi 77 | elif [[ "$OSTYPE" == "darwin"* ]]; then 78 | make_ext4fs="$toolsdir/mac/bin/make_ext4fs" 79 | else 80 | echo "Not Supported OS for make_ext4fs" 81 | echo "Removing Temp dir" 82 | sudo rm -rf "$tempdir" 83 | exit 1 84 | fi 85 | 86 | echo "Create Image" 87 | sudo $make_ext4fs -T 0 $fcontexts -l $syssize -L system -a system -s "$output" "$systemdir/" 88 | 89 | echo "Remove Temp dir" 90 | sudo rm -rf "$tempdir" 91 | 92 | -------------------------------------------------------------------------------- /Extra/sGSI-ify_ab.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Project Capire le treble (CLT) by Erfan Abdi 4 | 5 | usage() 6 | { 7 | echo "Usage: $0 " 8 | echo -e "\tPath to GSI system : Mount GSI and set mount point" 9 | echo -e "\tSystem Partition Size : set system Partition Size" 10 | echo -e "\tOutput File : set Output file path (system.img)" 11 | } 12 | 13 | if [ "$3" == "" ]; then 14 | echo "ERROR: Enter all needed parameters" 15 | usage 16 | exit 1 17 | fi 18 | 19 | gsi=$1 20 | syssize=$2 21 | output=$3 22 | 23 | LOCALDIR=`pwd` 24 | tempdirname="tmp" 25 | tempdir="$LOCALDIR/$tempdirname" 26 | systemdir="$tempdir/system" 27 | toolsdir="$LOCALDIR/../tools" 28 | 29 | echo "Create Temp dir" 30 | mkdir -p "$systemdir" 31 | 32 | echo "Copy GSI Rom Files" 33 | ( cd "$gsi" ; sudo tar cf - . ) | ( cd "$systemdir" ; sudo tar xf - ) 34 | cd "$LOCALDIR" 35 | 36 | echo "Edit whatever you want and" 37 | read -n 1 -s -r -p "Press any key to continue" 38 | 39 | echo "Prepare File Contexts" 40 | p="/plat_file_contexts" 41 | n="/nonplat_file_contexts" 42 | for f in "$systemdir/system/etc/selinux" "$systemdir/system/vendor/etc/selinux"; do 43 | if [[ -f "$f$p" ]]; then 44 | sudo cat "$f$p" >> "$tempdir/file_contexts" 45 | fi 46 | if [[ -f "$f$n" ]]; then 47 | sudo cat "$f$n" >> "$tempdir/file_contexts" 48 | fi 49 | done 50 | 51 | if [[ -f "$tempdir/file_contexts" ]]; then 52 | echo "/firmware(/.*)? u:object_r:firmware_file:s0" >> "$tempdir/file_contexts" 53 | echo "/bt_firmware(/.*)? u:object_r:bt_firmware_file:s0" >> "$tempdir/file_contexts" 54 | echo "/persist(/.*)? u:object_r:persist_file:s0" >> "$tempdir/file_contexts" 55 | echo "/dsp u:object_r:rootfs:s0" >> "$tempdir/file_contexts" 56 | fcontexts="-S $tempdir/file_contexts" 57 | fi 58 | mkdir -p "$systemdir/bt_firmware" 59 | 60 | if [[ "$OSTYPE" == "linux-gnu" ]]; then 61 | if [[ $(getconf LONG_BIT) = "64" ]]; then 62 | make_ext4fs="$toolsdir/linux/bin/make_ext4fs_64" 63 | else 64 | make_ext4fs="$toolsdir/linux/bin/make_ext4fs_32" 65 | fi 66 | elif [[ "$OSTYPE" == "darwin"* ]]; then 67 | make_ext4fs="$toolsdir/mac/bin/make_ext4fs" 68 | else 69 | echo "Not Supported OS for make_ext4fs" 70 | echo "Removing Temp dir" 71 | sudo rm -rf "$tempdir" 72 | exit 1 73 | fi 74 | 75 | echo "Create Image" 76 | sudo $make_ext4fs -T 0 $fcontexts -l $syssize -L / -a / -s "$output" "$systemdir/" 77 | 78 | echo "Remove Temp dir" 79 | #sudo rm -rf "$tempdir" 80 | -------------------------------------------------------------------------------- /CLT-ify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Project Capire le treble (CLT) by Erfan Abdi 4 | 5 | usage() 6 | { 7 | echo "Usage: $0 [proprietary-files.txt]" 8 | echo -e "\tPath to Orginal system : Mount treblized lineage system image and set mount point" 9 | echo -e "\tPath to GSI system : Mount GSI and set mount point" 10 | echo -e "\tSystem Partition Size : set system Partition Size" 11 | echo -e "\tOutput File : set Output file path (system.img)" 12 | echo -e "\tproprietary-files.txt : enter proprietary-files.txt if you want to copy any file from orginal system to target" 13 | } 14 | 15 | if [ "$4" == "" ]; then 16 | echo "ERROR: Enter all needed parameters" 17 | usage 18 | exit 1 19 | fi 20 | 21 | lineage=$1 22 | gsi=$2 23 | syssize=$3 24 | output=$4 25 | 26 | LOCALDIR=`pwd` 27 | tempdirname="tmp" 28 | tempdir="$LOCALDIR/$tempdirname" 29 | systemdir="$tempdir/system" 30 | toolsdir="$LOCALDIR/tools" 31 | 32 | echo "Create Temp dir" 33 | mkdir -p "$systemdir" 34 | 35 | echo "Copy GSI Rom Files" 36 | ( cd "$gsi" ; sudo tar cf - . ) | ( cd "$systemdir" ; sudo tar xf - ) 37 | cd "$LOCALDIR" 38 | 39 | echo "Remove Vendor Symlink" 40 | sudo rm -rf "$systemdir/vendor" 41 | 42 | echo "Copy Vendor Dir to Temp" 43 | ( cd "$lineage" ; sudo tar cf - "vendor" ) | ( cd "$systemdir" ; sudo tar xf - ) 44 | cd "$LOCALDIR" 45 | 46 | if [ "$5" != "" ]; then 47 | echo "Copy System Prop Files" 48 | proptxt=$5 49 | while read -r line 50 | do 51 | line=`echo "$line" | grep -v vendor/` 52 | [[ $line = \#* ]] && continue 53 | [ -z "$line" ] && continue 54 | if [[ $line = '-'* ]] 55 | then 56 | line=`echo "$line" | cut -c2-` 57 | fi 58 | if [[ $line = '?'* ]] 59 | then 60 | line=`echo "$line" | cut -c2-` 61 | file=`echo "$line" | cut -d ":" -f 2 | cut -d "|" -f 1` 62 | filedir=`echo $file | rev | cut -d "/" -f 2- | rev` 63 | sudo mkdir -p "$systemdir/$filedir" 64 | sudo cp -npr "$lineage/$file" "$systemdir/$filedir/" 65 | continue 66 | fi 67 | file=`echo "$line" | cut -d ":" -f 2 | cut -d "|" -f 1` 68 | filedir=`echo $file | rev | cut -d "/" -f 2- | rev` 69 | sudo mkdir -p "$systemdir/$filedir" 70 | sudo cp -fpr "$lineage/$file" "$systemdir/$filedir/" 71 | done < "$proptxt" 72 | fi 73 | 74 | echo "Prepare File Contexts" 75 | p="/plat_file_contexts" 76 | n="/nonplat_file_contexts" 77 | for f in "$systemdir/etc/selinux" "$systemdir/vendor/etc/selinux"; do 78 | if [[ -f "$f$p" ]]; then 79 | sudo cat "$f$p" >> "$tempdir/file_contexts" 80 | fi 81 | if [[ -f "$f$n" ]]; then 82 | sudo cat "$f$n" >> "$tempdir/file_contexts" 83 | fi 84 | done 85 | 86 | if [[ -f "$tempdir/file_contexts" ]]; then 87 | fcontexts="-S $tempdir/file_contexts" 88 | fi 89 | 90 | if [[ "$OSTYPE" == "linux-gnu" ]]; then 91 | if [[ $(getconf LONG_BIT) = "64" ]]; then 92 | make_ext4fs="$toolsdir/linux/bin/make_ext4fs_64" 93 | else 94 | make_ext4fs="$toolsdir/linux/bin/make_ext4fs_32" 95 | fi 96 | elif [[ "$OSTYPE" == "darwin"* ]]; then 97 | make_ext4fs="$toolsdir/mac/bin/make_ext4fs" 98 | else 99 | echo "Not Supported OS for make_ext4fs" 100 | echo "Removing Temp dir" 101 | sudo rm -rf "$tempdir" 102 | exit 1 103 | fi 104 | 105 | echo "Create Image" 106 | sudo $make_ext4fs -T 0 $fcontexts -l $syssize -L system -a system -s "$output" "$systemdir/" 107 | 108 | echo "Remove Temp dir" 109 | sudo rm -rf "$tempdir" 110 | -------------------------------------------------------------------------------- /CLT-ify_ab.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Project Capire le treble (CLT) by Erfan Abdi 4 | # Modified for AB type devices by Pranav Bedre 5 | 6 | usage() 7 | { 8 | echo "Usage: $0 [proprietary-files.txt]" 9 | echo -e "\tPath to Orginal system : Mount treblized lineage system image and set mount point" 10 | echo -e "\tPath to GSI system : Mount GSI and set mount point" 11 | echo -e "\tSystem Partition Size : set system Partition Size" 12 | echo -e "\tOutput File : set Output file path (system.img)" 13 | echo -e "\tproprietary-files.txt : enter proprietary-files.txt if you want to copy any file from orginal system to target" 14 | } 15 | 16 | if [ "$4" == "" ]; then 17 | echo "ERROR: Enter all needed parameters" 18 | usage 19 | exit 1 20 | fi 21 | 22 | lineage=$1 23 | gsi=$2 24 | syssize=$3 25 | output=$4 26 | 27 | LOCALDIR=`pwd` 28 | tempdirname="tmp" 29 | tempdir="$LOCALDIR/$tempdirname" 30 | systemdir="$tempdir/system" 31 | toolsdir="$LOCALDIR/tools" 32 | 33 | echo "Create Temp dir" 34 | mkdir -p "$systemdir" 35 | 36 | echo "Copy Lineage RootDir Files to Temp" 37 | ( cd "$lineage" ; sudo tar cf - --exclude="./system" . ) | ( cd "$systemdir" ; sudo tar xf - ) 38 | cd "$LOCALDIR" 39 | 40 | echo "Copy GSI System to Temp" 41 | ( cd "$gsi" ; sudo tar cf - "system" ) | ( cd "$systemdir" ; sudo tar xf - ) 42 | cd "$LOCALDIR" 43 | 44 | echo "Remove Vendor Symlink" 45 | sudo rm -rf "$systemdir/system/vendor" 46 | 47 | echo "Copy Vendor Dir to Temp" 48 | ( cd "$lineage/system" ; sudo tar cf - "vendor" ) | ( cd "$systemdir/system" ; sudo tar xf - ) 49 | cd "$LOCALDIR" 50 | 51 | if [ "$5" != "" ]; then 52 | echo "Copy System Prop Files" 53 | proptxt=$5 54 | while read -r line 55 | do 56 | line=`echo "$line" | grep -v vendor/` 57 | [[ $line = \#* ]] && continue 58 | [ -z "$line" ] && continue 59 | if [[ $line = '-'* ]] 60 | then 61 | line=`echo "$line" | cut -c2-` 62 | fi 63 | if [[ $line = '?'* ]] 64 | then 65 | line=`echo "$line" | cut -c2-` 66 | file=`echo "$line" | cut -d ":" -f 2 | cut -d "|" -f 1` 67 | filedir=`echo $file | rev | cut -d "/" -f 2- | rev` 68 | sudo mkdir -p "$systemdir/system/$filedir" 69 | sudo cp -npr "$lineage/system/$file" "$systemdir/system/$filedir/" 70 | continue 71 | fi 72 | file=`echo "$line" | cut -d ":" -f 2 | cut -d "|" -f 1` 73 | filedir=`echo $file | rev | cut -d "/" -f 2- | rev` 74 | sudo mkdir -p "$systemdir/system/$filedir" 75 | sudo cp -fpr "$lineage/system/$file" "$systemdir/system/$filedir/" 76 | done < "$proptxt" 77 | fi 78 | 79 | echo "Prepare File Contexts" 80 | p="/plat_file_contexts" 81 | n="/nonplat_file_contexts" 82 | for f in "$systemdir/system/etc/selinux" "$systemdir/system/vendor/etc/selinux" "$systemdir"; do 83 | if [[ -f "$f$p" ]]; then 84 | sudo cat "$f$p" >> "$tempdir/file_contexts_tmp" 85 | fi 86 | if [[ -f "$f$n" ]]; then 87 | sudo cat "$f$n" >> "$tempdir/file_contexts_tmp" 88 | fi 89 | done 90 | 91 | sudo sort "$tempdir/file_contexts_tmp" | uniq >> "$tempdir/file_contexts" 92 | 93 | if [[ -f "$tempdir/file_contexts" ]]; then 94 | fcontexts="-S $tempdir/file_contexts" 95 | fi 96 | 97 | if [[ "$OSTYPE" == "linux-gnu" ]]; then 98 | if [[ $(getconf LONG_BIT) = "64" ]]; then 99 | make_ext4fs="$toolsdir/linux/bin/make_ext4fs_64" 100 | else 101 | make_ext4fs="$toolsdir/linux/bin/make_ext4fs_32" 102 | fi 103 | elif [[ "$OSTYPE" == "darwin"* ]]; then 104 | make_ext4fs="$toolsdir/mac/bin/make_ext4fs" 105 | else 106 | echo "Not Supported OS for make_ext4fs" 107 | echo "Removing Temp dir" 108 | sudo rm -rf "$tempdir" 109 | exit 1 110 | fi 111 | 112 | echo "Create Image" 113 | sudo $make_ext4fs -T 0 $fcontexts -l $syssize -L / -a / -s "$output" "$systemdir/" 114 | 115 | echo "Remove Temp dir" 116 | sudo rm -rf "$tempdir" 117 | --------------------------------------------------------------------------------