This commit is contained in:
milisbir 2017-12-13 16:05:54 +02:00
parent 0245a8a3f8
commit c0edb589bd
1 changed files with 28 additions and 11 deletions

39
bin/mps
View File

@ -271,7 +271,7 @@ paket_bilgi(){
if [ "$2" ]; then if [ "$2" ]; then
cikti="$2" cikti="$2"
fi fi
if [ $cikti == "--json" ];then if [ $cikti == "--html" ];then
_yaz="echo" _yaz="echo"
_yaz_uyari="echo" _yaz_uyari="echo"
_yaz_son="<br>" _yaz_son="<br>"
@ -286,13 +286,13 @@ paket_bilgi(){
if [ "$kkont" = "kurulu" ];then if [ "$kkont" = "kurulu" ];then
paket="$1" paket="$1"
satir=`sed -n '1p' < $VT/"$paket"/META` satir=`sed -n '1p' < $VT/"$paket"/META`
$_yaz "ADI :" ${satir:1:${#satir}-1} $_yaz_son $_yaz "ADI :" ${satir:1:${#satir}-1} #$_yaz_son
satir=`sed -n '2p' < $VT/"$paket"/META` satir=`sed -n '2p' < $VT/"$paket"/META`
$_yaz "TANIM :" ${satir:1:${#satir}-1} $_yaz_son $_yaz "TANIM :" ${satir:1:${#satir}-1} #$_yaz_son
satir=`sed -n '3p' < $VT/"$paket"/META` satir=`sed -n '3p' < $VT/"$paket"/META`
$_yaz "URL :" ${satir:1:${#satir}-1} $_yaz_son $_yaz "URL :" ${satir:1:${#satir}-1} #$_yaz_son
satir=`sed -n '5p' < $VT/"$paket"/META` satir=`sed -n '5p' < $VT/"$paket"/META`
$_yaz "PAKETÇİ :" ${satir:1:${#satir}-1} $_yaz_son $_yaz "PAKETÇİ :" ${satir:1:${#satir}-1} #$_yaz_son
satir=`sed -n '6p' < $VT/"$paket"/META` satir=`sed -n '6p' < $VT/"$paket"/META`
satir=${satir:1:${#satir}-1} satir=${satir:1:${#satir}-1}
printf -v boyut '%d\n' "$satir" 2>/dev/null printf -v boyut '%d\n' "$satir" 2>/dev/null
@ -303,17 +303,17 @@ paket_bilgi(){
boyut=$(($boyut/1024/1024)) boyut=$(($boyut/1024/1024))
_ek="mb" _ek="mb"
fi fi
$_yaz "KUR BOYUT :" "$boyut $_ek (tahmini)" $_yaz_son $_yaz "KUR BOYUT :" "$boyut $_ek (tahmini)" #$_yaz_son
satir=`sed -n '7p' < $VT/"$paket"/META` satir=`sed -n '7p' < $VT/"$paket"/META`
$_yaz "SÜRÜM :" ${satir:1:${#satir}-1} $_yaz_son $_yaz "SÜRÜM :" ${satir:1:${#satir}-1} #$_yaz_son
satir=`sed -n '8p' < $VT/"$paket"/META` satir=`sed -n '8p' < $VT/"$paket"/META`
$_yaz "DEVİR :" ${satir:1:${#satir}-1} $_yaz_son $_yaz "DEVİR :" ${satir:1:${#satir}-1} #$_yaz_son
satir=`sed -n '9p' < $VT/"$paket"/META` satir=`sed -n '9p' < $VT/"$paket"/META`
$_yaz "PAKETLENME :" `date -d @${satir:1:${#satir}-1}` $_yaz_son $_yaz "PAKETLENME :" `date -d @${satir:1:${#satir}-1}` #$_yaz_son
satir=`sed -n '10p' < $VT/"$paket"/META` satir=`sed -n '10p' < $VT/"$paket"/META`
$_yaz "MİMARİ :" ${satir:1:${#satir}-1} $_yaz_son $_yaz "MİMARİ :" ${satir:1:${#satir}-1} #$_yaz_son
satir=`sed -n '11p' < $VT/"$paket"/META` satir=`sed -n '11p' < $VT/"$paket"/META`
$_yaz "GRUP :" ${satir:1:${#satir}-1} $_yaz_son $_yaz "GRUP :" ${satir:1:${#satir}-1} #$_yaz_son
elif [ "$kkont" = "degil" ];then elif [ "$kkont" = "degil" ];then
$_yaz_uyari "$1 $_paket_kurulu_degil" $_yaz_uyari "$1 $_paket_kurulu_degil"
else else
@ -321,6 +321,22 @@ paket_bilgi(){
fi fi
} }
paket_bilgi_html(){
_dosya=$1
icerik="<table border=1>"
while IFS='' read -r satir || [[ -n "$line" ]]; do
icerik+="<tr>"
_sutun_baslik="$(echo $satir | cut -d':' -f1)"
_sutun_deger="$(echo $satir | cut -d':' -f2)"
icerik+="<td>$_sutun_baslik</td>"
icerik+="<td>$_sutun_deger</td>"
#[ '${_sutun_baslik}' <> '${_sutun_deger}' ] && icerik+="<td>$_sutun_deger</td>"
icerik+="</tr>"
done < "$_dosya"
icerik+="</table>"
echo "$icerik" > $_dosya.html
}
yeniden_paketle(){ yeniden_paketle(){
cd $1 cd $1
bsdtar -r -f ../"$1".mps .META bsdtar -r -f ../"$1".mps .META
@ -2501,6 +2517,7 @@ ayarlar() {
if [ $2 ];then if [ $2 ];then
touch "/tmp/mps_paket_bilgi_$2" touch "/tmp/mps_paket_bilgi_$2"
paket_bilgi "$2" "$3" | tee "/tmp/mps_paket_bilgi_$2" paket_bilgi "$2" "$3" | tee "/tmp/mps_paket_bilgi_$2"
[ $2 = "--html" ]; paket_bilgi_html "/tmp/mps_paket_bilgi_$2"
else else
ryaz 31 "paket ismi eksik" ryaz 31 "paket ismi eksik"
exit 1 exit 1