2 Commits 6af817a676 ... 7cd20ab94e

Author SHA1 Message Date
  Kirill Kupriyanov 7cd20ab94e Update install script-use the correct init system. 6 years ago
  Kirill Kupriyanov f58b869136 Commented different init system restarts. 6 years ago
2 changed files with 22 additions and 2 deletions
  1. 3 1
      con
  2. 19 1
      install.sh

+ 3 - 1
con

@@ -21,7 +21,9 @@ then
     nmcli dev wifi connect "$1" password "$2"
 elif [ $1 == "restart" ]
 then
-    sudo rc-service NetworkManager restart
+	# Uncomment if using OpenRc --- sudo rc-service NetworkManager restart
+	# Uncomment if using SystemD --- sudo systemctl restart NetworkManager
+	# Uncomment if using Sysvinit --- sudo /etc/init.d NetworkManager restart
 else
     echo ""
     echo "con - a programm to connect to wifi networks using Network Manager."

+ 19 - 1
install.sh

@@ -15,7 +15,25 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
-
+echo "If now you see something like 'command not found' -- its OK."
+echo "The main thing is to get help from con after installing."
+
+# Identify correct init system.
+#
+{
+    systemctl status > /dev/null
+} && {
+    sed -i -e 's/^.*#.*SystemD.*--- /\t/' ./con
+} || {
+    {
+        rc-status > /dev/null && sed -i -e 's/^.*#.*OpenRc.*--- /\t/' ./con
+    } || {
+        sed -i -e 's/^.*#.*Sysvinit.*--- /\t/' ./con
+    }
+}
+
+# Copy program to system location.
+#
 sudo cp ./con /usr/bin
 con --help