Files
clover/image_builder/scripts/init_image.sh
2018-09-05 16:01:45 +03:00

39 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
set -e
##################################################################################################################################
# Image initialisation
##################################################################################################################################
# Add apt key to allow local mirror usage during image build
#wget -O - ftp://192.168.0.10/coex-mirror.gpg | apt-key add -
# Generate a backup of the original source.list
#cp /etc/apt/sources.list /var/sources.list.bak
# Add the local mirror as the first priority repository
#wget -O - ftp://192.168.0.10/coex-mirror.list 2>/dev/null | cat - /etc/apt/sources.list > /var/sources.list && mv /var/sources.list /etc/apt/sources.list
echo -e "\033[0;31m\033[1m$(date) | #1 apt cache update\033[0m\033[0m"
# Clean repostory cache
apt-get clean
# Update repository cache
apt-get update
# && apt upgrade -y
echo -e "\033[0;31m\033[1m$(date) | #2 Write clever information\033[0m\033[0m"
# Clever image version
echo "$1" >> /etc/clever_version
# Origin image file name
echo "${2%.*}" >> /etc/clever_origin
echo -e "\033[0;31m\033[1m$(date) | #3 Set max space for syslogs\033[0m\033[0m"
# https://unix.stackexchange.com/questions/139513/how-to-clear-journalctl
sed -i 's/#SystemMaxUse=/SystemMaxUse=200M/' /etc/systemd/journald.conf
echo -e "\033[0;31m\033[1m$(date) | #4 End initialisation of image\033[0m\033[0m"