Difference between revisions of "Ubuntu 20 04 modifications"
From RobotinoWiki
(→cleandist) |
(→gcc) |
||
Line 111: | Line 111: | ||
EOF | EOF | ||
chmod +x /root/cleandist.sh | chmod +x /root/cleandist.sh | ||
+ | </pre> | ||
+ | |||
+ | ==automirror== | ||
+ | <pre> | ||
+ | #!/bin/bash | ||
+ | set -e -E -u | ||
+ | |||
+ | XRANDR_STATUS_PROGRAM=${XRANDR_STATUS_PROGRAM:-xrandr} | ||
+ | XRANDR_SET_PROGRAM=${XRANDR_SET_PROGRAM:-xrandr} | ||
+ | |||
+ | PRIMARY_DISPLAY=${AUTOMIRROR_PRIMARY_DISPLAY:-LVDS1} | ||
+ | NOTIFY_SEND=( ${AUTOMIRROR_NOTIFY_COMMAND:-notify-send -a automirror -i automirror "Automatic Mirror Configuration"} ) | ||
+ | |||
+ | # force called programs to english output | ||
+ | LANG=C LC_ALL=C | ||
+ | |||
+ | function die { | ||
+ | echo 1>&2 "$*" | ||
+ | exit 10 | ||
+ | } | ||
+ | |||
+ | function get_display_resolution { | ||
+ | local find_display="$1" ; shift | ||
+ | local display_list="$1" | ||
+ | while read display width_mm height_mm width height ; do | ||
+ | if [[ "$display" == "$find_display" ]] ; then | ||
+ | echo ${width}x${height} | ||
+ | return 0 | ||
+ | fi | ||
+ | done <<<"$display_list" | ||
+ | die "Could not determine resolution for '$find_display'. Display Data: | ||
+ | $display_list" | ||
+ | } | ||
+ | |||
+ | function get_highest_display { | ||
+ | local display_list="$1" ; shift | ||
+ | local data=( $(sort -r -n -k 5 <<<"$display_list") ) | ||
+ | echo $data | ||
+ | } | ||
+ | |||
+ | xrandr_current="$($XRANDR_STATUS_PROGRAM)" | ||
+ | |||
+ | # find connected displays by filtering those that are connected and have a size set in millimeters (mm) | ||
+ | connected_displays=( $(sed -n -e 's/^\(.*\) connected.*mm$/\1/p' <<<"$xrandr_current") ) | ||
+ | |||
+ | # See http://stackoverflow.com/a/1252191/2042547 for how to use sed to replace newlines | ||
+ | # display_list is a list of displays with their maximum/optimum pixel and physical dimensions | ||
+ | # thanks to the first sed I know that here is only a SINGLE space | ||
+ | display_list="$(sed ':a;N;$!ba;s/\n / /g'<<<"$xrandr_current" | sed -n -e 's/^\([a-zA-Z0-9_-]\+\) connected.* \([0-9]\+\)mm.* \([0-9]\+\)mm \([0-9]\+\)x\([0-9]\+\).*$/\1 \2 \3 \4 \5/p' )" | ||
+ | : connected_displays: ${connected_displays[@]} | ||
+ | : display_list: "$display_list" | ||
+ | |||
+ | if [[ -z "$display_list" ]] ; then | ||
+ | die "Could not find any displays connected. XRANDR output: $xrandr_current" | ||
+ | fi | ||
+ | |||
+ | # if the primary display is NOT connected then use the highest display as primary | ||
+ | if [[ "${connected_displays[*]}" != *$PRIMARY_DISPLAY* ]] ; then | ||
+ | PRIMARY_DISPLAY=$(get_highest_display "$display_list") | ||
+ | fi | ||
+ | frame_buffer_resolution=$(get_display_resolution $PRIMARY_DISPLAY "$display_list") | ||
+ | |||
+ | : $frame_buffer_resolution | ||
+ | |||
+ | xrandr_set_args=( --fb $frame_buffer_resolution ) | ||
+ | notify_string="" | ||
+ | if (( ${#connected_displays[@]} == 1 )) ; then | ||
+ | xrandr_set_args+=( --output $connected_displays --mode $frame_buffer_resolution --scale 1x1 ) | ||
+ | notify_string="$connected_displays reset to $frame_buffer_resolution" | ||
+ | else | ||
+ | other_display_list="$(grep -v ^$PRIMARY_DISPLAY <<<"$display_list")" | ||
+ | $XRANDR_SET_PROGRAM $(while read display junk ; do echo " --output $display --scale 1x1 --off" ; done <<<"$other_display_list") | ||
+ | xrandr_set_args+=( --output $PRIMARY_DISPLAY --mode $frame_buffer_resolution --scale 1x1 ) | ||
+ | notify_string="$PRIMARY_DISPLAY is primary at $frame_buffer_resolution" | ||
+ | while read display junk ; do | ||
+ | mode="$(get_display_resolution $display "$other_display_list")" | ||
+ | xrandr_set_args+=( --output $display --same-as $PRIMARY_DISPLAY --mode "$mode" --scale-from $frame_buffer_resolution ) | ||
+ | notify_string="$notify_string\n$display is scaled mirror at $mode" | ||
+ | done <<<"$other_display_list" | ||
+ | fi | ||
+ | |||
+ | #logger -s -t "$0" -- Running $XRANDR_SET_PROGRAM "${xrandr_set_args[@]}" | ||
+ | |||
+ | $XRANDR_SET_PROGRAM "${xrandr_set_args[@]}" | ||
+ | ret=$? | ||
+ | "${NOTIFY_SEND[@]}" "$notify_string" | ||
+ | exit $ret | ||
</pre> | </pre> | ||
Revision as of 11:52, 15 September 2020
Minimum Ubuntu Desktop install
sudo su passwd dorp6 apt install openssh-server vim net-tools vim /etc/ssh/sshd_config PermitRootLogin yes systemctl restart ssh vim /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=0 biosdevname=0 i8042.noaux=1" GRUB_CMDLINE_LINUX_DEFAULT="noresume" update-grub
cat << EOF > /root/remove_old_kernels.sh #!/bin/bash dpkg -l 'linux-[ihs]*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\([-0-9]*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | tee zu_entfernende_Kernel cat zu_entfernende_Kernel | xargs sudo apt-get -y purge rm zu_entfernende_Kernel EOF chmod +x /root/remove_old_kernels.sh
e2fsck -f /dev/sda1 tune2fs -U f6fec0c6-bc88-46d3-b125-e450709f1956 /dev/sda1 replace UUID by f6fec0c6-bc88-46d3-b125-e450709f1956 in /boot/grub/grub.cfg echo "RESUME=none" > /etc/initramfs-tools/conf.d/resume wget -qO - http://packages.openrobotino.org/keyFile | sudo apt-key add - echo "deb http://packages2.openrobotino.org focal main" > /etc/apt/sources.list.d/openrobotino.list apt install vino **** run this as user robotino !!! gsettings set org.gnome.Vino require-encryption false apt install qdirstat gdebi add-apt-repository ppa:open62541-team/ppa apt install libopen62541-1-dev sed -i -e 's/enabled=1/enabled=0/g' /etc/default/apport apt-get remove unattended-upgrades apt-get remove update-notifier
Contents
cleandist
cat << EOF > /root/cleandist.sh #!/bin/bash sed -i "/^lasertype=/c\lasertype=realsense" /etc/robotino/smartsoft_slave.conf sed -i "/^RobotinoIP=/c\RobotinoIP=192.168.0.1" /etc/robotino/smartsoft_slave.conf rm -Rf /var/log/* apt-get clean rm -Rf /home/robotino/.cache rm /root/*.deb history -c rm /home/robotino/.bash_history rm /root/.ssh/authorized_keys rm -Rf /opt/smartsoft/data_master/maps rm -Rf /opt/smartsoft/data/maps rm -f /etc/NetworkManager/system-connections/* cat << EOF2 > /etc/NetworkManager/system-connections/eth0 [connection] id=eth0 uuid=03d1fb6f-efcf-3f57-85e1-85b9cdb9ab9d type=ethernet autoconnect-priority=-999 interface-name=eth0 permissions= secondaries= timestamp=1547803650 [ethernet] duplex=full mac-address= mac-address-blacklist= [ipv6] addr-gen-mode=stable-privacy dns-search= ip6-privacy=0 method=auto [ipv4] method=auto address1= dns= address2=192.168.0.1/24,0.0.0.0 dns-search= EOF2 EOF chmod +x /root/cleandist.sh
automirror
#!/bin/bash set -e -E -u XRANDR_STATUS_PROGRAM=${XRANDR_STATUS_PROGRAM:-xrandr} XRANDR_SET_PROGRAM=${XRANDR_SET_PROGRAM:-xrandr} PRIMARY_DISPLAY=${AUTOMIRROR_PRIMARY_DISPLAY:-LVDS1} NOTIFY_SEND=( ${AUTOMIRROR_NOTIFY_COMMAND:-notify-send -a automirror -i automirror "Automatic Mirror Configuration"} ) # force called programs to english output LANG=C LC_ALL=C function die { echo 1>&2 "$*" exit 10 } function get_display_resolution { local find_display="$1" ; shift local display_list="$1" while read display width_mm height_mm width height ; do if [[ "$display" == "$find_display" ]] ; then echo ${width}x${height} return 0 fi done <<<"$display_list" die "Could not determine resolution for '$find_display'. Display Data: $display_list" } function get_highest_display { local display_list="$1" ; shift local data=( $(sort -r -n -k 5 <<<"$display_list") ) echo $data } xrandr_current="$($XRANDR_STATUS_PROGRAM)" # find connected displays by filtering those that are connected and have a size set in millimeters (mm) connected_displays=( $(sed -n -e 's/^\(.*\) connected.*mm$/\1/p' <<<"$xrandr_current") ) # See http://stackoverflow.com/a/1252191/2042547 for how to use sed to replace newlines # display_list is a list of displays with their maximum/optimum pixel and physical dimensions # thanks to the first sed I know that here is only a SINGLE space display_list="$(sed ':a;N;$!ba;s/\n / /g'<<<"$xrandr_current" | sed -n -e 's/^\([a-zA-Z0-9_-]\+\) connected.* \([0-9]\+\)mm.* \([0-9]\+\)mm \([0-9]\+\)x\([0-9]\+\).*$/\1 \2 \3 \4 \5/p' )" : connected_displays: ${connected_displays[@]} : display_list: "$display_list" if [[ -z "$display_list" ]] ; then die "Could not find any displays connected. XRANDR output: $xrandr_current" fi # if the primary display is NOT connected then use the highest display as primary if [[ "${connected_displays[*]}" != *$PRIMARY_DISPLAY* ]] ; then PRIMARY_DISPLAY=$(get_highest_display "$display_list") fi frame_buffer_resolution=$(get_display_resolution $PRIMARY_DISPLAY "$display_list") : $frame_buffer_resolution xrandr_set_args=( --fb $frame_buffer_resolution ) notify_string="" if (( ${#connected_displays[@]} == 1 )) ; then xrandr_set_args+=( --output $connected_displays --mode $frame_buffer_resolution --scale 1x1 ) notify_string="$connected_displays reset to $frame_buffer_resolution" else other_display_list="$(grep -v ^$PRIMARY_DISPLAY <<<"$display_list")" $XRANDR_SET_PROGRAM $(while read display junk ; do echo " --output $display --scale 1x1 --off" ; done <<<"$other_display_list") xrandr_set_args+=( --output $PRIMARY_DISPLAY --mode $frame_buffer_resolution --scale 1x1 ) notify_string="$PRIMARY_DISPLAY is primary at $frame_buffer_resolution" while read display junk ; do mode="$(get_display_resolution $display "$other_display_list")" xrandr_set_args+=( --output $display --same-as $PRIMARY_DISPLAY --mode "$mode" --scale-from $frame_buffer_resolution ) notify_string="$notify_string\n$display is scaled mirror at $mode" done <<<"$other_display_list" fi #logger -s -t "$0" -- Running $XRANDR_SET_PROGRAM "${xrandr_set_args[@]}" $XRANDR_SET_PROGRAM "${xrandr_set_args[@]}" ret=$? "${NOTIFY_SEND[@]}" "$notify_string" exit $ret
gcc
Wenn kein gcc installiert ist
apt install gcc-7 g++-7
Wenn gcc-9 installiert ist:
update-alternatives --remove-all gcc update-alternatives --remove-all g++ apt install gcc-7 g++-7 gcc-9 g++-9 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 20 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 10 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 20 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 sudo update-alternatives --set cc /usr/bin/gcc sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 sudo update-alternatives --set c++ /usr/bin/g++
update-alternatives --config gcc update-alternatives --config g++
Realsense
sudo apt-key adv --keyserver keys.gnupg.net --recv-key C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C8B3A55A6F3EFCDE sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main" -u apt install librealsense2==2.38.1-0~realsense0.3378 apt-mark hold librealsense2 optinal sudo apt-get install librealsense2-dbg