aboutsummaryrefslogtreecommitdiff
path: root/jetson/4-config-system.sh
blob: 99c92f2cb63248de09c0a0c5fcd66f4bc977a6b4 (plain)
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
70
71
72
73
74
75
#!/bin/bash

set -e

if [ x`whoami` != x"root" ]; then
    echo "ERROR: Need to run $0 as root"
    exit 1
fi

board="auto"
distro="auto"

OPTS="`getopt -o v -l board:,distro: -- "$@"`"
while test $# -gt 0; do
    case $1 in
	--board) board="$2"; shift ;;
	--distro) distro="$2"; shift ;;
	-v) set -x ;;
    esac
    shift
done

if [ x"$board" = x"auto" ]; then
    case "$(uname -m)" in
	"armv7l") board="tk1" ;;
	"aarch64") board="tx1" ;;
	*)
	    echo "ERROR: Cannot autodetect board from uname $(uname -m)"
	    exit 1
	    ;;
    esac
fi

if [ x"$distro" = x"auto" ]; then
    case "$(lsb_release -r)" in
	*"16.04") distro="xenial" ;;
	*"14.04") distro="trusty" ;;
	*)
	    echo "ERROR: Cannot autodetect distro from lsb_release $(lsb_release -r)"
	    exit 1
	    ;;
    esac
fi

# apt-get command that tasksel uses
tasksel_apt_get="apt-get -q -y -o APT::Install-Recommends=true -o APT::Get::AutomaticRemove=true -o APT::Acquire::Retries=3"

echo "ABOUT TO CONFIGURE THE BOARD"

apt-get update

echo "REMOVING UNNECESSARY PACKAGES"

hold_packages="ifupdown netbase"
install_packages="$install_packages git vim"

apt-get install -y $hold_packages

$tasksel_apt_get remove ubuntu-desktop^
apt-get autoremove -y

echo "RE-INSTALLING OPENSSH SERVER"
apt-get purge -y openssh-server
$tasksel_apt_get install openssh-server^

echo "UPGRADING THE PACKAGES"
apt-get upgrade -y

echo "DIST-UPGRADING THE PACKAGES"
apt-get dist-upgrade -y

echo "INSTALLING ADDITIONAL PACKAGES"
apt-get install -y $install_packages

echo "ALL DONE"