/usr/bin/mic-check-alldeps is in mic2 0.24.12-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | #!/bin/bash
function installpkg()
{
querycmd=$1
installer=$2
pkg=$3
echo "Checking $pkg..."
$querycmd $pkg > /dev/null 2>&1
if [ $? -ne 0 ] ; then
echo "$pkg isn't installed, trying to install it."
$installer $pkg
$querycmd $pkg > /dev/null 2>&1
if [ $? -ne 0 ] ; then
echo "Failed to install $pkg"
exit 1
fi
fi
echo "$pkg installed"
}
function checkpkgver()
{
querycmd=$1
pkg=$2
ver=$3
echo -n "Checking version of $pkg..."
if [ "${querycmd:0:3}" == "rpm" ] ; then
curver=$($querycmd $pkg)
else
read dummy curver < <($querycmd $pkg | grep "Version: ")
curver=$(echo $curver | cut -d':' -f2)
fi
if [[ "$curver" < "$ver" ]] ; then
echo -e "\n\n\033[1;31mmic2 requires $pkg version >= $ver, please update $pkg to $ver\033[00m"
exit 1
else
echo "OK"
fi
}
distros=("Fedora" "Redhat" "CentOS" "openSUSE" "SUSE" "Ubuntu" "Debian" "MeeGo")
extrapkgs=()
if [ $(id -u) != 0 ]; then
echo "You must be root to run this script"
exit 1
fi
# Check linux distro
release=$(cat /etc/*-release)
if [ $? -ne 0 ] ; then
release=$(cat /etc/issue)
fi
distro=""
for ((i=0;i<${#distros[@]};i++))
do
echo $release | grep -i "${distros[$i]}" > /dev/null 2>&1
if [ $? -eq 0 ] ; then
distro=${distros[$i]}
break
fi
done
if [ -z $distro ] ; then
echo "Image Creator doesn't support this linux distro"
exit 1
fi
requiredpkgs=("autoconf" "automake" "yum" "rpm" "kpartx" "parted" "syslinux" "curl" "gcc" "bzip2" "gzip" "python-iniparse" "python-zypp")
case $distro in
"Fedora" | "Redhat" | "CentOS")
installer="yum -y install"
querycmd="rpm -q"
qvercmd="rpm -q --qf %{VERSION}"
extrapkgs=("pykickstart" "isomd5sum" "squashfs-tools" "device-mapper" "sqlite" "zlib-devel" "python-devel" "qemu-img" "make")
;;
"MeeGo")
installer="zypper install"
querycmd="rpm -q"
qvercmd="rpm -q --qf %{VERSION}"
extrapkgs=("pykickstart" "isomd5sum" "squashfs-tools" "device-mapper" "sqlite" "zlib-devel" "python-devel" "make")
;;
"openSUSE")
installer="zypper install"
querycmd="rpm -q"
qvercmd="rpm -q --qf %{VERSION}"
extrapkgs=("pykickstart" "squashfs" "device-mapper" "sqlite3" "zlib-devel" "python-devel" "qemu" "make")
;;
"SUSE")
installer="zypper install"
querycmd="rpm -q"
qvercmd="rpm -q --qf %{VERSION}"
extrapkgs=("pykickstart" "isomd5sum" "squashfs-tools" "device-mapper" "sqlite" "zlib-devel" "python-devel" "qemu-img")
;;
"Ubuntu")
installer="apt-get install"
querycmd="dpkg -s"
qvercmd="dpkg -s"
extrapkgs=("python-pykickstart" "isomd5sum" "squashfs-tools" "python-dev" "dmsetup" "sqlite3" "libsqlite3-0" "zlib1g-dev" "qemu-kvm")
read dummy ubuntu_rel < <(lsb_release -r)
# Include elementtree packages only if Ubuntu major release is older than 10.04
if [ ${ubuntu_rel%%.*} -lt 10 ] ; then
extrapkgs=(${extrapkgs[*]} "python-celementtree" "python-elementtree")
fi
;;
"Debian")
installer="apt-get install"
querycmd="dpkg -s"
qvercmd="dpkg -s"
extrapkgs=("python-pykickstart" "isomd5sum" "squashfs-tools" "python-celementtree" "python-elementtree" "python-dev" "dmsetup" "sqlite3" "libsqlite3-0" "zlib1g-dev" "qemu" "kvm" "make" "mkisofs")
;;
esac
for ((i=0;i<${#requiredpkgs[@]};i++))
do
installpkg "$querycmd" "$installer" ${requiredpkgs[$i]}
done
for ((i=0;i<${#extrapkgs[@]};i++))
do
installpkg "$querycmd" "$installer" ${extrapkgs[$i]}
done
# Check versions of some packages
packages=("yum" "syslinux" "squashfs-tools" "python-zypp")
versions=("3.2.24" "3.85" "4.0" "0.5.7")
for ((i=0;i<${#packages[@]};i++))
do
checkpkgver "$qvercmd" "${packages[$i]}" "${versions[$i]}"
done
echo ""
echo "You are ready for running Image Creator!!!"
echo ""
|