-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux_setup_flir
executable file
·69 lines (64 loc) · 2.26 KB
/
linux_setup_flir
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash -e
echo ""
echo -e "\e[32mStarting spinnaker_camera_driver setup script\e[0m"
echo ""
while true; do
read -p "Add the flirimaging group? (y/n)? " yn
case $yn in
[yY] )
if [ $(getent group flirimaging) ];
then
echo "flirimaging group already exists";
else
echo "Adding flirimaging group";
sudo addgroup flirimaging;
fi
if id -nGz "$USER" | grep -qzxF "flirimaging";
then
echo "User:${USER} is already in flirimaging group";
else
echo "Adding user:${USER} to flirimaging group";
sudo usermod -a -G flirimaging ${USER};
fi
break;;
[nN] )
break;;
*)
echo "invalid response";;
esac
done
while true; do
read -p "Increase the usbfs memory limits in the default grub configuration (y/n)? " yn
case $yn in
[yY] )
val=$(< /sys/module/usbcore/parameters/usbfs_memory_mb)
if [ "$val" -lt "1000" ]; then
if [ -e /etc/default/grub ]; then
if [ $(grep -c "usbcore.usbfs_memory_mb=" /etc/default/grub) -eq 0 ]; then # Memory Limit has not already been set
sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*/& usbcore.usbfs_memory_mb=1000/' /etc/default/grub
echo "Increased the usbfs memory limits in the default grub configuration. Updating grub"
sudo update-grub
else
echo -e "\e[33mWarn: usbfs memory limit is already set in /etc/default/grub in the following line:\e[0m"
echo "$(grep "usbcore.usbfs_memory_mb" /etc/default/grub)"
echo -e "\e[33mNo changes made, verify that usbfs_memory_mb is set to a minimum of 1000 and then try rebooting the computer\e[0m"
fi
else
echo -e "\e[33mWarn: /etc/default/grub configuration file not found, no changes made. usbfs_memory_mb must be set manually.\e[0m"
echo -e "\e[33mSee https://github.com/ros-drivers/flir_camera_driver/blob/humble-devel/spinnaker_camera_driver/docs/linux_setup_flir.md for instructions\e[0m"
exit 0
fi
else
echo "usbfs_memory_mb is already set to $val, no changes necessary."
fi
break;;
[nN] )
break;;
*)
echo "invalid response";;
esac
done
echo ""
echo -e "\e[32mDone: spinnaker_camera_driver setup script\e[0m"
echo "Please reboot the device to ensure changes have taken full effect"
echo ""