LINUX.ORG.RU

[Desurium]скрипт установки зависимостей для сборки


0

1

Немного погуглил и написал такой скрипт. Можно сказать, что это первый мой скрипт.

#!/bin/sh
# Determine the Linux distribution that is being run and install the build dependencies for it.

PASS_MESSAGE="Please provide root password to install build dependecies"

if [ -f /etc/SuSE-release ]; then
	DISTRIBUTION="suse"
elif [ -f /etc/debian_version ]; then
	DISTRIBUTION="debian"
	if [ "$(whoami)" != 'root' ]; then
		echo $PASS_MESSAGE
	fi
	su -c 'apt-get install gcc-4.5 git-core subversion m4 build-essential binutils automake autoconf libtool libgtk2.0-dev libnss3-dev libgconf2-dev libgnome-keyring-dev libdbus-glib-1-dev gperf bison libcups2-dev flex libjpeg-dev libasound2-dev libbz2-dev libxpm-dev libx11-dev libssl-dev scons'
elif [ -f /etc/redhat-release ]; then
	DISTRIBUTION="redhat"
	if [ "$(whoami)" != 'root' ]; then
		echo $PASS_MESSAGE
	fi
	su -c 'yum install git subversion m4 autoconf gcc-c++ glibc-devel binutils autoconf libtool gtk2-devel nss-devel GConf2-devel libgnome-keyring-devel dbus-glib-devel gperf bison cups-devel flex libjpeg-turbo-devel alsa-lib-devel bzip2-devel libXpm-devel libX11-devel openssl-devel scons'
fi
Но он вызвал дискуссию.

Jookia

Yes, but this script is going to end up being a very long and complex file, and I think rewriting it in Python could stop that, or other measures. On IRC, Lodle suggested having a script for each distro.

Подскажите как можно его улучшить и добавьте команды для ваших дистрибутивов. И чтобы при этом он не сильно раздувался и усложнялся.

#!/bin/sh
# Determine the Linux distribution that is being run and install the build dependencies for it.

PASS_MESSAGE="Please provide root password to install build dependecies"
debian_cmd='apt-get install gcc-4.5 git-core subversion m4 build-essential binutils automake autoconf libtool libgtk2.0-dev libnss3-dev libgconf2-dev libgnome-keyring-dev libdbus-glib-1-dev gperf bison libcups2-dev flex libjpeg-dev libasound2-dev libbz2-dev libxpm-dev libx11-dev libssl-dev scons'
redhat_cmd='yum install git subversion m4 autoconf gcc-c++ glibc-devel binutils autoconf libtool gtk2-devel nss-devel GConf2-devel libgnome-keyring-devel dbus-glib-devel gperf bison cups-devel flex libjpeg-turbo-devel alsa-lib-devel bzip2-devel libXpm-devel libX11-devel openssl-devel scons'

if [ -f /etc/SuSE-release ]; then
	DISTRIBUTION="suse"
elif [ -f /etc/debian_version ]; then
	DISTRIBUTION="debian"
elif [ -f /etc/redhat-release ]; then
	DISTRIBUTION="redhat"
fi
	if [ "$(whoami)" != 'root' ]; then
		echo $PASS_MESSAGE
	fi
	su -c ${DISTRIBUTION}_cmd

как минимум так

anTaRes ★★★★
()
Ответ на: комментарий от anonymous

тогда

	if [ "$(whoami)" != 'root' ]; then
		echo $PASS_MESSAGE
	fi


тупо удаляем этот кусок и не морочим себе голову ;)
anTaRes ★★★★
()
Ответ на: комментарий от anTaRes
#!/bin/sh
# Determine the Linux distribution that is being run and install the build dependencies for it.

PASS_MESSAGE="Please provide root password to install build dependecies"
debian_cmd='apt-get install gcc git-core subversion m4 build-essential binutils automake autoconf libtool libgtk2.0-dev libnss3-dev libgconf2-dev libgnome-keyring-dev libdbus-glib-1-dev gperf bison libcups2-dev flex libjpeg-dev libasound2-dev libbz2-dev libxpm-dev libx11-dev libssl-dev scons'
redhat_cmd='yum install gcc gcc-c++ git subversion m4 autoconf glibc-devel make binutils automake autoconf libtool gtk2-devel nss-devel GConf2-devel libgnome-keyring-devel dbus-glib-devel gperf bison cups-devel flex libjpeg-turbo-devel alsa-lib-devel bzip2-devel libXpm-devel libX11-devel openssl-devel scons'
suse_cmd='zypper installl gcc gcc-c++ git subversion m4 glibc-devel make binutils automake autoconf libtool gtk2-devel mozilla-nss-devel gconf2-devel libgnome-keyring-devel libdconf-dbus-devel gperf bison cups-devel flex libjpeg8-devel alsa-devel libbz2-devel xorg-x11-libXpm-devel xorg-x11-libX11-devel libopenssl-devel'

if [ -f /etc/SuSE-release ]; then
	DISTRIBUTION="suse"
elif [ -f /etc/debian_version ]; then
	DISTRIBUTION="debian"
elif [ -f /etc/redhat-release ]; then
	DISTRIBUTION="redhat"
else 
	DISTRIBUTION="unknown"
 	echo "This script does not support your distribution, plese consult the REDME file for build dependencies"
	exit
fi

if [ $UID != "0" ]; then
	echo $PASS_MESSAGE
fi
	su -c ${DISTRIBUTION}_cmd

Ты сам то проверял? Говорит что нет команды suse_cmd.

yurikoles ★★★
() автор топика
Ответ на: комментарий от yurikoles

Ты сам то проверял?

нет
просто показал как можно «улучшить»

Подскажите как можно его улучшить

anTaRes ★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.