diff --git a/jsk_unitree_robot/cross/install.sh b/jsk_unitree_robot/cross/install.sh index a1f852dc03..4ef698f5af 100755 --- a/jsk_unitree_robot/cross/install.sh +++ b/jsk_unitree_robot/cross/install.sh @@ -116,15 +116,15 @@ function copy_data () { # update udev # respeaker_ros - sshpass -p $PASS ssh -t ${user}@${hostname} "source /opt/jsk/User/user_setup.bash; sudo cp -f \$(rospack find respeaker_ros)/config/60-respeaker.rules /etc/udev/rules.d/60-respeaker.rules" + sshpass -p $PASS ssh -t ${user}@${hostname} "source /opt/jsk/User/user_setup.bash; echo $PASS | sudo cp -f \$(rospack find respeaker_ros)/config/60-respeaker.rules /etc/udev/rules.d/60-respeaker.rules" # - sshpass -p $PASS ssh -t ${user}@${hostname} "ls -al /etc/udev/rules.d/; sudo systemctl restart udev" + sshpass -p $PASS ssh -t ${user}@${hostname} "ls -al /etc/udev/rules.d/; echo $PASS | sudo systemctl restart udev" fi # enable Internet with USB LTE module if [[ "${hostname}" == "192.168.123.161" ]]; then - sshpass -p $PASS ssh -t ${user}@${hostname} "export PATH=\$PATH:/sbin; source /opt/jsk/User/user_setup.bash; sudo cp -f \$(rospack find jsk_unitree_startup)/config/dhcpcd.conf /etc/dhcpcd.conf" - sshpass -p $PASS ssh -t ${user}@${hostname} "sudo systemctl restart dhcpcd" + sshpass -p $PASS ssh -t ${user}@${hostname} "export PATH=\$PATH:/sbin; source /opt/jsk/User/user_setup.bash; echo $PASS | sudo cp -f \$(rospack find jsk_unitree_startup)/config/dhcpcd.conf /etc/dhcpcd.conf" + sshpass -p $PASS ssh -t ${user}@${hostname} "echo $PASS | sudo systemctl restart dhcpcd" fi set +x } diff --git a/jsk_unitree_robot/cross/startup_scripts/usercustomize.py b/jsk_unitree_robot/cross/startup_scripts/usercustomize.py new file mode 100644 index 0000000000..b292e21a43 --- /dev/null +++ b/jsk_unitree_robot/cross/startup_scripts/usercustomize.py @@ -0,0 +1,42 @@ +import site +import sys +import os +import os.path as osp + +site.PREFIXES += [ + '/opt/jsk/System/Python/', + '/opt/jsk/System/ros1_dependencies/' +] + +# https://www.programcreek.com/python/?code=Pylons%2Fhupper%2Fhupper-master%2Fsrc%2Fhupper%2Fcompat.py +def get_site_packages(): + try: + paths = [] + for path in site.getsitepackages(): + if osp.exists(path): + paths.append(path) + site_package = osp.join(osp.dirname(path), 'site-packages') + if site_package != path and osp.exists(site_package): + paths.append(site_package) + + return paths + + # virtualenv does not ship with a getsitepackages impl so we fallback + # to using distutils if we can + # https://github.com/pypa/virtualenv/issues/355 + except Exception: + try: + paths = [] + for base_path in site.PREFIXES: + for python_path in ['lib/python{}'.format(sys.version_info[0]), + 'lib/python{}.{}'.format(sys.version_info[0], sys.version_info[1])]: + site_package = osp.join(base_path, python_path, 'site-packages') + if osp.exists(site_package): + paths.append(site_package) + return paths + + # just incase, don't fail here, it's not worth it + except Exception as e: + return [] + +sys.path.extend(get_site_packages())