Unverified Commit e02b7d0e authored by Philip Müller's avatar Philip Müller Committed by GitHub

Merge pull request #45 from BTaskaya/master

General Indentation Fixment
parents 209c6c40 f6155df3
......@@ -7,85 +7,85 @@ IDENTIFIERCOUNT=0
MHWD_ADD_DEVICE_SECTION_FOR_EACH_BUSID()
{
local XORGDRIVER="$1"
local XORGFILE="$2"
local VENDORID="$3"
local PCIBUSIDS=""
local XORGDRIVER="$1"
local XORGFILE="$2"
local VENDORID="$3"
local PCIBUSIDS=""
if [ "$VENDORID" != "" ]; then
PCIBUSIDS="$(MHWD_DEVICE_BUS_ID "0300" "$VENDORID" "false")"
fi
if [ "$VENDORID" != "" ]; then
PCIBUSIDS="$(MHWD_DEVICE_BUS_ID "0300" "$VENDORID" "false")"
fi
if [ "$PCIBUSIDS" == "" ]; then
MHWD_ADD_DEVICE_SECTION "$XORGDRIVER" "$XORGFILE" "$4"
return
fi
if [ "$PCIBUSIDS" == "" ]; then
MHWD_ADD_DEVICE_SECTION "$XORGDRIVER" "$XORGFILE" "$4"
return
fi
while read BUSID; do
MHWD_ADD_DEVICE_SECTION "$XORGDRIVER" "$XORGFILE" "BusID \"PCI:$BUSID\"|$4"
done <<< "$(echo "$PCIBUSIDS")"
while read BUSID; do
MHWD_ADD_DEVICE_SECTION "$XORGDRIVER" "$XORGFILE" "BusID \"PCI:$BUSID\"|$4"
done <<< "$(echo "$PCIBUSIDS")"
}
MHWD_ADD_DEVICE_SECTION()
{
local XORGDRIVER="$1"
local XORGFILE="$2"
local XORGDRIVER="$1"
local XORGFILE="$2"
echo 'Section "Device"' >> "$XORGFILE"
echo " Identifier \"Device${IDENTIFIERCOUNT}\"" >> "$XORGFILE"
echo " Driver \"$XORGDRIVER\"" >> "$XORGFILE"
echo 'Section "Device"' >> "$XORGFILE"
echo " Identifier \"Device${IDENTIFIERCOUNT}\"" >> "$XORGFILE"
echo " Driver \"$XORGDRIVER\"" >> "$XORGFILE"
IFS='|'
for i in $3; do
echo " $i" >> "$XORGFILE"
done
unset IFS
IFS='|'
for i in $3; do
echo " $i" >> "$XORGFILE"
done
unset IFS
echo 'EndSection' >> "$XORGFILE"
echo ' ' >> "$XORGFILE"
echo 'EndSection' >> "$XORGFILE"
echo ' ' >> "$XORGFILE"
IDENTIFIERCOUNT=$[IDENTIFIERCOUNT + 1]
IDENTIFIERCOUNT=$[IDENTIFIERCOUNT + 1]
}
MHWD_ADD_DRI()
{
# only for free drivers
sed -i /'Section "Device"'/,/'EndSection'/s/'EndSection'/"\tOption \"DRI\" \"true\"\nEndSection"/g "$1"
echo ' ' >> "$1"
echo 'Section "DRI"' >> "$1"
echo ' Group "video"' >> "$1"
echo ' Mode 0666' >> "$1"
echo 'EndSection' >> "$1"
echo ' ' >> "$1"
# only for free drivers
sed -i /'Section "Device"'/,/'EndSection'/s/'EndSection'/"\tOption \"DRI\" \"true\"\nEndSection"/g "$1"
echo ' ' >> "$1"
echo 'Section "DRI"' >> "$1"
echo ' Group "video"' >> "$1"
echo ' Mode 0666' >> "$1"
echo 'EndSection' >> "$1"
echo ' ' >> "$1"
}
MHWD_ADD_COMPOSITING()
{
echo ' ' >> "$1"
echo 'Section "Extensions"' >> "$1"
echo ' Option "Composite" "Enable"' >> "$1"
echo ' Option "RENDER" "Enable"' >> "$1"
echo 'EndSection' >> "$1"
echo ' ' >> "$1"
echo ' ' >> "$1"
echo 'Section "Extensions"' >> "$1"
echo ' Option "Composite" "Enable"' >> "$1"
echo ' Option "RENDER" "Enable"' >> "$1"
echo 'EndSection' >> "$1"
echo ' ' >> "$1"
}
MHWD_ADD_BACKSPACE()
{
echo ' ' >> "$1"
echo 'Section "InputClass"' >> "$1"
echo ' Identifier "Keyboard Defaults"' >> "$1"
echo ' MatchIsKeyboard "yes"' >> "$1"
echo ' Option "XkbOptions" "terminate:ctrl_alt_bksp"' >> "$1"
echo 'EndSection' >> "$1"
echo ' ' >> "$1"
echo ' ' >> "$1"
echo 'Section "InputClass"' >> "$1"
echo ' Identifier "Keyboard Defaults"' >> "$1"
echo ' MatchIsKeyboard "yes"' >> "$1"
echo ' Option "XkbOptions" "terminate:ctrl_alt_bksp"' >> "$1"
echo 'EndSection' >> "$1"
echo ' ' >> "$1"
}
......
......@@ -24,41 +24,41 @@ kernel_cmdline()
init_args() {
local ARGS="$(kernel_cmdline mhwdfb):" # additional ':' if f2 isn't set -> empty string
local ARGS="$(kernel_cmdline mhwdfb):" # additional ':' if f2 isn't set -> empty string
ARG_FB_DRIVER="$(echo "${ARGS}" | cut -d: -f1)"
ARG_RESOLUTION="$(echo "${ARGS}" | cut -d: -f2)"
ARG_FB_DRIVER="$(echo "${ARGS}" | cut -d: -f1)"
ARG_RESOLUTION="$(echo "${ARGS}" | cut -d: -f2)"
}
run_earlyhook()
{
init_args
init_args
if [ "${ARG_FB_DRIVER}" != "kms" ]; then
# Disable KMS modules
for module in radeon nouveau i915 via-agp sis-agp intel-agp amd64-agp ati-agp sworks-agp ali-agp amd-k7-agp nvidia-agp efficeon-agp
do
echo "blacklist ${module}" >> "/etc/modprobe.d/mhwd-kms.conf"
done
fi
# Disable KMS modules
for module in radeon nouveau i915 via-agp sis-agp intel-agp amd64-agp ati-agp sworks-agp ali-agp amd-k7-agp nvidia-agp efficeon-agp
do
echo "blacklist ${module}" >> "/etc/modprobe.d/mhwd-kms.conf"
done
fi
}
run_latehook()
{
init_args
init_args
if [ "${ARG_FB_DRIVER}" == "uvesafb" ]; then
if [ "${ARG_RESOLUTION}" == "" ]; then
/sbin/modprobe uvesafb
else
case "${ARG_RESOLUTION}" in
*-*) ;;
*) ARG_RESOLUTION="${ARG_RESOLUTION}-32" ;;
esac
if [ "${ARG_FB_DRIVER}" == "uvesafb" ]; then
if [ "${ARG_RESOLUTION}" == "" ]; then
/sbin/modprobe uvesafb
else
case "${ARG_RESOLUTION}" in
*-*) ;;
*) ARG_RESOLUTION="${ARG_RESOLUTION}-32" ;;
esac
/sbin/modprobe uvesafb mode_option=${ARG_RESOLUTION}
fi
fi
/sbin/modprobe uvesafb mode_option=${ARG_RESOLUTION}
fi
fi
}
......@@ -6,102 +6,102 @@ MHWDDEVICES=()
MHWD_HEADING()
{
echo '##' > "$1"
echo '## Generated by mhwd - Manjaro Hardware Detection' >> "$1"
echo '##' >> "$1"
echo ' ' >> "$1"
echo ' ' >> "$1"
echo '##' > "$1"
echo '## Generated by mhwd - Manjaro Hardware Detection' >> "$1"
echo '##' >> "$1"
echo ' ' >> "$1"
echo ' ' >> "$1"
}
MHWD_IS_DEVICE()
{
local CCLASSID="$1"
local CVENDORID="$2"
local CDEVICEID="$3"
for device in ${MHWDDEVICES[@]}; do
while read CLASSID VENDORID DEVICEID BUSID; do
if [ "$CCLASSID" == "$CLASSID" ] && [ "$CVENDORID" == "$VENDORID" ] && [ "$CDEVICEID" == "$DEVICEID" ]; then
return 0
fi
done <<< "$(echo "$device" | sed 's/|/ /g')"
done
return 1
local CCLASSID="$1"
local CVENDORID="$2"
local CDEVICEID="$3"
for device in ${MHWDDEVICES[@]}; do
while read CLASSID VENDORID DEVICEID BUSID; do
if [ "$CCLASSID" == "$CLASSID" ] && [ "$CVENDORID" == "$VENDORID" ] && [ "$CDEVICEID" == "$DEVICEID" ]; then
return 0
fi
done <<< "$(echo "$device" | sed 's/|/ /g')"
done
return 1
}
MHWD_FUNC_ON_MATCH()
{
local CCLASSID="$1"
local CVENDORID="$2"
local CDEVICEIDS="$3"
local RUNFUNC="$4"
for device in ${MHWDDEVICES[@]}; do
while read CLASSID VENDORID DEVICEID BUSID; do
if [ "$CCLASSID" == "$CLASSID" ] && [ "$CVENDORID" == "$VENDORID" ]; then
for d in $CDEVICEIDS; do
if [ "$d" == "$DEVICEID" ]; then
$RUNFUNC
return
fi
done
fi
done <<< "$(echo "$device" | sed 's/|/ /g')"
done
local CCLASSID="$1"
local CVENDORID="$2"
local CDEVICEIDS="$3"
local RUNFUNC="$4"
for device in ${MHWDDEVICES[@]}; do
while read CLASSID VENDORID DEVICEID BUSID; do
if [ "$CCLASSID" == "$CLASSID" ] && [ "$CVENDORID" == "$VENDORID" ]; then
for d in $CDEVICEIDS; do
if [ "$d" == "$DEVICEID" ]; then
$RUNFUNC
return
fi
done
fi
done <<< "$(echo "$device" | sed 's/|/ /g')"
done
}
MHWD_DEVICE_BUS_ID()
{
local CCLASSID="$1"
local CVENDORID="$2"
local ONLYFIRST="$3"
for device in ${MHWDDEVICES[@]}; do
while read CLASSID VENDORID DEVICEID BUSID; do
if [ "$CVENDORID" == "*" ]; then
VENDORID="*"
fi
if [ "$CCLASSID" == "$CLASSID" ] && [ "$CVENDORID" == "$VENDORID" ]; then
echo "$BUSID"
if [ "$ONLYFIRST" == "true" ] || [ "$ONLYFIRST" == "yes" ]; then
return
fi
fi
done <<< "$(echo "$device" | sed 's/|/ /g')"
done
local CCLASSID="$1"
local CVENDORID="$2"
local ONLYFIRST="$3"
for device in ${MHWDDEVICES[@]}; do
while read CLASSID VENDORID DEVICEID BUSID; do
if [ "$CVENDORID" == "*" ]; then
VENDORID="*"
fi
if [ "$CCLASSID" == "$CLASSID" ] && [ "$CVENDORID" == "$VENDORID" ]; then
echo "$BUSID"
if [ "$ONLYFIRST" == "true" ] || [ "$ONLYFIRST" == "yes" ]; then
return
fi
fi
done <<< "$(echo "$device" | sed 's/|/ /g')"
done
}
MHWD_CHECK_KMODS()
{
CONKMODS=""
DEPKMODS=""
if [ "${CONKMOD}" != "" ]; then
for KERNEL in ${KERNELS} ; do
if [ "$(pacman -Qq | grep -o ${KERNEL} -m1)" != "" ]; then
for KMOD in ${CONKMOD} ; do
CONKMODS="${CONKMODS} ${KERNEL}-${KMOD}"
done
fi
done
fi
if [ "${DEPKMOD}" != "" ]; then
for KERNEL in ${KERNELS} ; do
if [ "$(pacman -Qq | grep -o ${KERNEL} -m1)" != "" ]; then
for KMOD in ${DEPKMOD} ; do
DEPKMODS="${DEPKMODS} ${KERNEL}-${KMOD}"
done
fi
done
fi
CONKMODS=""
DEPKMODS=""
if [ "${CONKMOD}" != "" ]; then
for KERNEL in ${KERNELS} ; do
if [ "$(pacman -Qq | grep -o ${KERNEL} -m1)" != "" ]; then
for KMOD in ${CONKMOD} ; do
CONKMODS="${CONKMODS} ${KERNEL}-${KMOD}"
done
fi
done
fi
if [ "${DEPKMOD}" != "" ]; then
for KERNEL in ${KERNELS} ; do
if [ "$(pacman -Qq | grep -o ${KERNEL} -m1)" != "" ]; then
for KMOD in ${DEPKMOD} ; do
DEPKMODS="${DEPKMODS} ${KERNEL}-${KMOD}"
done
fi
done
fi
}
MHWD_CHECK_PKGS()
{
local REMOVEPKGS=""
local REMOVEPKGS=""
for PKG in ${PACKAGES} ; do
for RMPKG in $(pacman -Qq | grep ${PKG}) ; do
......@@ -136,223 +136,223 @@ MHWD64CONF="/etc/mhwd-x86_64.conf"
# source lib32 true/false for x86_64
if [ "${ARCH}" == "x86_64" ];then
if [ -f ${MHWD64CONF} ];then
echo "Sourcing ${MHWD64CONF}"
. ${MHWD64CONF}
else
echo "Using default"
MHWD64_IS_LIB32="true"
fi
echo "Has lib32 support: ${MHWD64_IS_LIB32}"
if [ -f ${MHWD64CONF} ];then
echo "Sourcing ${MHWD64CONF}"
. ${MHWD64CONF}
else
echo "Using default"
MHWD64_IS_LIB32="true"
fi
echo "Has lib32 support: ${MHWD64_IS_LIB32}"
fi
if [ "${PARAM}" -lt 1 ]; then
echo "No Arguments!"
exit 1
echo "No Arguments!"
exit 1
fi
for (( I=1; $I <= $PARAM; I++ ));do
case "$1" in
--install)
INSTALL="true"
;;
--remove)
REMOVE="true"
;;
--sync)
SYNC="y"
;;
--cachedir)
shift
CACHEPATH="$1"
;;
--config)
shift
CONFIGPATH="$1"
;;
--pmconfig)
shift
PMCONFIG="$1"
;;
--pmroot)
shift
PMROOT="$1"
;;
--device)
shift
MHWDDEVICES+=("$1")
;;
"") ;;
*)
echo "Wrong Argument: $1"
exit 1
;;
esac
shift
case "$1" in
--install)
INSTALL="true"
;;
--remove)
REMOVE="true"
;;
--sync)
SYNC="y"
;;
--cachedir)
shift
CACHEPATH="$1"
;;
--config)
shift
CONFIGPATH="$1"
;;
--pmconfig)
shift
PMCONFIG="$1"
;;
--pmroot)
shift
PMROOT="$1"
;;
--device)
shift
MHWDDEVICES+=("$1")
;;
"") ;;
*)
echo "Wrong Argument: $1"
exit 1
;;
esac
shift
done
# Set final variables
PACMAN="${PACMAN} --cachedir ${CACHEPATH} --config ${PMCONFIG} --root ${PMROOT}"
if [ "${CONFIGPATH}" != "" ] && [ -e "${CONFIGPATH}" ]; then
echo "Sourcing ${CONFIGPATH}"
. "${CONFIGPATH}"
for classid in ${CLASSIDS} ; do
echo "Processing classid: ${classid}"
if [ -e "${INCLUDEPATH}/${classid}" ]; then
echo "Sourcing ${INCLUDEPATH}/${classid}"
. "${INCLUDEPATH}/${classid}"
fi
done
echo "Sourcing ${CONFIGPATH}"
. "${CONFIGPATH}"
for classid in ${CLASSIDS} ; do
echo "Processing classid: ${classid}"
if [ -e "${INCLUDEPATH}/${classid}" ]; then
echo "Sourcing ${INCLUDEPATH}/${classid}"
. "${INCLUDEPATH}/${classid}"
fi
done
else
exit 1
exit 1
fi
if [ "${INSTALL}" == "true" ]; then
# Run preinstall function
if [ "`grep "pre_install" "${CONFIGPATH}" | cut -d"#" -f1 | cut -d"(" -f1 | grep "pre_install"`" == "pre_install" ]; then
pre_install
fi
PACKAGES=""
# Remove conflicts
if [ "${CONFLDD}" != "" ]; then
PACKAGES="${CONFLDD}"
fi
if [ "${ARCH}" == "x86_64" ] && [ "${CONFLDD_64}" != "" ]; then
if [ "${MHWD64_IS_LIB32}" == "true" ];then
PACKAGES="${PACKAGES} ${CONFLDD_64}"
else
PACKAGES="${PACKAGES}"
fi
fi
# Run preinstall function
if [ "`grep "pre_install" "${CONFIGPATH}" | cut -d"#" -f1 | cut -d"(" -f1 | grep "pre_install"`" == "pre_install" ]; then
pre_install
fi
PACKAGES=""
# Remove conflicts
if [ "${CONFLDD}" != "" ]; then
PACKAGES="${CONFLDD}"
fi
if [ "${ARCH}" == "x86_64" ] && [ "${CONFLDD_64}" != "" ]; then
if [ "${MHWD64_IS_LIB32}" == "true" ];then
PACKAGES="${PACKAGES} ${CONFLDD_64}"
else
PACKAGES="${PACKAGES}"
fi
fi
# Check if packages are installed
MHWD_CHECK_PKGS
if [ "${PACKAGES}" != "" ]; then
${PACMAN} -Rdd ${PACKAGES}
if [ "$?" -ne "0" ]; then
echo "Error: pacman failed!"
exit 1
fi
fi
PACKAGES=""
# Check for extramodules
MHWD_CHECK_KMODS
# Remove conflicts
if [ "${CONFLICTS}" != "" ]; then
PACKAGES="${CONFLICTS}"
fi
if [ "${ARCH}" == "i686" ] && [ "${CONFLICTS_32}" != "" ]; then
PACKAGES="${PACKAGES} ${CONFLICTS_32}"
fi
if [ "${ARCH}" == "x86_64" ] && [ "${CONFLICTS_64}" != "" ]; then
if [ "${MHWD64_IS_LIB32}" == "true" ];then
PACKAGES="${PACKAGES} ${CONFLICTS_64}"
else
PACKAGES="${PACKAGES}"
fi
fi
if [ "${CONKMODS}" != "" ]; then
PACKAGES="${PACKAGES} ${CONKMODS}"
fi
if [ "${PACKAGES}" != "" ]; then
${PACMAN} -Rdd ${PACKAGES}
if [ "$?" -ne "0" ]; then
echo "Error: pacman failed!"
exit 1
fi
fi
PACKAGES=""
# Check for extramodules
MHWD_CHECK_KMODS
# Remove conflicts
if [ "${CONFLICTS}" != "" ]; then
PACKAGES="${CONFLICTS}"
fi
if [ "${ARCH}" == "i686" ] && [ "${CONFLICTS_32}" != "" ]; then
PACKAGES="${PACKAGES} ${CONFLICTS_32}"
fi
if [ "${ARCH}" == "x86_64" ] && [ "${CONFLICTS_64}" != "" ]; then
if [ "${MHWD64_IS_LIB32}" == "true" ];then
PACKAGES="${PACKAGES} ${CONFLICTS_64}"
else
PACKAGES="${PACKAGES}"
fi
fi
if [ "${CONKMODS}" != "" ]; then