You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.4 KiB

#!/bin/bash
debian_os(){
[ -f /etc/os-release ] && source /etc/os-release || return 1;
[ "$ID" == "ubuntu" ] && prefix="sudo" || prefix='';
install_log="$ldir/os-install.log";
failed=0;
packages="";
for e in "${binvars[@]}";
do
if ! hash "$e" 2>/dev/null; then
inst="$e";
case $e in
svn)
inst="subversion";
;;
xz)
inst="xz-utils";
;;
esac;
printf -v pad %40s; e=$e$pad; e=${e:0:15};
echo -e "$w_l select $g_l$e$y_l from: $inst";
packages="$packages $inst";
fi;
done;
for e in "${headervars[@]}";
do
e1=$(find /usr/include/* |grep -m1 "$e");
if [ ! ${#e1} -gt 8 ]; then
case $e in
crypto.h)
inst="libssl-dev";
;;
libusb.h)
inst="libusb-1.0.0-dev";
;;
pcsclite.h)
inst="libpcsclite-dev";
;;
pthread.h)
inst="libc-dev-bin";
;;
esac;
printf -v pad %40s; e=$e$pad; e=${e:0:15};
echo -e "$w_l select $g_l$e$y_l from: $inst";
packages="$packages $inst";
fi;
done;
for e in "${libvars[@]}";
do
e1=$(find /usr/lib* |grep -m1 "$e");
if [ ! ${#e1} -gt 8 ]; then
case $e in
libccidtwin.so)
inst="libccid";
;;
esac;
printf -v pad %40s; e=$e$pad; e=${e:0:15};
echo -e "$w_l select $g_l$e$y_l from: $inst";
packages="$packages $inst";
fi;
done;
if [ "$(uname -m)" == "x86_64" ] && [ ! -f /usr/lib32/libz.so.1 ]; then
if [ ! -f /usr/lib32/libz.so.1 ]; then
e="zlib32";
inst="lib32z1";
printf -v pad %40s; e=$e$pad; e=${e:0:15};
echo -e "$w_l select $g_l$e$y_l from: $inst";
packages="$packages $inst";
fi
fi
if [ ${#packages} -gt 0 ]; then
echo -n >"$install_log" &2>/dev/null;
echo -e "$w_l\n INSTALLATION\n ============";
if [ "$EUID" -ne 0 ] && [ ! "$ID" == "ubuntu" ]; then
echo -en "$r_l\n enter root ";
su root -c "
echo -e '\033[1;37m\n update\033[1;32m package list...\n';
apt-get -y update |grep --line-buffered -v '^T\|(\|^I\|^H' 2>&1;
echo -e '\n\033[1;37m install\033[1;32m $txt_selected packages\033[1;33m $txt_wait\n';
apt-get -y -qq install $packages |grep --line-buffered '(' |grep --line-buffered -v 'nicht\|dpkg';
"
else
echo -e "\033[1;37m update\033[1;32m package list... \n";
$prefix apt-get -y update |grep --line-buffered -v '^T\|(\|^I\|^H' 2>&1;
echo -e "\n\033[1;37m install\033[1;32m packages \033[1;33m$txt_wait \n";
$prefix apt-get -y -qq install $packages |grep --line-buffered '(' |grep --line-buffered -v 'nicht';
fi;
fi;
if hash upx 2>/dev/null; then
upxversion=($(upx -V | awk 'NR==1 { verok=$2>=3.91; printf "%.2f %i", $2, verok }'));
if [ ${upxversion[1]} == 0 ]; then
[ -f "$bindir/upx" ] && rm -f "$bindir/upx" &>/dev/null;
if [ "$(uname -m)" == "x86_64" ]; then
upxarch="upx-3.95-amd64_linux";
else
upxarch="upx-3.95-i386_linux";
fi
upxarchive=$upxarch".tar.bz2";
[ -f "$dldir/$upxarchive" ] && rm -f "$dldir/$upxarchive" &>/dev/null;
upxurl="http://upx.sourceforge.net/download/$upxarchive";
echo -e "$w_l get newer$g_l upx$y_l\tfrom: $upxurl";
echo "+++ $(date): wget $upxurl" >> "$install_log";
if wget --directory-prefix="$dldir" --append-output="$install_log" $upxurl; then
echo "+++ $(date): tar xjvf $upxarchive" >> "$install_log";
tar xjvf "$dldir"/$upxarchive --directory="$bindir" $upxarch/upx --strip-components=1 >> "$install_log" 2>&1 || failed=1;
[ -f "$dldir"/$upxarchive ] && rm -f "$dldir"/$upxarchive &>/dev/null;
else
failed=1;
fi
fi
fi
[ $failed == 1 ] && echo -e "\n$r_l Installation with errors - see: $install_log";
return $failed;
}