diff --git a/configs/sim/axis/vismach/VMC_toolchange/remap.py b/configs/sim/axis/vismach/VMC_toolchange/remap.py index 28558822596..b761957543e 100644 --- a/configs/sim/axis/vismach/VMC_toolchange/remap.py +++ b/configs/sim/axis/vismach/VMC_toolchange/remap.py @@ -1,3 +1,3 @@ -#! /usr/bin/python +#!/usr/bin/env python from stdglue import * diff --git a/configs/sim/axis/vismach/VMC_toolchange/toplevel.py b/configs/sim/axis/vismach/VMC_toolchange/toplevel.py index 941b653e0b3..a7b37735432 100644 --- a/configs/sim/axis/vismach/VMC_toolchange/toplevel.py +++ b/configs/sim/axis/vismach/VMC_toolchange/toplevel.py @@ -1,3 +1,3 @@ -#! /usr/bin/python +#!/usr/bin/env python import remap diff --git a/configs/sim/axis/vismach/VMC_toolchange/vmcgui b/configs/sim/axis/vismach/VMC_toolchange/vmcgui index fd7567d265a..4a370bdf3d2 100755 --- a/configs/sim/axis/vismach/VMC_toolchange/vmcgui +++ b/configs/sim/axis/vismach/VMC_toolchange/vmcgui @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright 2009 Alex Joni # # This program is free software; you can redistribute it and/or modify diff --git a/docs/src/config/ini-config.txt b/docs/src/config/ini-config.txt index 9f8174d1ee1..91ec1b05865 100644 --- a/docs/src/config/ini-config.txt +++ b/docs/src/config/ini-config.txt @@ -401,7 +401,7 @@ This example program filters a file and adds a W axis to match the Z axis. It depends on there being a space between each axis word to work. ---- -#! /usr/bin/env python +#!/usr/bin/env python import sys diff --git a/docs/src/config/ini_config_fr.txt b/docs/src/config/ini_config_fr.txt index 27add669742..a985cdd5bb9 100644 --- a/docs/src/config/ini_config_fr.txt +++ b/docs/src/config/ini_config_fr.txt @@ -546,7 +546,7 @@ Cet exemple de programme filtre un fichier et ajoute un axe W correspondant à l'axe Z. Il marchera selon la présence d'un espace entre chaque mot d'axe. ---- -#! /usr/bin/env python +#!/usr/bin/env python import sys diff --git a/docs/src/gui/vismach.txt b/docs/src/gui/vismach.txt index 2218fb8c350..5dd6536a1e4 100644 --- a/docs/src/gui/vismach.txt +++ b/docs/src/gui/vismach.txt @@ -33,12 +33,12 @@ The basic sequence in creating the Vismach model is == Start the script -It is useful for testing to include the '#!/usr/bin/python' to allow the file +It is useful for testing to include the '#!/usr/bin/env python' to allow the file to be run as a script. The first thing to do is to import the required libraries. ---- -#!/usr/bin/python +#!/usr/bin/env python from vismach import * import hal diff --git a/docs/src/hal/halmodule.txt b/docs/src/hal/halmodule.txt index 33354bc0c90..aaed6a3b4c9 100644 --- a/docs/src/hal/halmodule.txt +++ b/docs/src/hal/halmodule.txt @@ -12,7 +12,7 @@ once per second. [source,c] ---- -#!/usr/bin/python +#!/usr/bin/env python import hal, time h = hal.component("passthrough") h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN) diff --git a/docs/src/hal/halmodule_fr.txt b/docs/src/hal/halmodule_fr.txt index 2b815930d46..74089384294 100644 --- a/docs/src/hal/halmodule_fr.txt +++ b/docs/src/hal/halmodule_fr.txt @@ -12,7 +12,7 @@ entrées. Le composant suivant, un passe-tout, copie la valeur vue sur ses pins d'entrée (_passe_tout.in_) vers ses pins de sortie (_passe_tout.out_) approximativement une fois par seconde. ---- -#!/usr/bin/python +#!/usr/bin/env python import hal, time h = hal.component("passe_tout") h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN) diff --git a/docs/src/mkpre.py b/docs/src/mkpre.py index fe4551dea03..98cacf33f0d 100644 --- a/docs/src/mkpre.py +++ b/docs/src/mkpre.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python """mkpre.py: Convert ASCII art into something that groff can render to text, HTML, or postscript/pdf diff --git a/lib/python/gladevcp/makepins.py b/lib/python/gladevcp/makepins.py index a0d9fd98d55..c6ddded8a73 100644 --- a/lib/python/gladevcp/makepins.py +++ b/lib/python/gladevcp/makepins.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- encoding: utf-8 -*- # GLADE_VCP # Copyright 2010 Chris Morley diff --git a/scripts/decode_dmesg b/scripts/decode_dmesg index 2ba29ec4167..67976c743bb 100755 --- a/scripts/decode_dmesg +++ b/scripts/decode_dmesg @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python """\ This script decodes hex floats (e.g., in dmesg) into real floats. In the future maybe it will do other emc2-specific dmesg decoding. diff --git a/scripts/linuxcnc_info b/scripts/linuxcnc_info index 9a44385e144..d6f1e9568d1 100755 --- a/scripts/linuxcnc_info +++ b/scripts/linuxcnc_info @@ -113,7 +113,7 @@ show " cpu MHz" $(parse_cpuinfo "cpu MHz") show " parport" $(cat /proc/ioports|grep parport) show " serial" $(cat /proc/ioports|grep serial) echo -echo "Varsions:" +echo "Versions:" show " gcc" $(gcc --version|head -1) show " python" $(python --version 2>&1) show " git" $(git --version) diff --git a/scripts/realtime.in b/scripts/realtime.in index dbeea919aad..792a1dff048 100644 --- a/scripts/realtime.in +++ b/scripts/realtime.in @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/bash # # @configure_input@ # on @DATE@ diff --git a/scripts/torture.py b/scripts/torture.py index 1a1c38b7433..3f654c79b28 100755 --- a/scripts/torture.py +++ b/scripts/torture.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (C) 2012 Jeff Epler # # This program is free software; you can redistribute it and/or modify diff --git a/src/configure.in b/src/configure.in index a0e6b763627..d882ac724fa 100644 --- a/src/configure.in +++ b/src/configure.in @@ -807,6 +807,8 @@ then AC_MSG_ERROR([awk not found]) fi +if test $RTS != "uspace" +then AC_PATH_PROG(INSMOD, insmod, "none", $SPATH) if test $INSMOD = "none" then @@ -824,8 +826,9 @@ if test $LSMOD = "none" then AC_MSG_ERROR([lsmod not found]) fi +fi -AC_PATH_PROG(PIDOF, pidof, "none", $SPATH) +AC_PATH_PROGS(PIDOF, pidof pgrep, "none", $SPATH) if test $PIDOF = "none" then AC_MSG_ERROR([pidof not found]) @@ -1180,7 +1183,6 @@ AC_MSG_RESULT($HAVE_OPTRESET) AC_SUBST([HAVE_OPTRESET]) - LIBS_hold=$LIBS LIBS= AC_SEARCH_LIBS(dlopen, [c dl], [ diff --git a/src/emc/usr_intf/axis/scripts/debuglevel.py b/src/emc/usr_intf/axis/scripts/debuglevel.py index 05f197a1189..875647fdb7c 100644 --- a/src/emc/usr_intf/axis/scripts/debuglevel.py +++ b/src/emc/usr_intf/axis/scripts/debuglevel.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import sys, os import gettext BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..")) diff --git a/src/emc/usr_intf/axis/scripts/image-to-gcode.py b/src/emc/usr_intf/axis/scripts/image-to-gcode.py index 9f7f8d089d1..568146b0be2 100644 --- a/src/emc/usr_intf/axis/scripts/image-to-gcode.py +++ b/src/emc/usr_intf/axis/scripts/image-to-gcode.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python ## image-to-gcode is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by the diff --git a/src/emc/usr_intf/axis/scripts/lintini.py b/src/emc/usr_intf/axis/scripts/lintini.py index 011a335d917..8917582c69c 100644 --- a/src/emc/usr_intf/axis/scripts/lintini.py +++ b/src/emc/usr_intf/axis/scripts/lintini.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -#!/usr/bin/python +#!/usr/bin/env python # This is a component of AXIS, a front-end for LinuxCNC # Copyright 2004, 2005, 2006 Jeff Epler and # Chris Radek diff --git a/src/emc/usr_intf/axis/scripts/teach-in.py b/src/emc/usr_intf/axis/scripts/teach-in.py index 2bb524bb8b8..e20435ff857 100755 --- a/src/emc/usr_intf/axis/scripts/teach-in.py +++ b/src/emc/usr_intf/axis/scripts/teach-in.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python """Usage: python teach.py nmlfile outputfile If outputfile is not specified, writes to standard output. diff --git a/src/emc/usr_intf/axis/scripts/tracking-test.py b/src/emc/usr_intf/axis/scripts/tracking-test.py index 4e66a69d604..c5560a3afae 100755 --- a/src/emc/usr_intf/axis/scripts/tracking-test.py +++ b/src/emc/usr_intf/axis/scripts/tracking-test.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright 2007 Ben Lipkowitz # You may distribute this software under the GNU GPL v2 or later # diff --git a/src/emc/usr_intf/gmoccapy/gmoccapy.py b/src/emc/usr_intf/gmoccapy/gmoccapy.py index d8acb2a737a..cf1e0835d81 100755 --- a/src/emc/usr_intf/gmoccapy/gmoccapy.py +++ b/src/emc/usr_intf/gmoccapy/gmoccapy.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding:UTF-8 -*- """ A try of a new GUI for LinuxCNC based on gladevcp and Python diff --git a/src/emc/usr_intf/gremlin/gremlin-run b/src/emc/usr_intf/gremlin/gremlin-run index aad2c2a7513..f42f4dd1e43 100755 --- a/src/emc/usr_intf/gremlin/gremlin-run +++ b/src/emc/usr_intf/gremlin/gremlin-run @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import sys import os diff --git a/src/emc/usr_intf/gremlin/gremlin.py b/src/emc/usr_intf/gremlin/gremlin.py index 99b661c7724..ffdf2ee9420 100755 --- a/src/emc/usr_intf/gremlin/gremlin.py +++ b/src/emc/usr_intf/gremlin/gremlin.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (C) 2009-2012 # Jeff Epler , # Pavel Shramov , diff --git a/src/emc/usr_intf/gscreen/gscreen.py b/src/emc/usr_intf/gscreen/gscreen.py index 9750d738300..52633a87ad3 100755 --- a/src/emc/usr_intf/gscreen/gscreen.py +++ b/src/emc/usr_intf/gscreen/gscreen.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Gscreen a GUI for linuxcnc cnc controller # Chris Morley copyright 2012 diff --git a/src/emc/usr_intf/pncconf/pncconf.py b/src/emc/usr_intf/pncconf/pncconf.py index a2ef648cbc3..59f6a1f7255 100755 --- a/src/emc/usr_intf/pncconf/pncconf.py +++ b/src/emc/usr_intf/pncconf/pncconf.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- encoding: utf-8 -*- # This is pncconf, a graphical configuration editor for LinuxCNC # Chris Morley copyright 2009 diff --git a/src/emc/usr_intf/pncconf/tests.py b/src/emc/usr_intf/pncconf/tests.py index 7b0e11c580b..905bbd50e6d 100644 --- a/src/emc/usr_intf/pncconf/tests.py +++ b/src/emc/usr_intf/pncconf/tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.4 +#!/usr/bin/env python2.4 # -*- encoding: utf-8 -*- # This is pncconf, a graphical configuration editor for LinuxCNC # Chris Morley copyright 2009 diff --git a/src/emc/usr_intf/pyui/master.py b/src/emc/usr_intf/pyui/master.py index 16f5f6f2be0..dc5d9848f3d 100755 --- a/src/emc/usr_intf/pyui/master.py +++ b/src/emc/usr_intf/pyui/master.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import hal,time,os,sys import traceback from configobj import ConfigObj diff --git a/src/emc/usr_intf/pyui/pyui.py b/src/emc/usr_intf/pyui/pyui.py index 8dba9214cef..e6d6194e878 100755 --- a/src/emc/usr_intf/pyui/pyui.py +++ b/src/emc/usr_intf/pyui/pyui.py @@ -1,3 +1,3 @@ -#!/usr/bin/python +#!/usr/bin/env python from pyui import master validate = master.keyboard.validate(master.keyboard()) diff --git a/src/hal/user_comps/hal_input.py b/src/hal/user_comps/hal_input.py index 6515782103c..9294cb39f6c 100644 --- a/src/hal/user_comps/hal_input.py +++ b/src/hal/user_comps/hal_input.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright 2007 Jeff Epler # # This program is free software; you can redistribute it and/or modify diff --git a/src/hal/user_comps/vismach/5axisgui.py b/src/hal/user_comps/vismach/5axisgui.py index 0973cbcc66e..29061f27ffc 100755 --- a/src/hal/user_comps/vismach/5axisgui.py +++ b/src/hal/user_comps/vismach/5axisgui.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright 2007 Chris Radek # Derived from a work by John Kasunich and Jeff Epler # diff --git a/src/hal/user_comps/vismach/hbmgui.py b/src/hal/user_comps/vismach/hbmgui.py index eba42acf010..cb251fd8a4b 100755 --- a/src/hal/user_comps/vismach/hbmgui.py +++ b/src/hal/user_comps/vismach/hbmgui.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # Visulization model of a Horizontal Boring Mill with quill # diff --git a/src/hal/user_comps/vismach/hexagui.py b/src/hal/user_comps/vismach/hexagui.py index 7a33f6a326b..414f70ca3bd 100755 --- a/src/hal/user_comps/vismach/hexagui.py +++ b/src/hal/user_comps/vismach/hexagui.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright 2007 Ben Lipkowitz # You may distribute this software under the GNU GPL v2 or later # diff --git a/src/hal/user_comps/vismach/maho600gui.py b/src/hal/user_comps/vismach/maho600gui.py index 96aaa3507e2..779fe9f95f7 100755 --- a/src/hal/user_comps/vismach/maho600gui.py +++ b/src/hal/user_comps/vismach/maho600gui.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # Visulization model of U of Akron's Maho 600C with 2-axis NC table # diff --git a/src/hal/user_comps/vismach/max5gui.py b/src/hal/user_comps/vismach/max5gui.py index f68a1d981df..b8f80e5837c 100755 --- a/src/hal/user_comps/vismach/max5gui.py +++ b/src/hal/user_comps/vismach/max5gui.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # Visulization model of Chris's MAX-NC mill, as modified to 5-axis # diff --git a/src/hal/user_comps/vismach/puma560gui.py b/src/hal/user_comps/vismach/puma560gui.py index 4930744addd..8808414ea1e 100755 --- a/src/hal/user_comps/vismach/puma560gui.py +++ b/src/hal/user_comps/vismach/puma560gui.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright 2009 Alex Joni # # This program is free software; you can redistribute it and/or modify diff --git a/src/hal/user_comps/vismach/pumagui.py b/src/hal/user_comps/vismach/pumagui.py index f6ea0874e63..23399a45a64 100755 --- a/src/hal/user_comps/vismach/pumagui.py +++ b/src/hal/user_comps/vismach/pumagui.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright 2007 John Kasunich and Jeff Epler # # This program is free software; you can redistribute it and/or modify diff --git a/src/hal/user_comps/vismach/scaragui.py b/src/hal/user_comps/vismach/scaragui.py index d26b526d878..f03ac43a1d2 100755 --- a/src/hal/user_comps/vismach/scaragui.py +++ b/src/hal/user_comps/vismach/scaragui.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright 2007 John Kasunich and Jeff Epler # # This program is free software; you can redistribute it and/or modify diff --git a/src/hal/utils/elbpcom.py b/src/hal/utils/elbpcom.py index 6c96226c255..c3800496fcb 100644 --- a/src/hal/utils/elbpcom.py +++ b/src/hal/utils/elbpcom.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2012-2015 # Peter C. Wallace and Jeff Epler diff --git a/src/hal/utils/halcompile.g b/src/hal/utils/halcompile.g index ca59af30123..de788adc16d 100644 --- a/src/hal/utils/halcompile.g +++ b/src/hal/utils/halcompile.g @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # This is 'halcompile', a tool to write HAL boilerplate # Copyright 2006 Jeff Epler # diff --git a/src/hal/utils/yapps.py b/src/hal/utils/yapps.py index c501ce3f730..de512ae7c6a 100755 --- a/src/hal/utils/yapps.py +++ b/src/hal/utils/yapps.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # Yapps 2 - yet another python parser system diff --git a/src/modsilent.py b/src/modsilent.py index 854ec1891cd..6d7c19a6d77 100644 --- a/src/modsilent.py +++ b/src/modsilent.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import re import sys diff --git a/src/rtapi/rtapi_uspace.hh b/src/rtapi/rtapi_uspace.hh index 3521238eac0..726ce7527ae 100644 --- a/src/rtapi/rtapi_uspace.hh +++ b/src/rtapi/rtapi_uspace.hh @@ -17,14 +17,21 @@ */ #ifndef RTAPI_USPACE_HH #define RTAPI_USPACE_HH +#ifdef __linux__ #include +#endif #include #include struct WithRoot { +#ifdef __linux__ WithRoot() { if(!level) setfsuid(geteuid()); level++; } ~WithRoot() { --level; if(!level) setfsuid(getuid()); } +#else + WithRoot() { if(!level) level++; } + ~WithRoot() { --level; if(!level) seteuid(getuid()); } +#endif static int level; }; diff --git a/src/rtapi/uspace_rtapi_app.cc b/src/rtapi/uspace_rtapi_app.cc index fe33c486df4..84cd348fe22 100644 --- a/src/rtapi/uspace_rtapi_app.cc +++ b/src/rtapi/uspace_rtapi_app.cc @@ -17,7 +17,9 @@ #include "config.h" +#ifdef __linux__ #include +#endif #include #include #include @@ -462,7 +464,11 @@ int main(int argc, char **argv) { "Running with fallback_uid. getuid()=%d geteuid()=%d\n", getuid(), geteuid()); } +#ifdef __linux__ setfsuid(getuid()); +#else + seteuid(getuid()); +#endif vector args; for(int i=1; i