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.

102 lines
2.2 KiB

#!/bin/bash
manjaro_os(){
install_log="$ldir/os-install.log";
failed=0;
prefix="sudo";
packages="";
echo -n >"$install_log" &2>/dev/null;
echo -e "$w_l\n INSTALLATION\n ============\n";
source /etc/lsb-release
manjaro_version=$DISTRIB_RELEASE
# without sudo no user installation allowed
hash sudo 2>/dev/null || { [ "$(whoami)" != "root" ] && { echo -e "$r_l You need to be root for that!\n"; return 1; } }
# root needs no sudo
[ "$(whoami)" == "root" ] && prefix="";
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;
echo -e "$w_l select $g_l$e$y_l\tfrom: $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="pcsclite";
;;
pthread.h)
inst="libc-dev-bin";
;;
esac;
echo -e "$w_l select $g_l$e$y_l\tfrom: $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="ccid";
;;
esac;
echo -e "$w_l select $g_l$e$y_l\tfrom: $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";
echo -e "$w_l select $g_l$e$y_l\tfrom: $inst";
packages="$packages $inst";
fi
fi
if [ ${#packages} -gt 0 ]; then
echo -n -e "$w_l update$g_l package list...";
echo "+++ $(date): pacman -Syu" >> "$install_log"
$prefix pacman -Syu >> "$install_log" 2>&1;
echo -e "$y_l done";
echo -n -e "$w_l install$g_l selected packages$y_l please wait...";
echo "+++ $(date): pacman -Sy install$packages" >> "$install_log"
$prefix pacman -S --noconfirm $packages >> "$install_log" 2>&1 || failed=1;
if [ $failed == 0 ]; then
echo -e "$y_l done";
else
echo -e "$r_l failed!";
fi
fi
[ $failed == 1 ] && echo -e "\n$r_l Installation with errors - see: $install_log";
return $failed;
}