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
}
This diff is collapsed.
This diff is collapsed.
......@@ -13,114 +13,114 @@ MODULES_LOAD="/etc/modules-load.d"
# param 1: modules to load
# param 2: blacklisted modules
set_modules() {
echo "##" > "/etc/modprobe.d/mhwd-gpu.conf"
echo "## Generated by mhwd - Manjaro Hardware Detection" >> "/etc/modprobe.d/mhwd-gpu.conf"
echo "##" >> "/etc/modprobe.d/mhwd-gpu.conf"
echo " " >> "/etc/modprobe.d/mhwd-gpu.conf"
for module in $2
do
echo "blacklist ${module}" >> "/etc/modprobe.d/mhwd-gpu.conf"
# Unload module if X is not running
if [ ! "$(pgrep X)" ]; then
rmmod -f ${module}
fi
done
echo "##" > "${MODULES_LOAD}/mhwd-gpu.conf"
echo "## Generated by mhwd - Manjaro Hardware Detection" >> "${MODULES_LOAD}/mhwd-gpu.conf"
echo "##" >> "${MODULES_LOAD}/mhwd-gpu.conf"
echo " " >> "${MODULES_LOAD}/mhwd-gpu.conf"
for module in $1
do
echo "${module}" >> "${MODULES_LOAD}/mhwd-gpu.conf"
# Load module if X is not running
if [ ! "$(pgrep X)" ]; then
modprobe ${module}
fi
done
echo "##" > "/etc/modprobe.d/mhwd-gpu.conf"
echo "## Generated by mhwd - Manjaro Hardware Detection" >> "/etc/modprobe.d/mhwd-gpu.conf"
echo "##" >> "/etc/modprobe.d/mhwd-gpu.conf"
echo " " >> "/etc/modprobe.d/mhwd-gpu.conf"
for module in $2
do
echo "blacklist ${module}" >> "/etc/modprobe.d/mhwd-gpu.conf"
# Unload module if X is not running
if [ ! "$(pgrep X)" ]; then
rmmod -f ${module}
fi
done
echo "##" > "${MODULES_LOAD}/mhwd-gpu.conf"
echo "## Generated by mhwd - Manjaro Hardware Detection" >> "${MODULES_LOAD}/mhwd-gpu.conf"
echo "##" >> "${MODULES_LOAD}/mhwd-gpu.conf"
echo " " >> "${MODULES_LOAD}/mhwd-gpu.conf"
for module in $1
do
echo "${module}" >> "${MODULES_LOAD}/mhwd-gpu.conf"
# Load module if X is not running
if [ ! "$(pgrep X)" ]; then
modprobe ${module}
fi
done
}
# param 1: Xorg configuration file
set_xorg()
{
if [ -e "${MHWDXORGCONF}" ]; then
rm "${MHWDXORGCONF}"
fi
if [ -e "$1" ]; then
ln -sf "$1" "${MHWDXORGCONF}"
echo "xorg configuration file: '$1'"
else
echo "warning: could not find '$1'!"
fi
if [ -e "${MHWDXORGCONF}" ]; then
rm "${MHWDXORGCONF}"
fi
if [ -e "$1" ]; then
ln -sf "$1" "${MHWDXORGCONF}"
echo "xorg configuration file: '$1'"
else
echo "warning: could not find '$1'!"
fi
}
print_link_destination_if_exists()
{
if [ -e "$1" ]; then
echo "$2 '$(readlink "$1")'"
else
echo "warning: could not find '$1'!"
fi
if [ -e "$1" ]; then
echo "$2 '$(readlink "$1")'"
else
echo "warning: could not find '$1'!"
fi
}
print_status()
{
echo ":: status"
echo ":: status"
print_link_destination_if_exists "${MHWDXORGCONF}" " xorg configuration file:"
print_link_destination_if_exists "${MHWDXORGCONF}" " xorg configuration file:"
}
print_help()
{
echo "mhwd-gpu [OPTION] [...]"
echo ""
echo " --help show help"
echo " --status show current status"
echo " --check check for invalid symlinks and repair"
echo " --setxorg [PATH] set xorg configuration file"
echo " --setmod [nvidia/catalyst] set modules"
echo ""
echo "mhwd-gpu [OPTION] [...]"
echo ""
echo " --help show help"
echo " --status show current status"
echo " --check check for invalid symlinks and repair"
echo " --setxorg [PATH] set xorg configuration file"
echo " --setmod [nvidia/catalyst] set modules"
echo ""
}
if [ "${PARAM}" -lt 1 ]; then
print_status
exit 0
print_status
exit 0
fi
for (( I=1; $I <= $PARAM; I++ ));do
case "$1" in
--help)
print_help
exit 0
;;
--status)
print_status
exit 0
;;
--check)
CHECKCONFIG="true"
;;
--setxorg)
shift
SETXORGCONF="$1"
;;
--setmod)
shift
SETMOD="$1"
;;
"") ;;
*)
echo "error: invalid argument: $1"
echo ""
print_help
exit 1
;;
esac
shift
case "$1" in
--help)
print_help
exit 0
;;
--status)
print_status
exit 0
;;
--check)
CHECKCONFIG="true"
;;
--setxorg)
shift
SETXORGCONF="$1"
;;
--setmod)
shift
SETMOD="$1"
;;
"") ;;
*)
echo "error: invalid argument: $1"
echo ""
print_help
exit 1
;;
esac
shift
done
# Check root
......@@ -131,25 +131,25 @@ fi
# Set Modules
if [ "${SETMOD}" == "nvidia" ]; then
set_modules "nvidia" "nouveau ttm drm_kms_helper drm"
set_modules "nvidia" "nouveau ttm drm_kms_helper drm"
elif [ "${SETMOD}" == "catalyst" ] || [ "${SETMOD}" == "ati" ]; then
set_modules "fglrx" "radeon"
set_modules "fglrx" "radeon"
elif [ "${SETMOD}" != "" ]; then
echo "error: invalid argument '${SETMOD}'"
exit 1
echo "error: invalid argument '${SETMOD}'"
exit 1
fi
# Set xorg configuration file
if [ "${SETXORGCONF}" != "" ]; then
set_xorg "${SETXORGCONF}"
set_xorg "${SETXORGCONF}"
fi
# Check config
if [ "${CHECKCONFIG}" == "true" ]; then
if [ -L "${MHWDXORGCONF}" -a ! -e "${MHWDXORGCONF}" ]; then
echo "'${MHWDXORGCONF}' symlink is invalid! Removing it..."
rm "${MHWDXORGCONF}"
elif [ -e "${MHWDXORGCONF}" ]; then
echo "xorg configuration symlink valid..."
fi
if [ -L "${MHWDXORGCONF}" -a ! -e "${MHWDXORGCONF}" ]; then
echo "'${MHWDXORGCONF}' symlink is invalid! Removing it..."
rm "${MHWDXORGCONF}"
elif [ -e "${MHWDXORGCONF}" ]; then
echo "xorg configuration symlink valid..."
fi
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment