mirror of
https://github.com/kneutron/ansitest.git
synced 2025-01-30 05:02:54 +08:00
Add files via upload
This commit is contained in:
parent
6964e252a3
commit
105dc141ef
70
flist-reconcile.sh
Normal file
70
flist-reconcile.sh
Normal file
@ -0,0 +1,70 @@
|
||||
#!/bin/bash5
|
||||
|
||||
debugg=0
|
||||
|
||||
if [ $debugg -gt 0 ]; then
|
||||
echo "$(date) Running flist 1st JIC"
|
||||
time flist
|
||||
fi
|
||||
|
||||
# failexit.mrg
|
||||
function failexit () {
|
||||
echo '! Something failed! Code: '"$1 $2" # code # (and optional description)
|
||||
exit $1
|
||||
}
|
||||
|
||||
todel=/tmp/todel-flist.txt
|
||||
>$todel # clearit
|
||||
|
||||
# if flist with no tar, del
|
||||
|
||||
declare -i fl tr # integer
|
||||
fl=$(ls flist* |wc -l |awk '{print $1}')
|
||||
tr=$(ls *tar* |grep -v flist |wc -l |awk '{print $1}')
|
||||
echo "Flists: $fl -- Tars: $tr"
|
||||
[[ $fl == $tr ]] && failexit 0 "Flists match tars, evyting OK"
|
||||
|
||||
# regular array
|
||||
declare -a flists=$(ls flist*)
|
||||
|
||||
for c in ${flists[@]}; do
|
||||
proc1=$(basename $c .txt) # strip .txt from end
|
||||
proc2=${proc1:7} # easy strip flist--
|
||||
if [ $debugg -gt 0 ]; then
|
||||
[ -e $proc2.tar* ] && echo "MATCH $c" || echo "NOTMATCH $c"
|
||||
fi
|
||||
# [ -e $proc2.tar* ] || echo "NOTMATCH $c"
|
||||
[ -e $proc2.tar* ] || echo "$c" >> $todel
|
||||
done
|
||||
|
||||
echo "$(wc -l $todel) - hanging FLIST files to delete - Enter to process NON-INTERACTIVELY or ^C"
|
||||
read
|
||||
|
||||
while read inline; do
|
||||
[ "$inline" = "" ] && break
|
||||
ls -l "$inline" |awk '{print "Size:"$5" Date: "$6" "$7" "$8" "$9}' #|column -t
|
||||
/bin/rm -v "$inline"
|
||||
done < $todel
|
||||
# for some reason RM -i not working :(
|
||||
|
||||
# Cleanup
|
||||
# /bin/rm $todel
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
NOTE MAC OSX wc -l also prints filename, thats why we need 1st field only!
|
||||
|
||||
REF: https://tldp.org/LDP/abs/html/string-manipulation.html
|
||||
|
||||
la|awk '{print "Size:"$5" Date: "$6" "$7" "$8" "$9}' |column -t
|
||||
|
||||
Size:35077 Date: Jan 15 11:12 flist--bkp-home-dave-test-p2300m-deepin-sda6.txt
|
||||
|
||||
basename bkp-home--NORZ--p2300m-ultimate--20200626.tar1.tar .tar1.tar
|
||||
bkp-home--NORZ--p2300m-ultimate--20200626
|
||||
|
||||
missing tar: flist--bkp-home--fryserverantix19--NORZ--20210303.txt
|
||||
matches: flist--bkp-home-p2300m-deepin-sda6.txt
|
||||
01234567
|
||||
|
85
flist.sh
Normal file
85
flist.sh
Normal file
@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
|
||||
# NOTE this is an old version from original cubietruck! Mar 26 2014 flist
|
||||
|
||||
# Go thru .tar.gz, .tar.bz2 in dir and list them to flist-file
|
||||
function process () {
|
||||
args=$*
|
||||
echo $args
|
||||
|
||||
# if doing rezip, renice bzip2
|
||||
renice +1 `pidof bzip2` 2>/dev/null
|
||||
|
||||
# Preserve existing output
|
||||
if [ -e "flist--$bn.txt" ]; then
|
||||
echo '* Skipped '$bn
|
||||
else
|
||||
time $compr -cd $args |tar tvf - > flist--$bn.txt
|
||||
fi
|
||||
}
|
||||
#function processbz2 () {
|
||||
# args=$*
|
||||
# echo $args
|
||||
# time tar tjvf $args > flist--$bn
|
||||
#}
|
||||
|
||||
# If compare string not match any actual filename, move on
|
||||
for i in *.tar.gz; do
|
||||
[ "$i" == "*.tar.gz" ] && break;
|
||||
bn=`basename $i .tar.gz`
|
||||
compr=gzip
|
||||
process $i
|
||||
done
|
||||
|
||||
for i in *.tar1.gz; do
|
||||
[ "$i" == "*.tar1.gz" ] && break;
|
||||
bn=`basename $i .tar1.gz`
|
||||
compr=gzip
|
||||
process $i
|
||||
done
|
||||
|
||||
for i in *.tgz; do
|
||||
[ "$i" == "*.tgz" ] && break;
|
||||
bn=`basename $i .tgz`
|
||||
compr=gzip
|
||||
process $i
|
||||
done
|
||||
|
||||
for i in *.tar.bz2; do
|
||||
[ "$i" == "*.tar.bz2" ] && break;
|
||||
bn=`basename $i .tar.bz2`
|
||||
compr=bzip2
|
||||
process $i
|
||||
done
|
||||
|
||||
for i in *.tar.lzop; do
|
||||
[ "$i" == "*.tar.lzop" ] && break;
|
||||
bn=`basename $i .tar.lzop`
|
||||
compr=lzop
|
||||
process $i
|
||||
done
|
||||
|
||||
for i in *.tar1.lzop; do
|
||||
[ "$i" == "*.tar1.lzop" ] && break;
|
||||
bn=`basename $i .tar1.lzop`
|
||||
compr=lzop
|
||||
process $i
|
||||
done
|
||||
|
||||
for i in *.tar; do
|
||||
[ "$i" == "*.tar" ] && break;
|
||||
bn=`basename $i .tar`
|
||||
compr=""
|
||||
# process $i
|
||||
time tar tvf $i > flist--$bn.txt
|
||||
done
|
||||
|
||||
for i in *.tar1; do
|
||||
[ "$i" == "*.tar1" ] && break;
|
||||
bn=`basename $i .tar1`
|
||||
compr=""
|
||||
# process $i
|
||||
time tar tvf $i > flist--$bn.txt
|
||||
done
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user