rt-net / RaspberryPiMouse

Raspberry Pi Mouse Device Driver
Other
60 stars 455 forks source link

Add exception handling to build script #17

Closed Tiryoh closed 5 years ago

Tiryoh commented 5 years ago

This PR has two new features.

An exception handling to ./build_install.*.bash

pi@raspberrypi:~/RaspberryPiMouse
$ ./utils/build_install.ubuntu14.bash
#!/bin/bash -vxe

dir=$(dirname $0)/../
++ dirname ./utils/build_install.ubuntu14.bash
+ dir=./utils/../

[ ! -e /usr/src/linux-headers-$(uname -r) ] && { bash -e $dir/utils/print_env.bash "No kernel header files found."; exit 1; }
++ uname -r
+ '[' '!' -e /usr/src/linux-headers-4.14.98-v7+ ']'
+ bash -e ./utils/..//utils/print_env.bash 'No kernel header files found.'
===================
ERROR: No kernel header files found.
If you need someone's support, you should share this information.
Linux raspberrypi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.8 (stretch)
Release:    9.8
Codename:   stretch
ls: cannot access '/usr/src/linux*': No such file or directory
===================
+ exit 1

An automatic environment identification script build_install.bash This script automatically determines whether to execute build_install.ubuntu14.bash or build_install.raspbian.bash. If there are no kernel header files, the following error will be shown:

pi@raspberrypi:~/RaspberryPiMouse/utils
$ ./build_install.bash
===================
ERROR: No kernel header files found.
If you need someone's support, you should share this information.
Linux raspberrypi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.8 (stretch)
Release:    9.8
Codename:   stretch
ls: cannot access '/usr/src/linux*': No such file or directory
===================