mirror of
https://github.com/albfan/miraclecast.git
synced 2025-02-12 17:41:56 +00:00
parent
e5795edd04
commit
8b5a7b68d9
6 changed files with 65 additions and 31 deletions
|
@ -106,9 +106,9 @@ Steps to use it as sink:
|
||||||
1. shutdown wpa_supplicant and NetworkManager
|
1. shutdown wpa_supplicant and NetworkManager
|
||||||
|
|
||||||
$ sudo kill -9 $(ps -ef | grep wpa_supplican[t] | awk '{print $2}')
|
$ sudo kill -9 $(ps -ef | grep wpa_supplican[t] | awk '{print $2}')
|
||||||
# now you can use `res/kill-wpa.sh`
|
# you can use `miracle-stop-network-manager` for a standard way to stop it
|
||||||
|
|
||||||
>Remember to save your config to use with `res/normal-wifi.sh`
|
>Remember to save your config to use with `miracle-start-network-manager`
|
||||||
>it will be easily located with `ps -ef | grep wpa_supplicant` on `-c` option.
|
>it will be easily located with `ps -ef | grep wpa_supplicant` on `-c` option.
|
||||||
|
|
||||||
2. launch wifi daemon
|
2. launch wifi daemon
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
########### install files ###############
|
########### install files ###############
|
||||||
|
|
||||||
install(
|
install(
|
||||||
PROGRAMS miracle-gst gstplayer uibc-viewer
|
PROGRAMS miracle-gst gstplayer uibc-viewer miracle-stop-network-manager miracle-utils.sh miracle-start-network-manager
|
||||||
DESTINATION bin
|
DESTINATION bin
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
bin_SCRIPTS = miracle-gst gstplayer uibc-viewer
|
bin_SCRIPTS = miracle-gst gstplayer uibc-viewer miracle-stop-network-manager miracle-utils.sh miracle-start-network-manager
|
||||||
EXTRA_DIST = wpa.conf
|
EXTRA_DIST = wpa.conf
|
||||||
|
|
||||||
dbuspolicydir=$(sysconfdir)/dbus-1/system.d
|
dbuspolicydir=$(sysconfdir)/dbus-1/system.d
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
./kill-wpa.sh
|
miracle-stop-network-manager
|
||||||
|
|
||||||
. miracle-utils.sh
|
. miracle-utils.sh
|
||||||
|
|
||||||
|
echo starting wpa_supplicant for normal connection
|
||||||
|
start_network_manager
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# Nothing of the code below is needed to restart wireless anymore on systemd, tweak it for distros based
|
||||||
|
# on service or other system admin daemon.
|
||||||
|
|
||||||
ETHER_NAMES=$(find_choosable_networknames)
|
ETHER_NAMES=$(find_choosable_networknames)
|
||||||
|
|
||||||
ETHER_COUNT=$(echo "$ETHER_NAMES" | wc -l)
|
ETHER_COUNT=$(echo "$ETHER_NAMES" | wc -l)
|
||||||
|
@ -45,13 +54,5 @@ fi
|
||||||
# default path for config file
|
# default path for config file
|
||||||
CONFIG_FILE=${1:-/run/network/wpa_supplicant_${ETHERNAME}.conf}
|
CONFIG_FILE=${1:-/run/network/wpa_supplicant_${ETHERNAME}.conf}
|
||||||
|
|
||||||
|
|
||||||
echo starting wpa_supplicant for normal connection
|
|
||||||
if check_ubuntu_distro || check_debian_distro
|
|
||||||
then
|
|
||||||
start_ubuntu_network_manager
|
|
||||||
sudo wpa_supplicant -B -u -s -O /var/run/wpa_supplicant
|
|
||||||
else
|
|
||||||
sudo wpa_supplicant -B -u -P /run/wpa_supplicant_${ETHERNAME}pid -i ${ETHERNAME} -D nl80211 -c$CONFIG_FILE
|
sudo wpa_supplicant -B -u -P /run/wpa_supplicant_${ETHERNAME}pid -i ${ETHERNAME} -D nl80211 -c$CONFIG_FILE
|
||||||
fi
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
. miracle-utils.sh
|
. miracle-utils.sh
|
||||||
|
|
||||||
kill_ubuntu_network_manager
|
stop_network_manager
|
||||||
|
|
||||||
WPA_PID=$(find_wpa_supplicant_pid)
|
WPA_PID=$(find_wpa_supplicant_pid)
|
||||||
if [ -n "$WPA_PID" ]
|
if [ -n "$WPA_PID" ]
|
|
@ -107,12 +107,14 @@ function find_wpa_supplicant_pid {
|
||||||
function check_archlinux_distro {
|
function check_archlinux_distro {
|
||||||
test -f "/etc/arch-release"
|
test -f "/etc/arch-release"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# checking if distro is ubuntu
|
# checking if distro is ubuntu
|
||||||
#
|
#
|
||||||
function check_ubuntu_distro {
|
function check_ubuntu_distro {
|
||||||
cat /proc/version | grep -i ubuntu
|
cat /proc/version | grep -i ubuntu
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# checking if distro is debian
|
# checking if distro is debian
|
||||||
#
|
#
|
||||||
|
@ -121,45 +123,76 @@ function check_debian_distro {
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# ubuntu manager restarts automatically wpa_supplicant
|
# checking if ubuntu use service
|
||||||
#
|
#
|
||||||
function kill_ubuntu_network_manager {
|
function ubuntu_using_systemd {
|
||||||
if check_ubuntu_distro || check_debian_distro
|
test $( lsb_release -r | awk '{print $2}' | cut -d . -f 1 ) -ge 15
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# checking if debian use service
|
||||||
|
#
|
||||||
|
function debian_using_systemd {
|
||||||
|
test $( lsb_release -r | awk '{print $2}' | cut -d . -f 1 ) -ge 8
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Stop network manager
|
||||||
|
#
|
||||||
|
function stop_network_manager {
|
||||||
|
stop_service_network_manager
|
||||||
|
stop_systemd_network_manager
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# stop Network manager from service
|
||||||
|
#
|
||||||
|
function stop_service_network_manager {
|
||||||
|
if ( check_ubuntu_distro && ! ubuntu_using_systemd ) || ( check_debian_distro && ! debian_using_systemd )
|
||||||
then
|
then
|
||||||
echo stopping NetworkManager
|
echo stopping NetworkManager using service
|
||||||
sudo service NetworkManager stop
|
sudo service NetworkManager stop
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# arch linux manager restarts automatically wpa_supplicant
|
# stop Network manager from systemd
|
||||||
#
|
#
|
||||||
function kill_archlinux_network_manager {
|
function stop_systemd_network_manager {
|
||||||
if check_ubuntu_distro
|
if check_arch_linux_distro || ( check_ubuntu_distro && ubuntu_using_systemd ) || ( check_debian_distro && debian_using_systemd )
|
||||||
then
|
then
|
||||||
echo stopping NetworkManager
|
echo stopping NetworkManager using systemctl
|
||||||
sudo systemctl stop Network.service
|
sudo systemctl stop Network.service
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# start ubuntu manager
|
|
||||||
#
|
#
|
||||||
function start_ubuntu_network_manager {
|
#
|
||||||
if check_ubuntu_distro || check_debian_distro
|
function start_network_manager {
|
||||||
|
start_service_network_manager
|
||||||
|
start_systemd_network_manager
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# start Network manager with service
|
||||||
|
#
|
||||||
|
function start_service_network_manager {
|
||||||
|
if ( check_ubuntu_distro && ! ubuntu_using_systemd ) || ( check_debian_distro && ! debian_using_systemd )
|
||||||
then
|
then
|
||||||
echo starting NetworkManager
|
echo starting NetworkManager with service
|
||||||
sudo service NetworkManager start
|
sudo service NetworkManager start
|
||||||
|
sudo wpa_supplicant -B -u -s -O /var/run/wpa_supplicant
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# start arch linux manager
|
# start Network manager with systemd
|
||||||
#
|
#
|
||||||
function start_archlinux_network_manager {
|
function start_systemd_network_manager {
|
||||||
if check_archlinux_distro
|
if check_arch_linux_distro || ( check_ubuntu_distro && ubuntu_using_systemd ) || ( check_debian_distro && debian_using_systemd )
|
||||||
then
|
then
|
||||||
echo starting NetworkManager
|
echo starting NetworkManager
|
||||||
sudo systemctl start Network.service
|
sudo systemctl start NetworkManager
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue