Commit e6439941 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add ported from Korinf run-scripts

parent 2497b8f4
......@@ -69,6 +69,8 @@ done
pkg_files=$(strip_spaces "$pkg_files")
pkg_names=$(strip_spaces "$pkg_names")
pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
echover "pkg_files=$pkg_files"
echover "pkg_names=$pkg_names"
......
#!/bin/sh
#
# Copyright (C) 2009, 2012 Etersoft
# Copyright (C) 2009, 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
check_rpm_integrity()
{
rpm --checksig $@ >/dev/null
}
check_deb_integrity()
{
a= dpkg --contents $@ >/dev/null
}
check_bz2_integrity()
{
bunzip -t $1 >/dev/null
}
check_gz_integrity()
{
gunzip -t $1 >/dev/null
}
check_zip_integrity()
{
a= unzip -t $1 >/dev/null
}
check_xz_integrity()
{
xz -t $1 >/dev/null
}
check_pkg_integrity()
{
local EXT=`echo "$1" | sed -e "s|.*\.\([a-z0-9]*\)\$|\1|g"`
local PKG="$1"
local RET
case $EXT in
deb)
check_deb_integrity "$PKG"
RET=$?
;;
rpm)
check_rpm_integrity "$PKG"
RET=$?
;;
gz|tgz)
check_gz_integrity "$PKG"
RET=$?
;;
bz2|tbz)
check_bz2_integrity "$PKG"
RET=$?
;;
zip)
check_zip_integrity "$PKG"
RET=$?
;;
xz)
check_xz_integrity "$PKG"
RET=$?
;;
exe|ebuild)
# Skip checking
RET=0
;;
*)
fatal "Unknown package extension '$EXT' in $PKG package"
;;
esac
return $RET
}
check_files_integrity()
{
local DIR="$1" EXT
for EXT in deb rpm tgz tar.gz tar.bz2 tbz zip ; do
for i in $(find "$DIR" -maxdepth 1 -name "*.$EXT") ; do
check_pkg_integrity $i && echo "Package $i is OK" || echo "Package $i is broken"
done
done
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# copied from korinf/tools/run-script/scripts/search
epm_clean()
{
[ -n "$pkg_filenames" ] || fatal "Run search without names"
case $DISTRNAME in
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
CMD="apt-get clean"
MASK="*.deb"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
CMD="yum clean packages"
MASK="*.rpm"
;;
"Mandriva")
CMD="rm -f /var/cache/urpmi/rpms/*.rpm"
MASK="*.rpm"
;;
"SUSE")
CMD="zypper clean"
MASK="*.rpm"
;;
*)
RET=1
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\""
;;
esac
docmd $CMD $pkg_filenames
}
......@@ -18,6 +18,33 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# TODO
epm_install_sim()
{
case $DISTRNAME in
"ALTLinux"|"PCLinux")
CMD="apt-get --simulate install"
;;
"Ubuntu"|"Debian")
CMD="apt-get --simulate install"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
CMD="yum provides"
;;
"Mandriva")
CMD="urpmi --test --auto"
;;
"SUSE")
CMD="zypper --non-interactive install --dry-run"
;;
*)
echo "Do not known install command for DISTRNAME $DISTRNAME"
exit 2
;;
esac
}
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
get_install_package_command()
{
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# copied from korinf/tools/run-script/scripts/search
epm_query_file()
{
[ -n "$pkg_filenames" ] || fatal "Run query without names"
case $DISTRNAME in
"ALTLinux"|"PCLinux")
CMD="rpm -qf"
;;
"Ubuntu"|"Debian")
CMD="dpkg -S"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
CMD="rpm -qf"
;;
"Mandriva")
CMD="rpm -qf"
;;
"SUSE")
CMD="rpm -qf"
;;
*)
RET=1
CMD="echo \"Do not known query command for DISTRNAME $DISTRNAME\""
;;
esac
docmd $CMD $pkg_filenames
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# copied from korinf/tools/run-script/scripts/search
# TODO
epm_remove_low()
{
case $DISTRNAME in
"Ubuntu"|"Debian")
CMD="dpkg -P"
;;
"ALTLinux"|"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific"|"PCLinux"|"Mandriva"|"SUSE")
CMD="rpm -e"
;;
"ArchLinux")
CMD="pacman -R"
;;
"MOPSLinux")
CMD="mpkg remove"
;;
"Gentoo")
CMD="emerge --unmerge"
;;
*)
RET=1
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\""
;;
esac
}
# TODO
epm_remove_nonint()
{
case $DISTRNAME in
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
CMD="apt-get -y --force-yes remove"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
CMD="yum -y remove"
;;
"Mandriva")
CMD="urpme --auto"
;;
"SUSE")
CMD="zypper --non-interactive remove"
;;
*)
RET=1
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\""
;;
esac
}
epm_remove()
{
[ -n "$pkg_files$pkg_names" ] || fatal "Run remove without names"
case $DISTRNAME in
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
CMD="apt-get remove"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
CMD="yum remove"
;;
"Mandriva")
CMD="urpme"
;;
"SUSE")
CMD="zypper remove"
;;
*)
RET=1
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\""
;;
esac
docmd $CMD $pkg_names $pkg_files
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# copied from korinf/tools/run-script/scripts/search
epm_search()
{
[ -n "$pkg_filenames" ] || fatal "Run search without names"
#CMD=$(get_install_package_command $DISTRNAME interactive)
case $DISTRNAME in
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
CMD="apt-cache search"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
CMD="yum search"
;;
"Mandriva")
CMD="urpmf"
;;
"SUSE")
CMD="zypper search"
;;
*)
RET=1
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\""
;;
esac
docmd $CMD $pkg_filenames
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# copied from korinf/tools/run-script/scripts/update
epm_update()
{
#docmd $CMD $pkg_files $pkg_names
case $DISTRNAME in
"ALTLinux")
exit 0
;;
"Ubuntu"|"Debian"|"PCLinux")
apt-get update || exit
apt-get -f install || exit
apt-get autoremove
;;
# skip, will do it automagically
# "LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
# CMD="yum update"
# ;;
# "Mandriva")
# CMD="urpmf"
# ;;
# skip, will do it automagically
# "SUSE")
# CMD="zypper update"
# ;;
*)
RET=1
echo \"Do not known install command for DISTRNAME $DISTRNAME\"
exit 1
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# copied from korinf/tools/run-script/scripts/search
epm_search()
{
[ -n "$pkg_filenames" ] || fatal "Run search without names"
case $DISTRNAME in
"ALTLinux"|"Ubuntu"|"Debian"|"PCLinux")
CMD="apt-get dist-upgrade"
;;
"LinuxXP"|"Fedora"|"ASPLinux"|"CentOS"|"RHEL"|"Scientific")
CMD="yum update"
;;
# "Mandriva")
# CMD="urpmf"
# ;;
"SUSE")
CMD="zypper update"
;;
*)
RET=1
CMD="echo \"Do not known install command for DISTRNAME $DISTRNAME\""
;;
esac
docmd $CMD $pkg_filenames
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment