diff --git a/inst-raps.sh b/inst-raps.sh new file mode 100755 index 0000000..b3e82de --- /dev/null +++ b/inst-raps.sh @@ -0,0 +1,90 @@ +#!/bin/bash +############################################################ +# Description: install an config raspberry +# Usage: ./inst_raspberry.sh +# Author: Gilles Mouchet (gilles.mouchet@gmail.com) +# Creation Date: 26-Mar-2021 +# Version: 1.0 +# +# History: +# 1.0 - 26-Mar-2021: Creation of script from scratch +# +############################################################ + +# server vars +#hostName=actarus01p +#hostIp=192.168.1.12 +# check if is not on mac +os=$(uname) +os_mac="Darwin" +t=1 +#if [ "$t" -eq "1" ]; then +if [ "$(uname)" = "Darwin" ]; then + echo "do not execute on mac" + exit 1 +fi +# scripts vars (do not edit) +scriptName=`echo $0 | sed -e 's|.*/||g' | cut -f1 -d.` +dayOfWeek=`/bin/date +%a` +daySuffix="_$dayOfWeek" +logPath=`pwd` # log path is from execute script path +logFile=$logPath/$scriptName$daySuffix.log +tempOutputFile=$logPath/$progName.$$ # temp output console file +backupFolder=/root/backup # destination folder backup +hostName=actarus01p + +# constants +RED="\e[31m" +GREEN="\e[32m" +YELLOW="\e[33m" +BLUE="\e[36m" +ENDCOLOR="\e[0m" + +#----------------------------------------------------------------------------- +# Function +#----------------------------------------------------------------------------- +function saveFile(){ + if [ -f $1 ]; then + cp $1 $backupFolder >/dev/null 2>&1 + if [ $? -ne 0 ]; then printError "Problem to save $1 to $backupFolder";exit; fi + fi +} +function printSuccess() { + echo -e "[${GREEN}SUCCESS${ENDCOLOR}] - $1" +} +function printWarning() { + echo -e "[${YELLOW}WARNING${ENDCOLOR}] - $1" +} +function printError() { + echo -e "[${RED}ERROR${ENDCOLOR}] - $1" +} +function printInfo() { + echo -e "\n[${BLUE}INFO${ENDCOLOR}] - $1" +} +function printSubInfo() { + echo -e " - $1" +} + +#----------------------------------------------------------------------------- +# install rootfs-expand +#----------------------------------------------------------------------------- +printInfo "Install rootfs-expand package" +dnf install rocky-release-rpi-9.0-5.el9.noarch -y +if [ "$?" -ne "0"]; then printError "Problem to install rootfs-extand package";exit; fi +printSuccess "rootfs-expand package installed successfully" + +#----------------------------------------------------------------------------- +# extend root part +#----------------------------------------------------------------------------- +#printInfo "Extend root partition" +#partSize=`df --output=size -B 1 "$PWD" |tail -n 1` +#if [ $partSize -gt 61780000000 ]; then +# printSuccess "Root partion already extended" +#else +# parted /dev/mmcblk0 resizepart 3 100% >/dev/null 2>&1 +# error=$? +# resize2fs /dev/mmcblk0p3 >/dev/null 2>&1 +# let retVal=retVal+$error +# if [ $retVal -ne 0 ]; then printError "Problem to extend root partition";exit; fi +# printSuccess "Root partition extended" +#fi \ No newline at end of file