Commit 53c75b9a authored by Vinicius Ruoso's avatar Vinicius Ruoso

Removed integrity scripts

Those scripts has been moved to sdi/sdi-integrity-prd.git repository.
Signed-off-by: default avatarVinicius Ruoso <vkr07@c3sl.ufpr.br>
parent 2f3c827d
PREFIX:=.
PRDDIR:=./PRD
install: prd_packs-install prd_md5-install
@echo "Done."
uninstall: prd_packs-uninstall prd_md5-uninstall
@echo "All uninstalled."
purge: prd_packs-purge prd_md5-purge
@echo "All purged."
checkprefix:
@test -d $(PREFIX)
@test -d $(PREFIX)/commands-available
@test -d $(PREFIX)/states-available
checkprefix-install:
@test -d $(PREFIX)
@test -d $(PREFIX)/commands-enabled/onconnect.d
@test -d $(PREFIX)/commands-enabled/hourly.d
@test -d $(PREFIX)/states-enabled
checkprddir:
@test -d $(PRDDIR)
prd_packs: checkprefix checkprddir
@cp prd_packs prd_packs.po $(PREFIX)/commands-available
@sed -i "s#MAINBASEFILEN#$(PRDDIR)/packs/packs_base_normal#g" \
$(PREFIX)/commands-available/prd_packs.po
@sed -i "s#MAINBASEFILET#$(PRDDIR)/packs/packs_base_testing#g" \
$(PREFIX)/commands-available/prd_packs.po
@cp prd_packs*.st $(PREFIX)/states-available
@mkdir -p $(PRDDIR)/packs
prd_packs-install: checkprefix-install prd_packs
@ln -fs $(PREFIX)/commands-available/prd_packs \
$(PREFIX)/commands-enabled/onconnect.d/090-prd_packs
@ln -fs $(PREFIX)/states-available/prd_packs* \
$(PREFIX)/states-enabled/
prd_packs-uninstall: checkprefix-install
@rm -f $(PREFIX)/commands-enabled/*/090-prd_packs
@rm -f $(PREFIX)/states-enabled/prd_packs*
prd_packs-purge: checkprefix prd_packs-uninstall
@rm -f $(PREFIX)/commands-available/prd_packs*
@rm -f $(PREFIX)/states-available/prd_packs*
@rm -rf $(PRDDIR)/packs
prd_export: checkprefix checkprddir
@cp prd_export.po $(PREFIX)/commands-available
prd_export-install: checkprefix-install prd_export
@ln -fs $(PREFIX)/commands-available/prd_export \
$(PREFIX)/commands-enabled/hourly.d/100-prd_export
prd_export-uninstall: checkprefix-install
@rm -f $(PREFIX)/commands-enabled/*/100-prd_export
prd_export-purge: checkprefix prd_export-uninstall
@rm -f $(PREFIX)/commands-available/prd_export*
prd_integrity: checkprefix checkprddir
@cp prd_integrity prd_integrity.po $(PREFIX)/commands-available
prd_integrity-install: checkprefix-install prd_integrity
@ln -fs $(PREFIX)/commands-available/prd_integrity \
$(PREFIX)/commands-enabled/hourly.d/105-prd_integrity
prd_integrity-uninstall: checkprefix-install
@rm -f $(PREFIX)/commands-enabled/*/105-prd_integrity
prd_integrity-purge: checkprefix prd_integrity-uninstall
@rm -f $(PREFIX)/commands-available/prd_integrity*
prd_md5: checkprefix checkprddir prd_packs prd_export prd_integrity
@cp prd_md5 prd_md5.po $(PREFIX)/commands-available
@sed -i "s#MAINRDIR#$(PRDDIR)/mdsum#g" \
$(PREFIX)/commands-available/prd_md5
@cp prd_md5*.st $(PREFIX)/states-available
@mkdir -p $(PRDDIR)/mdsum
@cp generate_mdsum_base.sh $(PRDDIR)/mdsum
@sed -i "s#MAINVBASEN#$(PRDDIR)/packs/packs_base_normal#g" \
$(PRDDIR)/mdsum/generate_mdsum_base.sh
@sed -i "s#MAINVBASET#$(PRDDIR)/packs/packs_base_testing#g" \
$(PRDDIR)/mdsum/generate_mdsum_base.sh
@sed -i "s#MAINMD5DIR#$(PRDDIR)/mdsum#g" \
$(PRDDIR)/mdsum/generate_mdsum_base.sh
@sed -i "s#PRD_EXPORT#$(PREFIX)/commands-available/prd_export#g" \
$(PRDDIR)/mdsum/generate_mdsum_base.sh
@cp export $(PRDDIR)/mdsum/export
prd_md5-install: prd_md5 prd_export-install prd_integrity-install
@ln -fs $(PREFIX)/commands-available/prd_md5 \
$(PREFIX)/commands-enabled/onconnect.d/095-prd_md5
@ln -fs $(PREFIX)/states-available/prd_md5* \
$(PREFIX)/states-enabled/
@echo -ne "$$(crontab -l)\n15 23 * * * \
$(PRDDIR)/mdsum/generate_mdsum_base.sh dn &>/dev/null\n\n" |\
crontab -
@echo -ne "$$(crontab -l)\n40 23 * * * \
$(PRDDIR)/mdsum/generate_mdsum_base.sh dt &>/dev/null\n\n" |\
crontab -
prd_md5-uninstall: checkprefix-install prd_export-uninstall \
prd_integrity-uninstall
@rm -f $(PREFIX)/commands-enabled/*/095-prd_md5
@rm -f $(PREFIX)/states-enabled/prd_md5*
@crontab -l | grep -v "$(PRDDIR)/mdsum/generate_mdsum_base.sh" |\
crontab -
prd_md5-purge: checkprefix prd_md5-uninstall prd_export-purge \
prd_integrity-purge
@rm -f $(PREFIX)/commands-available/prd_md5*
@rm -f $(PREFIX)/states-available/prd_md5*
@rm -rf $(PRDDIR)/mdsum
export PRDVERSION="2.0r2 Quero-quero"
export MD5N=""
export MD5T=""
#!/bin/bash
# List of packages in
VBASEN=MAINVBASEN
VBASET=MAINVBASET
if (( $# != 1 )); then
echo "$(basename $0) (dn|dt)"
exit 1
fi
INN=$(mktemp)
INT=$(mktemp)
sed "/prd-kernel/d" $VBASEN > $INN
sed "/prd-kernel/d" $VBASET > $INT
# Read package list
both=""
only1=""
only2=""
REMOVE="/etc/gconf/gconf.xml.mandatory/%gconf-tree.xml \
/etc/cron.d/prd-auto-upgrade /etc/ssmtp/ssmtp.conf \
/etc/prd-auto-upgrade/executar/80-recadastraimpressoras \
/etc/apt/sources.list /etc/openoffice/psprint.conf \
/usr/local/sbin/prd-nobreak/senha-nobreak.txt \
/usr/bin/gmenu-simple-editor \
/usr/share/doc/libx11-6/changelog.Debian.gz \
/usr/lib/libX11.so.6.2.0 \
/export/configs/multiterminais/geral/etc/fstab \
/var/lib/tz-brasil/info-install \
/usr/share/doc/xserver-xephyr/changelog.gz \
/usr/share/doc/xserver-xephyr/changelog.Debian.gz \
/usr/local/sbin/prd-nobreak/config.ini"
while read pack version; do
only1="${only1} ${pack}_${version}"
done < $INN
while read pack version; do
only2="${only2} ${pack}_${version}"
done < $INT
if [[ "$1" == "dn" ]]; then
packages="$both $only1"
else
packages="$both $only2"
fi
BASE=$(mktemp)
for pack in $packages; do
echo -ne "$pack \r"
# $pack contains "pack_version"
debfile=$(find /home/mirror/ -name "${pack}*.deb" 2>/dev/null | \
head -n 1)
packname=$(cut -d'_' -f1 <<< $pack)
debdir=$(mktemp -d)
dpkg -x $debfile $debdir
find $debdir -type f 2> /dev/null | xargs -i md5sum {} | \
sed "s/\/tmp\/tmp.[A-Za-z0-9]*//g" | \
awk '{print "'${packname}' "$0}' >> $BASE
rm -rf $debdir
# Adding conffiles to the REMOVE list
debdir=$(mktemp -d)
dpkg -e $debfile $debdir
if [ -f ${debdir}/conffiles ]; then
while read conffile; do
REMOVE="${REMOVE} $conffile"
done < ${debdir}/conffiles
fi
rm -rf $debdir
done
IGNORE="xscreensaver linux-image-2.6.18-6-486"
echo "Removing ingnore-list packages..."
for pack in $IGNORE; do
sed -i "/^$pack /d" $BASE
done
echo "Removing Conffiles... (This WILL take some time :)"
# Removing REMOVE
REMOVE="$(sed 's/\//\\\//g' <<< $REMOVE)"
for file in $REMOVE; do
sed -i "/${file}/d" $BASE
done
MD5DIR=MAINMD5DIR
if [[ "$1" == "dn" ]]; then
RBASE=${MD5DIR}/base_md5_normal
rm -f ${RBASE}.bz2
mv $BASE $RBASE
chmod 644 $RBASE
MD5N="$(md5sum $RBASE | cut -d' ' -f1)"
sed -i "s/MD5N=.*/MD5N=\"$MD5N\"/g" ${MD5DIR}/export
bzip2 $RBASE
else
RBASE=${MD5DIR}/base_md5_test
rm -f ${RBASE}.bz2
mv $BASE $RBASE
chmod 644 $RBASE
MD5T="$(md5sum $RBASE | cut -d' ' -f1)"
sed -i "s/MD5T=.*/MD5T=\"$MD5T\"/g" ${MD5DIR}/export
bzip2 $RBASE
fi
cp ${MD5DIR}/export PRD_EXPORT
rm $INN $INT
function getcolumninfo()
{
WEBINTERFACE=false
}
LASTRUNTIMEfile=/tmp/.lastruntime.sdi1.0
touch $LASTRUNTIMEfile
LASTRUNTIME=$(cat $LASTRUNTIMEfile)
test -z "$LASTRUNTIME" && LASTRUNTIME=0
function packandmdsum()
{
LOCKFILE=/tmp/.packmdsumlock.sdi1.0
test -f $LOCKFILE && test "$(ls -l $LOCKFILE | cut -d" " -f6 | \
cut -d"-" -f3)" -eq "$(date +%d)" && return 1
test -z "$LASTRUNTIME" && LASTRUNTIME=0
((TIMEDIFF= $(date +%s) - LASTRUNTIME))
test "$TIMEDIFF" -lt 43200 && return 0
touch $LOCKFILE
LASTRUNTIME=$(date +%s)
(verify_packs && verify_md5 ) || LASTRUNTIME=0
export LASTRUNTIME
rm -f $LOCKFILE
echo $LASTRUNTIME > $LASTRUNTIMEfile
}
h=$(date +%k)
test $h -ge 6 && packandmdsum & disown
function getcolumninfo()
{
WEBINTERFACE=false
}
# Ex;
# MD5+mrequest&Y&${RFILE}&{LFILE}
# MD5+mget_base_error&Y
# MD5+mget_base_error&N
# MD5+merror&N
# MD5+merror&Y&55951515359&prd-interface&/usr/local/lib/foo.png
# MD5+mok&N&55951515359
# MD5+mok&Y
# MD5+mrequest&Y&/usr/share/bin.sh
# get_base Remote_file Local_file
function get_base()
{
RFILE=$1
LFILE=$2
printf "PRD_MD5+prd_md5_mrequest.st&Y&${RFILE}&${LFILE}\n"
waitsendfile "${LFILE}"
printf "PRD_MD5+prd_md5_mrequest.st&N\n"
bunzip2 $LFILE 2>/dev/null
return $?
}
# check_base (n|t)
function check_base()
{
if [[ "$1" == "n" ]]; then
# If it's already checked, ok
if (( $DOWNLOADEDN )); then
return 0
fi
# If the base file isnot found, download it
if [ ! -f $LBASENX ]; then
if ! get_base $RBASENZ $LBASENZ ; then
return 1
else
DOWNLOADEDN=1
return 0
fi
fi
# download md5sum file
MD=$(mktemp)
echo "$MD5N" > $MD
# If it's different, try to download again
if [[ "$(cat $MD)" != "$(md5sum $LBASENX | cut -d' ' -f1)" ]]
then
rm -f $LBASENX
rm -f $LBASENZ
rm -f $MD
if ! get_base $RBASENZ $LBASENZ ; then
return 1
fi
fi
rm -f $MD
DOWNLOADEDN=1
return 0
else
# If it's already checked, ok
if (( $DOWNLOADEDT )); then
return 0
fi
# If the base file isnot found, download it
if [ ! -f $LBASETX ]; then
if ! get_base $RBASETZ $LBASETZ ; then
return 1
else
DOWNLOADEDT=1
return 0
fi
fi
# download md5sum file
MD=$(mktemp)
echo "$MD5T" > $MD
# If it's different, try to download again
if [[ "$(cat $MD)" != "$(md5sum $LBASETX | cut -d' ' -f1)" ]]
then
rm -f $LBASETX
rm -f $LBASETZ
rm -f $MD
if ! get_base $RBASETZ $LBASETZ ; then
return 1
fi
fi
rm -f $MD
DOWNLOADEDT=1
return 0
fi
}
function verify_md5()
{
export DEBIAN_FRONTEND="noninteractive"
# Starts by leaving all states!
printf "PRD_MD5+prd_md5_mstart.st&Y\n"
# base format:
# 49b3926a12502ec80a8492dd1397b262 /etc/gdm/gdm.conf
LDIR=/var/cache/prd/mdsum
RDIR=MAINRDIR
mkdir -p $LDIR
LBASENZ=${LDIR}/base_mdsum_dn.bz2
RBASENZ=${RDIR}/base_md5_normal.bz2
LBASENX=${LDIR}/base_mdsum_dn
LBASETZ=${LDIR}/base_mdsum_dt.bz2
RBASETZ=${RDIR}/base_md5_test.bz2
LBASETX=${LDIR}/base_mdsum_dt
DOWNLOADEDN=0
DOWNLOADEDT=0
KEY=$(date +%s)
if ! check_base n ; then
return 1
fi
PROB=0
while read bpack correctmd5 filename; do
pendingmd5=$(md5sum "$filename" 2> /dev/null | cut -d' ' -f1)
if [[ "$pendingmd5" != "$correctmd5" ]]; then
x=$(dpkg -S $filename 2> /dev/null)
if (( $(wc -l <<< "$x") > 1 )); then # If it's a divert...
pack=$(tail -1 <<< "$x" | grep " de: " | cut -d' ' -f3)
else
pack=$(cut -d':' -f1 <<< "$x")
fi
if [[ "$(cat /etc/prd_version)" == "$PRDVERSION" ]] && \
[[ "$pack" == "$bpack" ]] && \
[[ "$WEIRDmerror" != "merror" ]] && \
! grep -q $pack <<< "$merrorPACKS"; then
# Check in the other base
if ! check_base t ; then
return 1
fi
anothercorrectmd5=$(awk '($1 ~ /^'$pack'$/) && \
($3 ~ /^'$(sed "s/\//\\\\\\//g" <<< $filename)'$/) \
{print $2}' $LBASETX | head -1)
if [[ "$pendingmd5" != "$anothercorrectmd5" ]]; then
#rm -f /var/lib/apt/lists/prdmirror*
#apt-get --quiet -y --force-yes clean &> /dev/null
#apt-get --quiet -y --force-yes update &> /dev/null
#apt-get --quiet -y --force-yes install --reinstall\
# ${pack} &> /dev/null
pendingmd5=$(md5sum "$filename" 2> /dev/null |\
cut -d' ' -f1)
if [[ "$pendingmd5" != "$correctmd5" ]] && \
[[ "$pendingmd5" != "$anothercorrectmd5" ]]; then
PROB=1
printf \
"PRD_MD5+prd_md5_merror.st&Y&${KEY}&${pack}&${filename}\n"
fi
fi
fi
fi
done < $LBASENX
if (( ! $PROB )); then
printf "PRD_MD5+prd_md5_mok.st&Y\n"
else
printf "PRD_MD5+prd_md5_mok.st&N&${KEY}\n"
return 1
fi
}
function prd_md5_updatedata()
{
UPDATA="$*"
}
function prd_md5_www()
{
PVALUE="$*"
PS="$*"
ERR="$(cut -d'&' -f1 <<< $PS)"
if [[ "$ERR" == "prd_md5_mstart.st" ]]; then
# Turn off every state provided by the md5 script
PSTATETYPE=""
MD5STATES="prd_md5_merror.st prd_md5_mok.st prd_md5_mrequest.st"
for state in $MD5STATES; do
PSTATETYPE="${state}:false ${PSTATETYPE}"
done
else
YN="$(cut -d'&' -f2 <<< $PS)"
if [[ "$YN" == "Y" ]]; then
state=true
else
state=false
fi
if [[ "$ERR" == "prd_md5_mrequest.st" ]] && \
[[ "$YN" == "Y" ]]; then
RFILE="$(cut -d'&' -f3 <<< $PS)"
LFILE="$(cut -d'&' -f4 <<< $PS)"
sendfile -f $RFILE -d $LFILE -l 82 $HOST
fi
PSTATETYPE="${ERR}:${state}"
fi
}
function getcolumninfo()
{
WEBINTERFACE=false
}
function getstateinfo()
{
STITLE="Contém arquivos corrompidos"
SDESCRIPTION="Máquinas que contém algum arquivo corrompido"
SDEFCOLUMNS="ID,NRE,Cidade,Escola,Status,Uptime,Versão"
SSUMARY="%d hosts com arquivos corrompidos"
}
function getstateinfo()
{
STITLE="Não contém arquivos corrompidos"
SDESCRIPTION="Máquinas que não contém arquivos corrompidos"
SDEFCOLUMNS="ID,NRE,Cidade,Escola,Status,Uptime,Versão"
SSUMARY="%d hosts sem arquivos corrompidos"
}
function getstateinfo()
{
STITLE="Requesitando arquivos de integridade (md5)"
SDESCRIPTION="Máquinas que estão requesitando/recebendo o arquivo \
de integridade (md5)"
SDEFCOLUMNS="ID,NRE,Cidade,Escola,Status,Uptime,Versão"
SSUMARY="%d hosts requisitando arquivos de integridade (md5)"
}
# Error #1: Package should be installed, but is not.
# Error #2: Package is installed with a wrong (old) version.
# Error #3: Package should not be installed, bit it is.
# Error #4: Package is installed with a wrong (new) version. unsolvable!
# Possible Outputs:
# PACKS+<errorid>&(Y|N)[&$(date)[&<packname>]]
# Ex:
# PRD_PACKS+prd_packs_pstart.st&Y
# PRD_PACKS+prd_packs_pget_base_error.st&Y
# PRD_PACKS+prd_dpkg_error.st&N
# PACKS+prd_packs_dpkg_configure_error.st&Y
# PACKS+prd_packs_empty_cron_error.st&N
# PACKS+prd_packs_pok.st&Y
# PACKS+prd_packs_pok.st&N&55951515359
# PACKS+prd_packs_perror1.st&N
# PACKS+prd_packs_perror2.st&Y&55951515359&prd-interface
# PACKS+prd_packs_perror3.st&N
# PACKS+prd_packs_perror4.st&Y&55951515359
# PACKS+prd_packs_pdrequest.st&Y
function try_solve_error_2_4()
{
pack=$1
version=$2
# Check if it isn't already fixed
if [[ "$(dpkg -l $pack | tail -1 | awk '{print $3}')" == \
"$version" ]]; then
return 0
fi
# Check if it isn't updated (version newer than the correct one)
if dpkg --compare-versions \
"$(dpkg -l $pack | tail -1 | awk '{print $3}')" ">" "$version"
then
printf "PRD_PACKS+prd_packs_perror4.st&Y&${KEY}&${pack}\n"
perror4=1
PROB=1
export ERRORPACKS="$ERRORPACKS $pack"
return 0
fi
# If it isn't the correct prd_version, get out!
if [[ "$(cat ${LVERSION})" == "$(cat /etc/prd_version)" ]]; then
# If it isn't the correct prd-auto-upgrade version,
# or there was a problem already, print the error!
if ! dpkg --compare-versions $(dpkg -l prd-auto-upgrade |\
tail -1 | awk '{print $3}') ">=" 0.1.40 || (( $PROB )); then
printf "PRD_PACKS+prd_packs_perror2.st&Y&${KEY}&${pack}\n"
perror2=1
PROB=1
export ERRORPACKS="$ERRORPACKS $pack"
# Try to fix!
else
#rm -f /var/lib/apt/lists/prdmirror*
#/usr/local/sbin/prd-faz-upgrade --force &>/dev/null
# If the pau continua
if [[ \
"$(dpkg -l $pack 2> /dev/null | tail -1 | awk '{print $3}')" != \
"$version" ]]; then
printf \
"PRD_PACKS+prd_packs_perror2.st&Y&${KEY}&${pack}\n"
perror2=1
PROB=1
export ERRORPACKS="$ERRORPACKS $pack"
fi
fi # wrong upgrade-version or prob ?
fi # wrong prd-version ?
}
function verify_packs()
{
export DEBIAN_FRONTEND="noninteractive"
export ERRORPACKS=""
export WEIRDERROR=""
# Starts by leaving all states!
printf "PRD_PACKS+prd_packs_pstart.st&Y\n"
# base format:
# prd-interface 0.4.144
# prd-extra 0.0.11
LBASE=$(mktemp)
LVERSION=$(mktemp)
KEY=$(date +%s)
rm -f /tmp/.packs_base
if ! grep -q prdtesting /etc/apt/sources.list; then
printf "PRD_PACKS+prd_packs_prequest.st&Y&n\n"
else
printf "PRD_PACKS+prd_packs_prequest.st&Y&t\n"
fi
waitsendfile "/tmp/.packs_base"
printf "PRD_PACKS+prd_packs_prequest.st&N\n"
mv /tmp/.packs_base $LBASE
echo $PRDVERSION > $LVERSION
dpkg -l dpkg &>/dev/null
if (( $? )); then
printf "PRD_PACKS+prd_packs_dpkg_error.st&Y\n"
rm -f $LBASE $LVERSION
export WEIRDERROR="ERROR"
return 1
fi
# check if prd-auto-upgrade is updated
if ! dpkg --compare-versions \
"$(dpkg -l prd-auto-upgrade | tail -1 | awk '{print $3}')" \
">=" "0.1.40" && \
[[ "$(cat ${LVERSION})" == "$(cat /etc/prd_version)" ]]; then
sleep 0
#rm -f /var/lib/apt/lists/prdmirror*
#apt-get --quiet -y --force-yes update &>/dev/null
#apt-get --quiet -y --force-yes install prd-auto-upgrade \
# &>/dev/null
fi
ALOG=/var/log/prd/prd-auto-upgrade.log
# Check if there is a "dpkg --configure -a" error
if tail -n 10 $ALOG 2> /dev/null | \
grep -q "dpkg --configure -a"; then
#dpkg --configure -a
if (( $? )); then
printf "PRD_PACKS+prd_packs_dpkg_configure_error.st&Y\n"
rm -f $LBASE $LVERSION
export WEIRDERROR="ERROR"
return 1
else
echo -ne "\n\n\n\n\n\n\n\n\n\n\n\n" >> $ALOG
fi
fi
# check if /etc/cron.d/prd-auto-upgrade if not empty
CRONFILE=/etc/cron.d/prd-auto-upgrade
if ! grep -q "/usr/local/sbin/prd-faz-upgrade" $CRONFILE; then
printf "PRD_PACKS+prd_packs_empty_cron_error.st&Y\n"
rm -f $LBASE $LVERSION
export WEIRDERROR="ERROR"
return 1
fi
# INSTALLED format:
# ii prd-interface 0.4.144
# rc prd-extra 0.0.10
INSTALLED=$(mktemp)
dpkg -l | awk 'NR >= 6 {print $1" "$2" "$3}' > $INSTALLED
PROB=0
perror1=0
perror2=0
perror3=0
perror4=0
while read pack version; do
if ! grep -q "ii $pack " $INSTALLED; then
# Packages not installed
# Trying to fix
if [[ "$(cat ${LVERSION})" == \
"$(cat /etc/prd_version)" ]]; then
#rm -f /var/lib/apt/lists/prdmirror*
#apt-get --quiet -y --force-yes update &>/dev/null
#apt-get --quiet -y --force-yes install ${pack} \
#&>/dev/null
if [[ \
"$(dpkg -l $pack 2> /dev/null | tail -1 | cut -d' ' -f1)" != \
"ii" ]]; then
printf \
"PRD_PACKS+prd_packs_perror1.st&Y&${KEY}&${pack}\n"
perror1=1
PROB=1
export ERRORPACKS="$ERRORPACKS $pack"
fi
fi
elif ! grep -q "$pack $version" $INSTALLED; then
# Package with wrong version
try_solve_error_2_4 $pack $version
fi # error no. 2
sed -i "/ $pack /d" $INSTALLED
done < $LBASE
# UNTIL UPON
EXTRA="$(awk '$1 ~ /^ii$/ {print $2}' $INSTALLED)"
if [[ "$EXTRA" != "" ]]; then
for pack in $EXTRA; do
if [[ "$pack" != "prd-kernel-xeon" ]] &&\
[[ "$pack" != "prd-kernel-opteron" ]]; then
PROB=1
printf "PRD_PACKS+prd_packs_perror3.st&Y&${KEY}&${pack}\n"
perror3=1
export ERRORPACKS="$ERRORPACKS $pack"
fi
done
fi
if (( ! $PROB )); then
printf "PRD_PACKS+prd_packs_pok.st&Y\n"
else
printf "PRD_PACKS+prd_packs_pok.st&N&${KEY}\n"
return 1
fi
rm -f $INSTALLED
rm -f $LBASE $LVERSION
}
function prd_packs_updatedata()
{
UPDATA="$*"
}
function prd_packs_www()
{
PVALUE="$*"
PS="$*"
ERR="$(cut -d'&' -f1 <<< $PS)"
if [[ "$ERR" == "prd_packs_pstart.st" ]]; then
# Turn off every state provided by the packs script
PSTATETYPE=""
PACKSTATES="prd_packs_dpkg_error.st \
prd_packs_dpkg_configure_error.st prd_packs_empty_cron_error.st \
prd_packs_pok.st prd_packs_perror1.st prd_packs_perror2.st \
prd_packs_perror3.st prd_packs_perror4.st prd_packs_prequest.st"