Commit 15e8b35b authored by Ivo Kluvanec's avatar Ivo Kluvanec
Browse files

First usable Version

parent 8b06d8f1
#!/bin/bash
# SmartLabs start routine
slbase=/opt/smartlabs
if [ -d $slbase ]; then
if [ ! -d $slbase/logs ]; then
mkdir $slbase/logs
fi
sllogbase=$slbase/logs/smartlabs_$(date +"%Y%m%d")
echo "** Starting rc.local `date` **" >> $sllogbase.log
if [ -f $slbase/bin/slupdate.sh ]; then
sudo $slbase/bin/slupdate.sh >> $sllogbase.log 2>>$sllogbase.err
else
echo "** `date`" >> $sllogbase.err
echo "**** Could not find slupdate.sh" >> $sllogbase.err
fi
fi
exit 0
#! /bin/sh
#!/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
smartlabs_path=/opt/smartlabs/update
echo == "Starting slupdate `date`"
start_path=`pwd`
remove_path=remove_$(date +"%Y%m%d%H%M")
if [ -d "$smartlabs_path" ]; then
cd $smartlabs_path
if [ -f .after_restart_param ]; then
param=$(head -n 1 .after_restart_param)
# SmartLabs start routine
slbase=/opt/smartlabs
if [ -d $slbase ]; then
if [ ! -d $slbase/logs ]; then
mkdir $slbase/logs
fi
filenames=`find . -maxdepth 1 -type f -not -path '*/\.*' | sed 's/^\.\///g' | sort`
if [ ! -z "$filenames" ]; then
for eachfile in $filenames
do
echo "==== $eachfile $param"
./$eachfile $param
if [ ! -d $remove_path ]; then
echo "==== creating $remove_path"
mkdir $remove_path
fi
echo "==== moving $eachfile to $remove_path"
mv -f $eachfile $remove_path
done
cd $start_path
sllogbase=$slbase/logs/smartlabs_$(date +"%Y%m%d")
echo "** Starting slupdate `date` **" >> $sllogbase.log
if [ -f $slbase/bin/update.sh ]; then
sudo $slbase/bin/update.sh >> $sllogbase.log
else
echo "nothing to update"
echo "** `date`" >> $sllogbase.log
echo "**** Could not find update.sh" >> $sllogbase.log
fi
exit 0
else
echo "Error: $smartlabs_path not found. Can not continue"
exit 1
fi
exit 0
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
smartlabs_path=/opt/smartlabs/update
echo == "Starting update `date`"
start_path=`pwd`
remove_path=remove_$(date +"%Y%m%d%H%M")
if [ -d "$smartlabs_path" ]; then
cd $smartlabs_path
if [ -f .after_restart_param ]; then
param=$(head -n 1 .after_restart_param)
fi
filenames=`find . -maxdepth 1 -name \*.sh -type f -not -path '*/\.*' | sed 's/^\.\///g' | sort`
if [ ! -z "$filenames" ]; then
for eachfile in $filenames
do
echo "==== Starting $eachfile $param `date`"
./$eachfile $param
param=""
if [ ! -f .after_restart_param ]; then
if [ ! -d $remove_path ]; then
echo "==== creating $remove_path `date`"
mkdir $remove_path
fi
echo "==== moving $eachfile to $remove_path"
mv -f $eachfile $remove_path
fi
done
cd $start_path
else
echo "**** nothing to update ****"
fi
exit 0
else
echo "**** Error: $smartlabs_path not found. Can not continue ****"
exit 1
fi
#! /bin/sh
#! /bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
echo "+ System Upgrade"
echo " first waiting 2 minutes"
sleep 2m
apt-get update
apt-get upgrade -y
apt-get autoremove -y
#! /bin/sh
#! /bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
apt install trash-cli -y
cp ../var/system/pi.sh /etc/profile.d
cp ../var/system/trimspaces /usr/bin/
cp ../var/system/gittrimspaces /usr/bin
cat ../var/system/bashrc >> ~/.bashrc
echo "umask 022" >> /etc/profile
cp ../var/system/trimspaces /usr/local/bin/
cp ../var/system/gittrimspaces /usr/local/bin
cat ../var/system/bashrc >> /home/pi/.bashrc
echo "set -o ignoreeof" >> /etc/profile
cat ../var/system/gitconfig >> ~/.gitconfig
cat ../var/system/authorized_keys >> ~/.ssh/authorized_keys
echo "umask 022" >> /etc/profile
cat ../var/system/gitconfig >> /home/pi/.gitconfig
if [ ! -d /home/pi/.ssh ]; then
mkdir /home/pi/.ssh
touch /home/pi/.ssh/authorized_keys
chown -R pi /home/pi/.ssh
chgrp -R pi /home/pi/.ssh
chmod -R 700 /home/pi/.ssh
fi
cat ../var/system/authorized_keys >> /home/pi/.ssh/authorized_keys
#! /bin/sh
#! /bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
echo "+ Enable ssh"
......
#! /bin/sh
#! /bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
case "$1" in
......
#! /bin/bash
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
case "$1" in
"")
echo "start first"
echo "second" > $param_file
apt-get update
apt-get full-upgrade -y
yes | rpi-update
echo "going to shutdown"
reboot
sleep 10s
;;
second)
echo "start second"
echo "third" > $param_file
rpi-eeprom-update -d -a
echo "going to shutdown"
reboot
sleep 10s
;;
third)
echo "start third"
rm -f $param_file
echo "USB Boot is prepared, launch raspi-config"
;;
esac
#! /bin/sh
#! /bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
# Install Docker
echo "+ Install docker"
curl -sSL https://get.docker.com | sh
# Test Docker installation
docker run hello-world
# Docker Compose
echo "+ Install Docker Compose"
# IMPORTANT! Install proper dependencies
apt-get install -y libffi-dev libssl-dev
apt-get install -y python3 python3-pip
apt-get remove python-configparser
# Install Docker Compose
pip3 -v install docker-compose
#Test Installation
docker-compose version
#Initial by docker-compose.yml
docker-compose pull
docker-compose up -d
case "$1" in
"")
echo "start first"
echo "second" > $param_file
apt-get upgrade -y
# Install Docker
echo "+ Install docker"
curl -sSL https://get.docker.com | sh
# Test Docker installation
docker run hello-world
# Docker Compose
echo "+ Install Docker Compose"
# IMPORTANT! Install proper dependencies
apt-get install -y libffi-dev libssl-dev
apt-get install -y python3 python3-pip
apt-get remove python-configparser
# Install Docker Compose
pip3 -v install docker-compose
#Test Installation
docker-compose version
echo "going to shutdown"
reboot
sleep 10s
;;
second)
echo "start second"
rm -f $param_file
apt-get upgrade -y
#Initial by docker-compose.yml
docker-compose pull
docker-compose up -d
docker ps
;;
esac
#! /bin/sh
#! /bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
# Docker Compose
......
#! /bin/sh
#! /bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
#RTC kernel module builder for RaspBee II
......
#! /bin/sh
#! /bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
#https://phoscon.de/en/raspbee/install#raspbian
......@@ -21,7 +21,7 @@ wget -O - http://phoscon.de/apt/deconz.pub.key | sudo apt-key add -
sh -c "echo 'deb http://phoscon.de/apt/deconz $(lsb_release -cs) main' > /etc/apt/sources.list.d/deconz.list"
#Beta (alternative)
#sh -c "echo 'deb http://phoscon.de/apt/deconz $(lsb_release -cs)-beta main' > /etc/apt/sources.list.d/deconz.list"
apt update
apt-get update
apt install deconz
#Update WiringPi (only needed for Raspberry Pi 4B)
......
......@@ -7,12 +7,16 @@ case "$1" in
"")
echo "start first"
echo "second" > $param_file
echo "going to shutdown"
#reboot
sleep 10s
;;
second)
echo "second"
echo "third" > $param_file
echo "going to shutdown"
#reboot
sleep 10s
;;
third)
echo "third"
......
#! /bin/bash
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
echo "+ System Upgrade"
echo " first waiting 2 minutes"
sleep 2m
apt-get update
apt-get upgrade -y
apt-get autoremove -y
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
param_file=.after_restart_param
echo "+ Change DTZ"
timedatectl set-timezone Europe/Bratislava
#! /bin/bash
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
apt install trash-cli -y
cp ../var/system/pi.sh /etc/profile.d
cp ../var/system/trimspaces /usr/local/bin/
cp ../var/system/gittrimspaces /usr/local/bin
cat ../var/system/bashrc >> /home/pi/.bashrc
echo "set -o ignoreeof" >> /etc/profile
echo "umask 022" >> /etc/profile
cat ../var/system/gitconfig >> /home/pi/.gitconfig
if [ ! -d /home/pi/.ssh ]; then
mkdir /home/pi/.ssh
touch /home/pi/.ssh/authorized_keys
chown -R pi /home/pi/.ssh
chgrp -R pi /home/pi/.ssh
chmod -R 700 /home/pi/.ssh
fi
cat ../var/system/authorized_keys >> /home/pi/.ssh/authorized_keys
#! /bin/bash
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
echo "+ Enable ssh"
systemctl enable ssh
systemctl start ssh
#! /bin/bash
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
param_file=.after_restart_param
case "$1" in
"")
echo "start first"
echo "second" > $param_file
apt-get update
apt-get full-upgrade -y
yes | rpi-update
echo "going to shutdown"
reboot
sleep 10s
;;
second)
echo "start second"
echo "third" > $param_file
rpi-eeprom-update -d -a
echo "going to shutdown"
reboot
sleep 10s
;;
third)
echo "start third"
rm -f $param_file
echo "USB Boot is prepared, launch raspi-config"
;;
esac
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment