Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass $PASS before sudo #101

Merged
merged 2 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions jsk_unitree_robot/cross/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
42 changes: 42 additions & 0 deletions jsk_unitree_robot/cross/startup_scripts/usercustomize.py
Original file line number Diff line number Diff line change
@@ -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())
Loading