2016-02-24 01:27:23 +01:00
|
|
|
|
#!/bin/bash
|
2016-03-06 19:36:07 +01:00
|
|
|
|
. /etc/mpsd.conf
|
2016-03-07 00:39:49 +01:00
|
|
|
|
. /root/bin/fonks.sh
|
2016-02-24 01:27:23 +01:00
|
|
|
|
versiyon="0.1"
|
2016-03-11 17:42:21 +01:00
|
|
|
|
iletisim="milisarge@gmail.com"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
paketdepo="/depo/paketler/"
|
2016-03-18 02:20:00 +01:00
|
|
|
|
sunucu="192.168.3.193:8000/MPS/"
|
2016-03-07 00:39:49 +01:00
|
|
|
|
git_sunucu="https://github.com/milisarge/malfs-milis"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
ikaynak=""
|
|
|
|
|
betikad=${0##*/}
|
|
|
|
|
kurulum_onay="evet"
|
|
|
|
|
talimatname_dizin="/root/talimatname"
|
2016-02-25 01:08:35 +01:00
|
|
|
|
kokdizin="/"
|
2016-03-07 23:04:43 +01:00
|
|
|
|
VT="/var/lib/pkg/DB"
|
2016-03-09 01:57:13 +01:00
|
|
|
|
TARIHCE_DIZIN="/var/lib/pkg/tarihce"
|
2016-03-25 22:19:01 +01:00
|
|
|
|
tekrarkur="hayir"
|
|
|
|
|
lokal="tr"
|
2016-03-07 23:04:43 +01:00
|
|
|
|
|
2016-02-24 01:27:23 +01:00
|
|
|
|
|
|
|
|
|
icerik_ekle(){
|
|
|
|
|
paketad=`echo "$1" | cut -d'#' -f1`
|
|
|
|
|
paketad=`basename $paketad`
|
2016-03-07 01:43:25 +01:00
|
|
|
|
ryaz 34 $paketad" paketi kuruluyor."
|
2016-02-28 00:55:08 +01:00
|
|
|
|
tar -C /tmp --extract --file=$1 .PRE 1 2> /tmp/$paketad_pre.log
|
2016-02-26 02:41:51 +01:00
|
|
|
|
#kos-kur kontrolu
|
|
|
|
|
if [ -f /tmp/.PRE ];then
|
|
|
|
|
bash /tmp/.PRE
|
|
|
|
|
rm /tmp/.PRE
|
|
|
|
|
fi
|
2016-03-25 22:19:01 +01:00
|
|
|
|
mkdir -p kur.$paketad &&
|
|
|
|
|
tar xf $1 -C kur.$paketad &&
|
|
|
|
|
#istenmeyen yerellerin silinmesi
|
|
|
|
|
if [ -d kur.$paketad/usr/share/locale ];then
|
|
|
|
|
for lkl in `ls kur.$paketad/usr/share/locale/`;do
|
|
|
|
|
if [ "$lkl" != "$lokal" ];then rm -r kur.$paketad/usr/share/locale/$lkl; fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
mkdir -p /var/lib/pkg/DB/"$paketad" &&
|
|
|
|
|
cp -v -afr kur.$paketad/* $kokdizin > kur.$paketad/kurulan &&
|
|
|
|
|
cp kur.$paketad/kurulan /tmp/ &&cat kur.$paketad/kurulan | cut -d '>' -f2 > /var/lib/pkg/DB/"$paketad"/kurulan &&
|
|
|
|
|
#mv kur.$paketad/.MTREE /var/lib/pkg/DB/"$paketad"/files &&
|
|
|
|
|
mv kur.$paketad/.META /var/lib/pkg/DB/"$paketad"/META &&
|
2016-03-07 01:43:25 +01:00
|
|
|
|
|
2016-02-26 02:41:51 +01:00
|
|
|
|
#kur-kos calistirilmasi
|
2016-03-25 22:19:01 +01:00
|
|
|
|
if [ -f kur.$paketad/.POST ];then
|
|
|
|
|
bash kur.$paketad/.POST
|
|
|
|
|
rm kur.$paketad/.POST
|
2016-02-26 02:41:51 +01:00
|
|
|
|
fi
|
2016-03-25 22:19:01 +01:00
|
|
|
|
|
|
|
|
|
rm -r kur.$paketad
|
2016-03-21 18:23:43 +01:00
|
|
|
|
if [ -f /etc/ld.so.conf ];then
|
|
|
|
|
ldconfig
|
2016-02-24 01:27:23 +01:00
|
|
|
|
fi
|
2016-03-07 00:39:49 +01:00
|
|
|
|
ryaz 34 $paketad" paketi kuruldu."
|
2016-02-24 01:27:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-17 03:08:24 +01:00
|
|
|
|
icerik_ekle2(){
|
|
|
|
|
kokdizin=/mnt/lfs
|
|
|
|
|
paketad=`echo "$1" | cut -d'#' -f1`
|
|
|
|
|
paketad=`basename $paketad`
|
|
|
|
|
ryaz 34 $paketad" paketi kuruluyor."
|
|
|
|
|
tar -C /tmp --extract --file=$1 .PRE 1 2> /tmp/$paketad_pre.log
|
|
|
|
|
#kos-kur kontrolu
|
|
|
|
|
if [ -f /tmp/.PRE ];then
|
|
|
|
|
bash /tmp/.PRE
|
|
|
|
|
rm /tmp/.PRE
|
|
|
|
|
fi
|
2016-03-25 22:19:01 +01:00
|
|
|
|
mkdir -p kur.$paketad
|
|
|
|
|
tar xf $1 -C kur.$paketad &&
|
2016-03-17 03:08:24 +01:00
|
|
|
|
mkdir -p $kokdizin/var/lib/pkg/DB/"$paketad" &&
|
2016-03-25 22:19:01 +01:00
|
|
|
|
cp -avf kur.$paketad/* $kokdizin > kur.$paketad/kurulan &&
|
|
|
|
|
cat kur.$paketad/kurulan | cut -d '>' -f2 > $kokdizin/var/lib/pkg/DB/"$paketad"/kurulan
|
|
|
|
|
#mv kur.$paketad/.MTREE /var/lib/pkg/DB/"$paketad"/files &&
|
|
|
|
|
mv kur.$paketad/.META $kokdizin/var/lib/pkg/DB/"$paketad"/META &&
|
2016-03-17 03:08:24 +01:00
|
|
|
|
|
|
|
|
|
#kur-kos calistirilmasi
|
2016-03-25 22:19:01 +01:00
|
|
|
|
if [ -f kur.$paketad/.POST ];then
|
|
|
|
|
bash kur.$paketad/.POST
|
|
|
|
|
rm kur.$paketad/.POST
|
2016-03-17 03:08:24 +01:00
|
|
|
|
fi
|
|
|
|
|
#if [ -f $kokdizin.PRE ];then
|
|
|
|
|
# rm $kokdizin.PRE
|
|
|
|
|
#fi
|
|
|
|
|
#if [ -f $kokdizin/.okubeni ];then
|
|
|
|
|
# rm $kokdizin/.okubeni
|
|
|
|
|
#fi
|
|
|
|
|
#if [ -f $kokdizin/.README ];then
|
|
|
|
|
# rm $kokdizin/.README
|
|
|
|
|
#fi
|
2016-03-25 22:19:01 +01:00
|
|
|
|
rm -r kur.$paketad
|
2016-03-21 16:51:03 +01:00
|
|
|
|
if [ -f /tools/sbin/ldconfig ];then
|
|
|
|
|
/tools/sbin/ldconfig
|
|
|
|
|
else
|
|
|
|
|
/sbin/ldconfig
|
2016-03-17 03:08:24 +01:00
|
|
|
|
fi
|
|
|
|
|
ryaz 34 $paketad" paketi kuruldu."
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-07 22:12:18 +01:00
|
|
|
|
paket_sil(){
|
2016-03-10 01:28:42 +01:00
|
|
|
|
local paket kkont sil_onay oto_silme
|
2016-03-07 01:43:25 +01:00
|
|
|
|
paket="$1"
|
2016-03-10 01:28:42 +01:00
|
|
|
|
if [ "$2" ]; then
|
|
|
|
|
oto_silme="$2"
|
|
|
|
|
fi
|
2016-03-10 14:12:52 +01:00
|
|
|
|
kkont=`kurulu_kontrol "$1"`
|
|
|
|
|
if [ "$kkont" = "kurulu" ];then
|
|
|
|
|
if [ -f "/var/lib/pkg/DB/$paket/kurulan" ];then
|
2016-03-07 08:30:10 +01:00
|
|
|
|
cat /var/lib/pkg/DB/$paket/kurulan | cut -d '>' -f2 > /tmp/$paket.sil
|
2016-03-12 01:44:27 +01:00
|
|
|
|
ryaz 31 "ters bagimliliklar"
|
|
|
|
|
ryaz 31 "------------------"
|
|
|
|
|
ters_bagimli_kontrol "$paket"
|
|
|
|
|
ryaz 31 "------------------"
|
2016-03-10 01:28:42 +01:00
|
|
|
|
if [ "$oto_silme" = "evet" ];then
|
|
|
|
|
sil_onay="e"
|
|
|
|
|
else
|
|
|
|
|
while true; do
|
|
|
|
|
ryaz 34 $paket" paketi kaldırılsın mı?";read -p "e veya h-> " eh
|
|
|
|
|
case $eh in
|
|
|
|
|
[Ee]* ) sil_onay="e"; break;;
|
|
|
|
|
[Hh]* ) break;;
|
|
|
|
|
* ) echo "e veya h";;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
fi
|
2016-03-07 01:43:25 +01:00
|
|
|
|
if [ "$sil_onay" = "e" ];then
|
|
|
|
|
xargs rm -r -f < /tmp/$paket.sil &&
|
|
|
|
|
rm -r -f /var/lib/pkg/DB/"$paket" &&
|
|
|
|
|
ryaz 34 $paket" paketi silindi."
|
|
|
|
|
fi
|
|
|
|
|
rm -f /tmp/$paket.sil
|
|
|
|
|
else
|
2016-03-10 14:12:52 +01:00
|
|
|
|
ryaz 31 "kritik mesaj:kurulanlar dosyası yok."
|
2016-03-07 01:43:25 +01:00
|
|
|
|
fi
|
|
|
|
|
else
|
2016-03-10 14:12:52 +01:00
|
|
|
|
ryaz 32 "paket zaten kurulu değil!"
|
2016-03-07 01:43:25 +01:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-24 01:27:23 +01:00
|
|
|
|
paket_bilgi(){
|
|
|
|
|
local paket kkont
|
|
|
|
|
kkont=`kurulu_kontrol "$1"`
|
|
|
|
|
if [ "$kkont" = "kurulu" ];then
|
|
|
|
|
paket="$1"
|
|
|
|
|
cat /var/lib/pkg/DB/"$paket"/META
|
|
|
|
|
else
|
|
|
|
|
echo "paket kurulu değil!"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-19 00:16:01 +01:00
|
|
|
|
yeniden_paketle(){
|
2016-03-19 02:20:46 +01:00
|
|
|
|
cd $1
|
|
|
|
|
bsdtar -r -f ../"$1".mps .META
|
|
|
|
|
bsdtar -r -f ../"$1".mps *
|
|
|
|
|
cd ..
|
|
|
|
|
lzip -9 "$1".mps
|
2016-03-19 00:16:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-24 01:27:23 +01:00
|
|
|
|
derleme_listyap(){
|
2016-03-02 01:26:35 +01:00
|
|
|
|
bagimlist=`bagimlilar "$1"`
|
2016-02-24 01:27:23 +01:00
|
|
|
|
for bagim in $bagimlist;do
|
|
|
|
|
if [ "`cat derleme.liste | grep $bagim`" != "$bagim" ];then
|
|
|
|
|
derleme_listyap "$bagim"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
#if [ "`cat derleme.liste | grep $1`" != "$1" ];then
|
|
|
|
|
# echo "derleme.liste yazılıyor:" "$1"
|
|
|
|
|
# echo "$1" >> derleme.liste
|
|
|
|
|
#fi
|
|
|
|
|
if ! grep -Fxq "$1" derleme.liste
|
|
|
|
|
then
|
|
|
|
|
# echo "pas"
|
|
|
|
|
#else
|
2016-02-28 00:55:08 +01:00
|
|
|
|
ana="`find $talimatname_dizin -name $1`"
|
|
|
|
|
echo ${ana#"$talimatname_dizin"}
|
|
|
|
|
#sadece genel bagimliliklar derlenecek
|
2016-02-24 01:27:23 +01:00
|
|
|
|
echo "$1" >> derleme.liste
|
2016-02-28 00:55:08 +01:00
|
|
|
|
if [ -d "$talimatname_dizin/genel/$1" ];then
|
|
|
|
|
echo "$1" >> genel.derleme.liste
|
|
|
|
|
fi
|
2016-02-24 01:27:23 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-02 01:26:35 +01:00
|
|
|
|
derleme_listbilgi(){
|
2016-03-07 00:39:49 +01:00
|
|
|
|
ryaz 34 "yapim asamasında"
|
2016-03-02 01:26:35 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-24 01:27:23 +01:00
|
|
|
|
paket_derle_oto(){
|
2016-02-28 00:55:08 +01:00
|
|
|
|
for dpkt in `cat $1`;do
|
2016-02-24 01:27:23 +01:00
|
|
|
|
echo $dpkt "derleniyor...."
|
2016-03-10 12:42:16 +01:00
|
|
|
|
zorla_derle="yok"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
paket_derle $dpkt
|
|
|
|
|
done
|
|
|
|
|
}
|
2016-03-03 15:10:44 +01:00
|
|
|
|
#otomatik derle kontrollu kur
|
|
|
|
|
paket_derle_oto2(){
|
2016-03-23 06:53:40 +01:00
|
|
|
|
tekrarkur="hayir"
|
2016-03-03 15:10:44 +01:00
|
|
|
|
mps -dly "$1" > /dev/null && mps -odk genel.derleme.liste
|
|
|
|
|
}
|
2016-03-02 01:26:35 +01:00
|
|
|
|
|
|
|
|
|
paket_kur_oto(){
|
2016-03-12 00:09:47 +01:00
|
|
|
|
local kpkt pkt pak
|
2016-03-02 01:26:35 +01:00
|
|
|
|
for kpkt in `cat $1`;do
|
|
|
|
|
for pkt in `ls $kpkt* | cut -d'#' -f1`;do
|
2016-03-12 00:09:47 +01:00
|
|
|
|
pak=`ls "$pkt#"*`
|
|
|
|
|
mps -k "$pak"
|
2016-03-02 01:26:35 +01:00
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
}
|
2016-03-10 01:28:42 +01:00
|
|
|
|
|
2016-03-17 03:08:24 +01:00
|
|
|
|
paket_kur_liste(){
|
|
|
|
|
local kpkt pkt pak
|
|
|
|
|
for kpkt in `cat $1`;do
|
|
|
|
|
for pkt in `ls $kpkt* | cut -d'#' -f1`;do
|
|
|
|
|
pak=`ls "$pkt#"*`
|
|
|
|
|
mps -k2 "$pak"
|
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-17 04:08:47 +01:00
|
|
|
|
#otomatik kontrollu kur
|
2016-03-12 00:09:47 +01:00
|
|
|
|
paket_kur_oto2(){
|
|
|
|
|
mps -dly "$1" > /dev/null && mps -ok genel.derleme.liste
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-17 04:08:47 +01:00
|
|
|
|
paket_diskur_oto(){
|
|
|
|
|
local kpkt pkt pak
|
|
|
|
|
for kpkt in `cat $1`;do
|
|
|
|
|
mps -ik "$kpkt"
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#otomatik kontrollu kur
|
|
|
|
|
paket_diskur_oto2(){
|
|
|
|
|
mps -dly "$1" > /dev/null && mps -oik genel.derleme.liste
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-10 01:28:42 +01:00
|
|
|
|
paket_sil_oto(){
|
|
|
|
|
local spkt
|
|
|
|
|
for spkt in `cat $1`;do
|
|
|
|
|
oto_silme="evet"
|
|
|
|
|
paket_sil "$spkt" "$oto_silme"
|
|
|
|
|
done
|
|
|
|
|
}
|
2016-02-24 01:27:23 +01:00
|
|
|
|
|
|
|
|
|
paket_derle(){
|
2016-03-07 23:04:43 +01:00
|
|
|
|
#eski derleme kalıntılarını temizle
|
2016-03-12 14:27:37 +01:00
|
|
|
|
if [ -d tmp.* ];then
|
|
|
|
|
rm -r tmp.*
|
|
|
|
|
fi
|
2016-03-07 00:39:49 +01:00
|
|
|
|
kaynakdizin_kontrol
|
2016-02-24 01:27:23 +01:00
|
|
|
|
local konum derleme_onay eh bagimd
|
|
|
|
|
derleme_onay="h"
|
|
|
|
|
konum="`find "$talimatname_dizin" -name $1`"
|
|
|
|
|
if [ -d "$konum" ];then
|
|
|
|
|
mkdir -p tmp."$1"
|
|
|
|
|
cp -a $konum/* tmp."$1"/
|
|
|
|
|
cd tmp."$1"
|
2016-03-07 23:04:43 +01:00
|
|
|
|
if [ "`kurulu_kontrol "$1"`" = "kurulu" ] && [ "$zorla_derle" = "yok" ];then
|
2016-03-02 16:48:57 +01:00
|
|
|
|
derleme_onay="h"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
else
|
2016-03-07 23:04:43 +01:00
|
|
|
|
echo "-----"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
derleme_onay="e"
|
|
|
|
|
fi
|
|
|
|
|
if [ "$derleme_onay" = "e" ];then
|
2016-03-07 23:04:43 +01:00
|
|
|
|
ryaz 33 "$1" "derleniyor...."
|
2016-02-24 01:27:23 +01:00
|
|
|
|
#mpsd -d > /dev/null
|
2016-02-28 00:55:08 +01:00
|
|
|
|
#mpsd -d
|
|
|
|
|
echo "------------------------"
|
|
|
|
|
mpsd -d 2>&1|tee /tmp/"$1".log
|
|
|
|
|
if ( grep "^=======>" /tmp/"$1".log| tail -1 |grep "ERROR" > /dev/null);then
|
|
|
|
|
echo "derleme sisteminde hata oluştu -----> " /tmp/"$1".log
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2016-02-24 01:27:23 +01:00
|
|
|
|
if [ "$kurulum_onay" = "evet" ];then
|
|
|
|
|
for kpkt in `ls $1* | cut -d'#' -f1`;do
|
|
|
|
|
mps -k "$kpkt#"*
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
mv *.mps.lz ../
|
2016-03-07 23:04:43 +01:00
|
|
|
|
else
|
|
|
|
|
ryaz 32 "paket zaten kurulu,yine de derlemek için:
|
|
|
|
|
mps -zd $1"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
fi
|
|
|
|
|
cd ..
|
|
|
|
|
rm -r tmp."$1"
|
|
|
|
|
else
|
2016-03-07 23:04:43 +01:00
|
|
|
|
ryaz 31 "talimat dosyası bulunamadı."
|
2016-02-24 01:27:23 +01:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-03 15:10:44 +01:00
|
|
|
|
|
2016-03-02 01:26:35 +01:00
|
|
|
|
bagimlilar(){
|
2016-02-24 01:27:23 +01:00
|
|
|
|
local bagimd konum
|
|
|
|
|
konum="`find "$talimatname_dizin" -name $1`"
|
2016-03-02 16:12:51 +01:00
|
|
|
|
bagimd=`cat $konum/talimat | grep "Depends on" | cut -d':' -f2`
|
2016-03-02 01:26:35 +01:00
|
|
|
|
if [ -n "$bagimd" ]; then
|
|
|
|
|
bagimd=`echo "$bagimd" | sed 's/,/ /g'`
|
|
|
|
|
#sıralı gösterme
|
|
|
|
|
echo `echo "$bagimd" | sed 's/,/ /g'`
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bagimli_bilgi(){
|
|
|
|
|
local bagimd konum bag
|
|
|
|
|
konum="`find "$talimatname_dizin" -name $1`"
|
|
|
|
|
bagimd=`cat $konum/talimat | grep "Depends" | cut -d':' -f2`
|
|
|
|
|
if [ -n "$bagimd" ]; then
|
|
|
|
|
bagimd=`echo "$bagimd" | sed 's/,/ /g'`
|
|
|
|
|
#sıralı gösterme
|
|
|
|
|
#echo `echo "$bagimd" | sed 's/,/ /g'`
|
|
|
|
|
#kurulu kontrollu gosterim
|
|
|
|
|
for bag in $bagimd;do
|
|
|
|
|
echo $bag "`kurulu_kontrol $bag`"
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
echo "$1" "`kurulu_kontrol $1`"
|
2016-03-07 23:48:25 +01:00
|
|
|
|
|
2016-02-24 01:27:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-12 00:09:47 +01:00
|
|
|
|
ters_bagimli(){
|
|
|
|
|
local ara
|
|
|
|
|
ara=" $1 "
|
|
|
|
|
sy=`grep -o "/" <<<"$talimatname_dizin" | wc -l`
|
2016-03-12 01:44:27 +01:00
|
|
|
|
grep -rli "$ara" "$talimatname_dizin" | cut -d'/' -f`expr $sy + 3`
|
2016-03-12 01:06:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ters_bagimli_kontrol(){
|
2016-03-12 01:44:27 +01:00
|
|
|
|
ters_bagimli "$1" | sort > tersb.liste
|
|
|
|
|
ls /var/lib/pkg/DB/ | sed "/$1/d" | sort > simdiki.liste
|
2016-03-12 01:06:20 +01:00
|
|
|
|
comm -12 tersb.liste simdiki.liste
|
|
|
|
|
rm tersb.liste simdiki.liste
|
2016-03-12 00:09:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-24 01:27:23 +01:00
|
|
|
|
kurulu_kontrol(){
|
|
|
|
|
if [ -d "/var/lib/pkg/DB/$1" ];then
|
|
|
|
|
echo "kurulu"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
echo "degil"
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-07 00:39:49 +01:00
|
|
|
|
kaynakdizin_kontrol(){
|
|
|
|
|
if [ ! -d $DERLEME_KAYNAKDIZIN ];then
|
|
|
|
|
mkdir $DERLEME_KAYNAKDIZIN
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-09 01:57:13 +01:00
|
|
|
|
tarihce_dkontrol(){
|
|
|
|
|
if [ ! -d $TARIHCE_DIZIN ];then
|
|
|
|
|
mkdir $TARIHCE_DIZIN
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tarihce_liste(){
|
|
|
|
|
tarihce_dkontrol
|
|
|
|
|
ls $TARIHCE_DIZIN/
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tarihce_yap(){
|
|
|
|
|
tarihce_dkontrol
|
2016-03-10 01:28:42 +01:00
|
|
|
|
local t_isim
|
|
|
|
|
if [ "$temel_tarihce" = "evet" ];then
|
|
|
|
|
t_isim="temel"
|
|
|
|
|
else
|
|
|
|
|
t_isim=`date +%m-%d-%y.%H%M%S`
|
|
|
|
|
fi
|
|
|
|
|
bsdtar -P -r -f $TARIHCE_DIZIN/"$t_isim"-pkvt.tar $VT
|
|
|
|
|
lzip -9 $TARIHCE_DIZIN/"$t_isim"-pkvt.tar
|
2016-03-09 01:57:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tarihce_yukle(){
|
|
|
|
|
tarihce_dkontrol
|
2016-03-12 00:09:47 +01:00
|
|
|
|
local islem_onay cikis
|
2016-03-10 01:28:42 +01:00
|
|
|
|
sil_onay="h"
|
|
|
|
|
if [ -f $TARIHCE_DIZIN/"$1-pkvt.tar.lz" ];then
|
|
|
|
|
bsdtar -p -o -C /tmp -xf $TARIHCE_DIZIN/"$1-pkvt.tar.lz" 2>/dev/null
|
2016-03-12 00:09:47 +01:00
|
|
|
|
ls /tmp/var/lib/pkg/DB/ > hedef.pkvt
|
2016-03-10 01:28:42 +01:00
|
|
|
|
ls /var/lib/pkg/DB/ > simdiki.pkvt
|
2016-03-12 00:09:47 +01:00
|
|
|
|
grep -vf hedef.pkvt simdiki.pkvt > sil.liste
|
|
|
|
|
grep -vf simdiki.pkvt hedef.pkvt > kur.liste
|
|
|
|
|
rm hedef.pkvt simdiki.pkvt
|
2016-03-10 01:28:42 +01:00
|
|
|
|
rm -r /tmp/var
|
2016-03-12 00:09:47 +01:00
|
|
|
|
cikis=""
|
2016-03-10 01:28:42 +01:00
|
|
|
|
if [ -s sil.liste ];then
|
|
|
|
|
ryaz 32 "silinecekler"
|
|
|
|
|
ryaz 32 "------------"
|
|
|
|
|
cat sil.liste
|
2016-03-12 00:09:47 +01:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -s kur.liste ];then
|
|
|
|
|
ryaz 32 "kurulacaklar"
|
|
|
|
|
ryaz 32 "------------"
|
|
|
|
|
cat kur.liste
|
|
|
|
|
fi
|
|
|
|
|
if [ ! -s sil.liste ] && [ ! -s kur.liste ];then
|
|
|
|
|
ryaz 32 "sistem zaten hedef durumda!"
|
2016-03-10 01:28:42 +01:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
while true; do
|
|
|
|
|
ryaz 34 "otomatik geri dönüşüm başlasın mı?";read -p "e veya h-> " eh
|
|
|
|
|
case $eh in
|
2016-03-12 00:09:47 +01:00
|
|
|
|
[Ee]* ) islem_onay="e"; break;;
|
2016-03-10 01:28:42 +01:00
|
|
|
|
[Hh]* ) break;;
|
|
|
|
|
* ) echo "e veya h";;
|
|
|
|
|
esac
|
|
|
|
|
done
|
2016-03-12 00:09:47 +01:00
|
|
|
|
if [ "$islem_onay" = "e" ];then
|
2016-03-10 01:28:42 +01:00
|
|
|
|
mps -os sil.liste
|
2016-03-12 00:09:47 +01:00
|
|
|
|
mps -ok kur.liste
|
2016-03-10 01:28:42 +01:00
|
|
|
|
mv sil.liste silinenler.liste
|
2016-03-12 00:09:47 +01:00
|
|
|
|
mv kur.liste kurulanlar.liste
|
2016-03-10 01:28:42 +01:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
mv sil.liste sil_iptal.liste
|
2016-03-12 00:09:47 +01:00
|
|
|
|
mv kur.liste kur_iptal.liste
|
2016-03-09 01:57:13 +01:00
|
|
|
|
else
|
|
|
|
|
ryaz 31 "ilgili tarihce dosyası bulunamadı!"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tarihce_sil(){
|
|
|
|
|
tarihce_dkontrol
|
2016-03-10 01:28:42 +01:00
|
|
|
|
if [ -f $TARIHCE_DIZIN/"$1-pkvt.tar.lz" ];then
|
|
|
|
|
rm -f $TARIHCE_DIZIN/"$1-pkvt.tar.lz"
|
2016-03-09 01:57:13 +01:00
|
|
|
|
else
|
|
|
|
|
ryaz 31 "ilgili tarihce dosyası bulunamadı!"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log_tutma(){
|
|
|
|
|
echo "$(date +'%F %T') - $1 - paket" >> test.log
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-07 00:39:49 +01:00
|
|
|
|
git_guncelle() {
|
|
|
|
|
kaynakdizin_kontrol
|
|
|
|
|
cd $DERLEME_KAYNAKDIZIN
|
|
|
|
|
#git sunucudan guncelleme
|
|
|
|
|
ryaz 33 "git sunucudan güncelleme çekiliyor."
|
|
|
|
|
if [ ! -d milis.git ];then
|
|
|
|
|
git clone $git_sunucu milis.git
|
|
|
|
|
else
|
|
|
|
|
cd milis.git
|
|
|
|
|
git pull
|
|
|
|
|
fi
|
|
|
|
|
ryaz 33 "yerele eşitleniyor."
|
2016-03-11 17:42:21 +01:00
|
|
|
|
rm -r $talimatname_dizin/*
|
2016-03-07 00:39:49 +01:00
|
|
|
|
rsync -a $DERLEME_KAYNAKDIZIN/milis.git/talimatname/ $talimatname_dizin
|
2016-03-11 17:48:24 +01:00
|
|
|
|
rm -r `dirname $talimatname_dizin`/bin/*
|
2016-03-07 22:12:18 +01:00
|
|
|
|
rsync -a $DERLEME_KAYNAKDIZIN/milis.git/bin/ `dirname $talimatname_dizin`/bin
|
2016-03-07 00:39:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-24 01:27:23 +01:00
|
|
|
|
paketvt_guncelle(){
|
|
|
|
|
wget -q --spider "$sunucu""paket.vt"
|
|
|
|
|
#if wget -P /tmp -q "$sunucu""paket.vt" > /dev/null; then
|
|
|
|
|
if [ $? -eq 0 ]; then
|
2016-03-07 23:04:43 +01:00
|
|
|
|
ryaz 32 "paket veritabanı guncellenıyor." "$paketdepo""paket.vt"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
if [ -f "$paketdepo""paket.vt" ];then
|
|
|
|
|
mv "$paketdepo""paket.vt" "$paketdepo""paket.vt.eski"
|
|
|
|
|
fi
|
|
|
|
|
wget -P "$paketdepo" "$sunucu""paket.vt"
|
|
|
|
|
#rm /tmp/paket.vt*
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2016-03-07 23:04:43 +01:00
|
|
|
|
ryaz 31 "paket veritabanı guncelleme olumsuz."
|
2016-02-24 01:27:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-07 00:39:49 +01:00
|
|
|
|
talimat_bilgi(){
|
|
|
|
|
local konum HEAD
|
|
|
|
|
konum="`find "$talimatname_dizin" -name $1`"
|
|
|
|
|
HEAD=`grep -B 12 "build()" $konum/talimat`
|
|
|
|
|
echo $HEAD
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-24 01:27:23 +01:00
|
|
|
|
sistem_kontrol(){
|
|
|
|
|
paketvt_kontrol
|
|
|
|
|
sunucu_kontrol
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sunucu_kontrol(){
|
|
|
|
|
wget -q --spider $sunucu
|
|
|
|
|
if [ $? -eq 0 ]; then
|
2016-03-07 23:04:43 +01:00
|
|
|
|
ryaz 32 "paket sunucu aktif"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
else
|
2016-03-07 23:04:43 +01:00
|
|
|
|
ryaz 31 "sunucu erişim dışı"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
paketvt_kontrol(){
|
|
|
|
|
mkdir -p /depo/paketler
|
|
|
|
|
if [ ! -f /depo/paketler/paket.vt ];then
|
|
|
|
|
touch /depo/paketler/paket.vt
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yardim(){
|
|
|
|
|
echo "yardim"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ayarlar() {
|
|
|
|
|
|
|
|
|
|
while [ "$1" ]; do
|
|
|
|
|
case $1 in
|
|
|
|
|
-i|--indir)
|
|
|
|
|
ikaynak="ag"
|
|
|
|
|
kurulum_onay="olumsuz";;
|
|
|
|
|
-ik|--inku)
|
|
|
|
|
ikaynak="ag" ;;
|
|
|
|
|
-k|--yrku)
|
|
|
|
|
ikaynak="yerel" ;;
|
2016-03-17 03:08:24 +01:00
|
|
|
|
-k2|--yrku2)
|
|
|
|
|
ikaynak="yerel2" ;;
|
2016-03-07 22:12:18 +01:00
|
|
|
|
-s|--pksil)
|
2016-02-24 01:27:23 +01:00
|
|
|
|
paket_sil "$2" ;;
|
|
|
|
|
-d|--pkde)
|
2016-03-07 23:04:43 +01:00
|
|
|
|
zorla_derle="yok"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
kurulum_onay="olumsuz"
|
|
|
|
|
paket_derle "$2" ;;
|
2016-03-07 18:52:54 +01:00
|
|
|
|
-zd|--pkzde)
|
|
|
|
|
zorla_derle="evet"
|
|
|
|
|
kurulum_onay="olumsuz"
|
|
|
|
|
paket_derle "$2" ;;
|
2016-02-24 01:27:23 +01:00
|
|
|
|
-dk|--pkdk)
|
|
|
|
|
paket_derle "$2" ;;
|
|
|
|
|
-odk|--pkodk)
|
|
|
|
|
paket_derle_oto "$2" ;;
|
2016-03-03 15:10:44 +01:00
|
|
|
|
-odkk|--pkodk2)
|
|
|
|
|
paket_derle_oto2 "$2" ;;
|
2016-03-02 01:26:35 +01:00
|
|
|
|
-ok|--pkok)
|
2016-03-12 00:09:47 +01:00
|
|
|
|
paket_kur_oto "$2" ;;
|
2016-03-17 03:08:24 +01:00
|
|
|
|
-okl|--pkokl)
|
|
|
|
|
paket_kur_liste "$2" ;;
|
2016-03-12 00:09:47 +01:00
|
|
|
|
-ko|--pkko)
|
2016-03-17 04:08:47 +01:00
|
|
|
|
paket_kur_oto2 "$2" ;;
|
|
|
|
|
-oik|--pkok2)
|
|
|
|
|
paket_diskur_oto "$2" ;;
|
|
|
|
|
-iko|--pkko2)
|
|
|
|
|
paket_diskur_oto2 "$2" ;;
|
2016-03-19 00:16:01 +01:00
|
|
|
|
-pak|--paketle)
|
2016-03-19 02:20:46 +01:00
|
|
|
|
if [ ! "$2" ]; then
|
|
|
|
|
ryaz 31 "paketlenecek dizin ismi eksik"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2016-03-19 00:16:01 +01:00
|
|
|
|
yeniden_paketle "$2" ;;
|
2016-03-10 01:28:42 +01:00
|
|
|
|
-os|--pkos)
|
|
|
|
|
if [ ! "$2" ]; then
|
|
|
|
|
ryaz 31 "silme listesi yok"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
paket_sil_oto "$2" ;;
|
2016-03-07 23:04:43 +01:00
|
|
|
|
-kl|--kurulu-liste)
|
|
|
|
|
ls $VT ;;
|
2016-02-24 01:27:23 +01:00
|
|
|
|
-dly|--drly)
|
2016-02-28 00:55:08 +01:00
|
|
|
|
if [ -f derleme.liste ];then
|
|
|
|
|
mv derleme.liste derleme.liste.eski
|
|
|
|
|
fi
|
|
|
|
|
if [ -f genel.derleme.liste ];then
|
|
|
|
|
mv genel.derleme.liste genel.derleme.liste.eski
|
|
|
|
|
fi
|
2016-02-24 01:27:23 +01:00
|
|
|
|
touch derleme.liste
|
2016-02-28 00:55:08 +01:00
|
|
|
|
touch genel.derleme.liste
|
2016-02-24 01:27:23 +01:00
|
|
|
|
derleme_listyap "$2" ;;
|
2016-03-02 01:26:35 +01:00
|
|
|
|
-dlb|--drlb)
|
2016-03-07 00:39:49 +01:00
|
|
|
|
derleme_listbilgi "$2";;
|
2016-02-24 01:27:23 +01:00
|
|
|
|
-b|--pkbl)
|
|
|
|
|
paket_bilgi "$2" ;;
|
|
|
|
|
-bb|--pkbb)
|
2016-03-02 01:26:35 +01:00
|
|
|
|
bagimli_bilgi "$2" | column -t;;
|
2016-03-12 00:09:47 +01:00
|
|
|
|
-tb|--pktb)
|
|
|
|
|
ters_bagimli "$2" ;;
|
2016-03-12 01:06:20 +01:00
|
|
|
|
-tbk|--pktbk)
|
|
|
|
|
ters_bagimli_kontrol "$2" ;;
|
2016-03-12 00:09:47 +01:00
|
|
|
|
-talb|--talb)
|
2016-03-07 00:39:49 +01:00
|
|
|
|
talimat_bilgi "$2" | column -t;;
|
|
|
|
|
-Ggit|--gitgun)
|
|
|
|
|
git_guncelle ;;
|
2016-02-24 01:27:23 +01:00
|
|
|
|
-G|--pvtg)
|
|
|
|
|
paketvt_guncelle ;;
|
|
|
|
|
-g|--pkgu)
|
|
|
|
|
if [ ! "$2" ]; then
|
2016-03-07 23:04:43 +01:00
|
|
|
|
ryaz 31 "paket ismi eksik"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
paket_guncelle "$2";;
|
2016-03-07 23:04:43 +01:00
|
|
|
|
-kk|--kurulu-kontrol)
|
2016-02-24 01:27:23 +01:00
|
|
|
|
if [ ! "$2" ]; then
|
2016-03-07 23:04:43 +01:00
|
|
|
|
ryaz 31 "paket ismi eksik"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2016-03-07 23:04:43 +01:00
|
|
|
|
ryaz 31 `kurulu_kontrol "$2"`;;
|
2016-02-24 01:27:23 +01:00
|
|
|
|
-suko)
|
|
|
|
|
sunucu_kontrol ;;
|
|
|
|
|
-cf|--config-file)
|
|
|
|
|
if [ ! "$2" ]; then
|
|
|
|
|
echo "ayardosyası gerek $1"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
ayar_dosyasi="$2"
|
|
|
|
|
shift ;;
|
2016-03-09 01:57:13 +01:00
|
|
|
|
-tro)
|
|
|
|
|
tarihce_yap ;;
|
2016-03-10 01:28:42 +01:00
|
|
|
|
-trot)
|
|
|
|
|
temel_tarihce="evet"
|
|
|
|
|
tarihce_yap ;;
|
2016-03-09 01:57:13 +01:00
|
|
|
|
-try)
|
|
|
|
|
if [ ! "$2" ]; then
|
|
|
|
|
ryaz 31 "tarihce dosyasi eksik $1"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
tarihce_yukle "$2"
|
|
|
|
|
shift ;;
|
|
|
|
|
-trl)
|
|
|
|
|
tarihce_liste ;;
|
|
|
|
|
-trs)
|
|
|
|
|
if [ ! "$2" ]; then
|
|
|
|
|
ryaz 31 "parametre eksik $1"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
tarihce_sil "$2"
|
|
|
|
|
shift ;;
|
2016-02-24 01:27:23 +01:00
|
|
|
|
-v)
|
2016-03-11 17:42:21 +01:00
|
|
|
|
ryaz 33 "$betikad $versiyon $iletisim"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
exit 0 ;;
|
|
|
|
|
-h|--help)
|
|
|
|
|
yardim
|
|
|
|
|
exit 0 ;;
|
|
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
shift
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
ana(){
|
|
|
|
|
ayarlar "$@"
|
|
|
|
|
|
|
|
|
|
if [ "$ikaynak" = "ag" ]; then
|
|
|
|
|
|
2016-03-09 02:00:46 +01:00
|
|
|
|
echo "agdan cekiliyor:" "$2"
|
2016-03-17 17:58:21 +01:00
|
|
|
|
|
|
|
|
|
pkt=`cat "$paketdepo""paket.vt" | grep "^$2 " | cut -d' ' -f3`
|
|
|
|
|
echo $pkt
|
2016-02-24 01:27:23 +01:00
|
|
|
|
if [ ! -z "$pkt" -a "$pkt" != "" ]; then
|
|
|
|
|
cpaket="${pkt/'#'/'%23'}"
|
|
|
|
|
#paket sunucuda varsa
|
|
|
|
|
wget -q --spider "$sunucu$cpaket"
|
|
|
|
|
#if wget -P /tmp -q "$sunucu$cpaket" > /dev/null; then
|
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
|
wget -nc -P "$paketdepo" "$sunucu$cpaket"
|
|
|
|
|
#mv /tmp/$pkt "$paketdepo"
|
|
|
|
|
if [ "$kurulum_onay" = "evet" ];then
|
|
|
|
|
kkont=`kurulu_kontrol "$2"`
|
|
|
|
|
if [ "$kkont" = "degil" ];then
|
|
|
|
|
icerik_ekle "$paketdepo$pkt"
|
|
|
|
|
exit 1
|
|
|
|
|
else
|
2016-03-16 23:16:23 +01:00
|
|
|
|
ryaz 31 "paket zaten kurulu!"
|
2016-02-24 01:27:23 +01:00
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$ikaynak" = "yerel" ]; then
|
2016-02-28 00:55:08 +01:00
|
|
|
|
local silme
|
2016-02-24 01:27:23 +01:00
|
|
|
|
pkontrol=`basename $2 | grep -w "mps.lz"`
|
|
|
|
|
if [ ! -z "$pkontrol" -a "$pkontrol" != "" ]; then
|
|
|
|
|
paketad=`echo "$2" | cut -d'#' -f1`
|
|
|
|
|
kkont=`kurulu_kontrol "$paketad"`
|
|
|
|
|
if [ "$kkont" = "degil" ];then
|
|
|
|
|
icerik_ekle "$2"
|
|
|
|
|
else
|
2016-03-23 06:53:40 +01:00
|
|
|
|
if [ "$tekrarkur" = "hayir" ];then
|
|
|
|
|
while true; do
|
|
|
|
|
ryaz 31 "$2 paketi zaten kurulu silinip kurulsun mu?"
|
|
|
|
|
read -p "e veya h -> " eh
|
|
|
|
|
case $eh in
|
|
|
|
|
[Ee]* ) silme="e"; break;;
|
|
|
|
|
[Hh]* ) break;;
|
|
|
|
|
* ) echo "e veya h";;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
fi
|
2016-02-28 00:55:08 +01:00
|
|
|
|
if [ "$silme" = "e" ];then
|
2016-03-07 23:04:43 +01:00
|
|
|
|
ryaz 33 "silinecekelerin kontrolu için"
|
|
|
|
|
paket_sil "$paketad"
|
2016-02-28 00:55:08 +01:00
|
|
|
|
icerik_ekle "$2"
|
|
|
|
|
fi
|
2016-02-24 01:27:23 +01:00
|
|
|
|
fi
|
|
|
|
|
else
|
2016-03-07 23:04:43 +01:00
|
|
|
|
ryaz 31 "yerelde mps paketi bulunamadı."
|
2016-02-24 01:27:23 +01:00
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2016-03-17 03:08:24 +01:00
|
|
|
|
if [ "$ikaynak" = "yerel2" ]; then
|
|
|
|
|
local silme
|
|
|
|
|
pkontrol=`basename $2 | grep -w "mps.lz"`
|
|
|
|
|
if [ ! -z "$pkontrol" -a "$pkontrol" != "" ]; then
|
|
|
|
|
paketad=`echo "$2" | cut -d'#' -f1`
|
|
|
|
|
kkont=`kurulu_kontrol "$paketad"`
|
|
|
|
|
icerik_ekle2 "$2"
|
|
|
|
|
else
|
|
|
|
|
ryaz 31 "yerelde mps paketi bulunamadı."
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2016-02-24 01:27:23 +01:00
|
|
|
|
}
|
|
|
|
|
ana "$@"
|
|
|
|
|
|
2016-03-07 23:04:43 +01:00
|
|
|
|
|
|
|
|
|
#31 kirmizi
|
|
|
|
|
#32 yesil
|
|
|
|
|
#33 sari
|
|
|
|
|
#34 mavi
|
|
|
|
|
#34 mor
|