Unverified Commit 61008d34 authored by Batuhan Osman Taşkaya's avatar Batuhan Osman Taşkaya Committed by GitHub

Indentetion

parent 83adf987
......@@ -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