Skip to content

Commit 866cbb0

Browse files
committed
latest installation scripts
1 parent c9bee8c commit 866cbb0

File tree

3 files changed

+79
-38
lines changed

3 files changed

+79
-38
lines changed

scripts/.bashrc

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
# for examples
44

55
# If not running interactively, don't do anything
6-
[ -z "$PS1" ] && return
6+
case $- in
7+
*i*) ;;
8+
*) return;;
9+
esac
710

811
# don't put duplicate lines or lines starting with space in the history.
912
# See bash(1) for more options
@@ -28,13 +31,13 @@ shopt -s checkwinsize
2831
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
2932

3033
# set variable identifying the chroot you work in (used in the prompt below)
31-
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
34+
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
3235
debian_chroot=$(cat /etc/debian_chroot)
3336
fi
3437

3538
# set a fancy prompt (non-color, unless we know we "want" color)
3639
case "$TERM" in
37-
xterm-color) color_prompt=yes;;
40+
xterm-color|*-256color) color_prompt=yes;;
3841
esac
3942

4043
# uncomment for a colored prompt, if the terminal has the capability; turned
@@ -44,17 +47,17 @@ force_color_prompt=yes
4447

4548
if [ -n "$force_color_prompt" ]; then
4649
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
47-
# We have color support; assume it's compliant with Ecma-48
48-
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
49-
# a case would tend to support setf rather than setaf.)
50-
color_prompt=yes
50+
# We have color support; assume it's compliant with Ecma-48
51+
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
52+
# a case would tend to support setf rather than setaf.)
53+
color_prompt=yes
5154
else
52-
color_prompt=
55+
color_prompt=
5356
fi
5457
fi
5558

5659
if [ "$color_prompt" = yes ]; then
57-
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] '
60+
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] '
5861
else
5962
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
6063
fi
@@ -81,6 +84,9 @@ if [ -x /usr/bin/dircolors ]; then
8184
alias egrep='egrep --color=auto'
8285
fi
8386

87+
# colored GCC warnings and errors
88+
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
89+
8490
# some more ls aliases
8591
#alias ll='ls -l'
8692
#alias la='ls -A'
@@ -98,6 +104,10 @@ fi
98104
# enable programmable completion features (you don't need to enable
99105
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
100106
# sources /etc/bash.bashrc).
101-
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
107+
if ! shopt -oq posix; then
108+
if [ -f /usr/share/bash-completion/bash_completion ]; then
109+
. /usr/share/bash-completion/bash_completion
110+
elif [ -f /etc/bash_completion ]; then
102111
. /etc/bash_completion
112+
fi
103113
fi

scripts/.profile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ~/.profile: executed by the command interpreter for login shells.
2+
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
3+
# exists.
4+
# see /usr/share/doc/bash/examples/startup-files for examples.
5+
# the files are located in the bash-doc package.
6+
7+
# the default umask is set in /etc/profile; for setting the umask
8+
# for ssh logins, install and configure the libpam-umask package.
9+
#umask 022
10+
11+
# if running bash
12+
if [ -n "$BASH_VERSION" ]; then
13+
# include .bashrc if it exists
14+
if [ -f "$HOME/.bashrc" ]; then
15+
. "$HOME/.bashrc"
16+
fi
17+
fi
18+
19+
# set PATH so it includes user's private bin if it exists
20+
if [ -d "$HOME/bin" ] ; then
21+
PATH="$HOME/bin:$PATH"
22+
fi

scripts/install.sh

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -51,43 +51,52 @@ set -e
5151
WEBIDE_ROOT="/usr/share/adafruit/webide"
5252

5353
#needed for SSH key and config access at this point.
54-
# WEBIDE_HOME="/home/webide"
54+
WEBIDE_HOME="/home/webide"
5555

5656
mkdir -p "$WEBIDE_ROOT"
57-
# mkdir -p "$WEBIDE_HOME"
58-
# cd "$WEBIDE_ROOT"
57+
mkdir -p "$WEBIDE_HOME/tmp"
58+
cd "$WEBIDE_ROOT"
5959

6060
echo "**** Downloading the latest version of the WebIDE ****"
6161
curl -L https://adafruit-download.s3.amazonaws.com/webide-0.3.12.tar.gz | tar xzf -
6262

6363
echo "**** Installing required libraries ****"
6464
echo "**** (redis-server git restartd libcap2-bin avahi-daemon i2c-tools python-smbus) ****"
6565
apt-get update
66-
apt-get install nodejs-legacy git libcap2-bin i2c-tools python-smbus ntp -y
67-
68-
# echo "**** Create webide user and group ****"
69-
# groupadd webide || true
70-
# useradd -g webide webide || true
71-
# usermod -a -G i2c,sudo webide || true
72-
#
73-
# echo "**** Adding webide user to sudoers ****"
74-
# if [ -f "/etc/sudoers.tmp" ]; then
75-
# rm /etc/sudoers.tmp
76-
# fi
77-
# cp /etc/sudoers /etc/sudoers.tmp
78-
# echo "webide ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.tmp
79-
# visudo -c -f /etc/sudoers.tmp
80-
# if [ "$?" -eq "0" ]; then
81-
# cp /etc/sudoers.tmp /etc/sudoers
82-
# fi
83-
# rm /etc/sudoers.tmp
84-
#
85-
# chown -R webide:webide "$WEBIDE_HOME"
86-
# chown -R webide:webide "$WEBIDE_ROOT"
87-
# chmod 775 "$WEBIDE_ROOT"
88-
#
89-
# echo "**** Adding default .bashrc file for webide user ****"
90-
# cp "$WEBIDE_ROOT/scripts/.bashrc" "$WEBIDE_HOME"
66+
apt-get install nodejs-legacy npm git libcap2-bin i2c-tools python-smbus ntp libkrb5-dev -y
67+
68+
echo "**** Create webide user and group ****"
69+
groupadd webide || true
70+
useradd -g webide webide || true
71+
usermod -a -G i2c,sudo webide || true
72+
chsh -s /bin/bash webide
73+
74+
echo "**** Adding webide user to sudoers ****"
75+
if [ -f "/etc/sudoers.tmp" ]; then
76+
rm /etc/sudoers.tmp
77+
fi
78+
cp /etc/sudoers /etc/sudoers.tmp
79+
echo "webide ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.tmp
80+
visudo -c -f /etc/sudoers.tmp
81+
if [ "$?" -eq "0" ]; then
82+
cp /etc/sudoers.tmp /etc/sudoers
83+
fi
84+
rm /etc/sudoers.tmp
85+
86+
echo "**** Installing webide dependencies ****"
87+
npm config set tmp "$WEBIDE_HOME/tmp"
88+
npm install
89+
90+
chown -R webide:webide "$WEBIDE_HOME"
91+
chown -R webide:webide "$WEBIDE_ROOT"
92+
chmod 775 "$WEBIDE_ROOT"
93+
94+
echo "**** Adding default .bashrc file for webide user ****"
95+
cp "$WEBIDE_ROOT/scripts/.bashrc" "$WEBIDE_HOME"
96+
97+
echo "**** Installing webide dependencies ****"
98+
npm install -g npm
99+
npm install
91100

92101
echo "Attempting to force reload date and time from ntp server"
93102
/etc/init.d/ntp force-reload

0 commit comments

Comments
 (0)