From 153d299a41b9be4e15dab1ca29bb93a74bd2445d Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Fri, 29 Apr 2016 14:36:26 -0400 Subject: fix paths (in progress) --- old-school/squashfs-size | 88 ------------------------------------------------ 1 file changed, 88 deletions(-) delete mode 100755 old-school/squashfs-size (limited to 'old-school/squashfs-size') diff --git a/old-school/squashfs-size b/old-school/squashfs-size deleted file mode 100755 index 74b67d7..0000000 --- a/old-school/squashfs-size +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh - -squashfs_size_ratio() -{ - local fn="$1" - #FSIZE="$(stat -c "%s" "$fn")" - word5() { echo $5; } - FSIZE="$(word5 `ls -l "$fn"`)" - echo $(( $FSIZE * 3367 / 1000 )) -} - -squashfs_size_magicdb() -{ - - get() - { - local len=$1 - local off=$2 - local fn="$3" - #local OUT=( $(od -t d$len -N$len -j $off "$fn") ) - #echo "${OUT[1]}" - od -t u$len -N$len -j $off "$fn" | head -n1 | sed 's/.* //' - } - -# getReversedEndian() -# { -# local len=$1 -# local off=$2 -# local fn="$3" -# #local B=( $(od -t x$len -N$len -j $off "$fn") ) -# #B="${B[1]}" -# local B="$(od -t x$len -N$len -j $off "$fn" | head -n1 | cut -d' ' -f2)" -# local D= -# local C=$(( $len * 2 )) -# while [ $C -gt 0 ] -# do -# C=$(( $C - 2 )) -# D="$D${B:$C:2}" -# done -# D="0x$D" -# echo $D -# } - getReversedEndian() - { - local len=$1 - local off=$2 - local fn="$3" - local D= - local C=$len - while [ $C -gt 0 ] - do - C=$(( $C - 1 )) - D="$(od -t x1 -N1 -j $(($off+$C)) "$fn" | head -n1 | cut -d' ' -f2)$D" - done - D=$((0x$D)) - echo $D - } - - - local fn="$1" - - local M=$(get 4 0 "$fn") - local N=$(getReversedEndian 4 0 "$fn") - if [ $M -eq 1936814952 ] - then - # Proper endian. - local get=get - elif [ $N -eq 1936814952 ] - then - # Reversed endian. - local get=getReversedEndian - else - error not squashfs - fi - - local T=$($get 2 28 "$fn") - if [ $T -lt 3 ] - then - local BC=$($get 4 8 "$fn") - else - local BC=$($get 8 63 "$fn") - fi - - echo $BC -} - - -squashfs_size_ratio "$1" -- cgit v1.2.3