Generic image setup
This commit is contained in:
parent
fb676a24fa
commit
ae7169e88f
Binary file not shown.
|
@ -65,6 +65,9 @@ SSH_PUBKEY="no"
|
||||||
# interactive mode
|
# interactive mode
|
||||||
INTERACTIVE="no"
|
INTERACTIVE="no"
|
||||||
|
|
||||||
|
# Whether this is a generic image for mass redistribution on the interwebs
|
||||||
|
GENERIC_IMAGE="no"
|
||||||
|
|
||||||
while [[ $# > 1 ]]
|
while [[ $# > 1 ]]
|
||||||
do
|
do
|
||||||
key="$1"
|
key="$1"
|
||||||
|
@ -130,6 +133,10 @@ case $key in
|
||||||
shift
|
shift
|
||||||
INTERACTIVE="$1"
|
INTERACTIVE="$1"
|
||||||
;;
|
;;
|
||||||
|
-g|--generic)
|
||||||
|
shift
|
||||||
|
GENERIC_IMAGE="$1"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# unknown option
|
# unknown option
|
||||||
;;
|
;;
|
||||||
|
@ -182,7 +189,8 @@ make $IMAGE_TYPE \
|
||||||
PROJECT_NAME="$PROJECT_NAME" \
|
PROJECT_NAME="$PROJECT_NAME" \
|
||||||
CONFIG_FILENAME="$CONFIG_FILENAME" \
|
CONFIG_FILENAME="$CONFIG_FILENAME" \
|
||||||
IMAGE_SIZE="$IMAGE_SIZE" \
|
IMAGE_SIZE="$IMAGE_SIZE" \
|
||||||
SSH_PUBKEY="$SSH_PUBKEY"
|
SSH_PUBKEY="$SSH_PUBKEY" \
|
||||||
|
GENERIC_IMAGE="$GENERIC_IMAGE"
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
imgfiles=(build/${PROJECT_NAME}*.img)
|
imgfiles=(build/${PROJECT_NAME}*.img)
|
||||||
|
|
|
@ -50,6 +50,9 @@ CONFIG_FILENAME=
|
||||||
# Optional ssh public key to allow
|
# Optional ssh public key to allow
|
||||||
SSH_PUBKEY="no"
|
SSH_PUBKEY="no"
|
||||||
|
|
||||||
|
# Whether this is a generic image for mass redistribution on the interwebs
|
||||||
|
GENERIC_IMAGE="no"
|
||||||
|
|
||||||
enable_eatmydata_override() {
|
enable_eatmydata_override() {
|
||||||
chroot $rootdir apt-get install --no-install-recommends -y eatmydata
|
chroot $rootdir apt-get install --no-install-recommends -y eatmydata
|
||||||
if [ -x $rootdir/usr/bin/eatmydata ] && \
|
if [ -x $rootdir/usr/bin/eatmydata ] && \
|
||||||
|
@ -181,6 +184,33 @@ admin_user_sudo() {
|
||||||
echo "$MY_USERNAME ALL=(ALL) ALL" >> $rootdir/etc/sudoers
|
echo "$MY_USERNAME ALL=(ALL) ALL" >> $rootdir/etc/sudoers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_generic_image() {
|
||||||
|
if [[ $GENERIC_IMAGE == "no" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
# Don't install any configuration. This will be a base system
|
||||||
|
CONFIG_FILENAME=
|
||||||
|
# The presence of this file indicates that the initial
|
||||||
|
# setup has not yet been completed
|
||||||
|
touch $rootdir/home/$MY_USERNAME/.initial_setup
|
||||||
|
|
||||||
|
|
||||||
|
cat >> /home/$MY_USERNAME/.bashrc <<EOF
|
||||||
|
if [ -f ~/.initial_setup ]; then
|
||||||
|
clear
|
||||||
|
echo '>>> Freedombone system initial setup <<<'
|
||||||
|
echo ''
|
||||||
|
echo 'The first thing you need to do is to change your password, otherwise'
|
||||||
|
echo 'your system will be insecure. Your password should be at least 10'
|
||||||
|
echo 'characters long and contain letters and numbers. Do this now:'
|
||||||
|
passwd
|
||||||
|
sudo su
|
||||||
|
freedombone menuconfig
|
||||||
|
rm ~/.initial_setup
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
continue_installation() {
|
continue_installation() {
|
||||||
# If a configuration file exists then run with it
|
# If a configuration file exists then run with it
|
||||||
# otherwise the interactive installer can be used
|
# otherwise the interactive installer can be used
|
||||||
|
@ -298,6 +328,7 @@ chroot "$rootdir" apt-get update
|
||||||
configure_ssh
|
configure_ssh
|
||||||
configure_networking
|
configure_networking
|
||||||
admin_user_sudo
|
admin_user_sudo
|
||||||
|
create_generic_image
|
||||||
continue_installation
|
continue_installation
|
||||||
|
|
||||||
cd /
|
cd /
|
||||||
|
|
|
@ -45,6 +45,7 @@ export NAMESERVER2
|
||||||
export PROJECT_NAME
|
export PROJECT_NAME
|
||||||
export CONFIG_FILENAME
|
export CONFIG_FILENAME
|
||||||
export SSH_PUBKEY
|
export SSH_PUBKEY
|
||||||
|
export GENERIC_IMAGE
|
||||||
|
|
||||||
# Locate vmdebootstrap program fetched in Makefile
|
# Locate vmdebootstrap program fetched in Makefile
|
||||||
basedir=`pwd`
|
basedir=`pwd`
|
||||||
|
@ -144,6 +145,7 @@ sudo sed -i "s|NAMESERVER2=.*|NAMESERVER2=${NAMESERVER1}|g" $TEMP_CUSTOMISE
|
||||||
sudo sed -i "s|PROJECT_NAME=.*|PROJECT_NAME=${PROJECT_NAME}|g" $TEMP_CUSTOMISE
|
sudo sed -i "s|PROJECT_NAME=.*|PROJECT_NAME=${PROJECT_NAME}|g" $TEMP_CUSTOMISE
|
||||||
sudo sed -i "s|CONFIG_FILENAME=.*|CONFIG_FILENAME=${CONFIG_FILENAME}|g" $TEMP_CUSTOMISE
|
sudo sed -i "s|CONFIG_FILENAME=.*|CONFIG_FILENAME=${CONFIG_FILENAME}|g" $TEMP_CUSTOMISE
|
||||||
sudo sed -i "s|SSH_PUBKEY=.*|SSH_PUBKEY=${SSH_PUBKEY}|g" $TEMP_CUSTOMISE
|
sudo sed -i "s|SSH_PUBKEY=.*|SSH_PUBKEY=${SSH_PUBKEY}|g" $TEMP_CUSTOMISE
|
||||||
|
sudo sed -i "s|GENERIC_IMAGE=.*|GENERIC_IMAGE=${GENERIC_IMAGE}|g" $TEMP_CUSTOMISE
|
||||||
|
|
||||||
echo "starting $VMDEBOOTSTRAP"
|
echo "starting $VMDEBOOTSTRAP"
|
||||||
# Run vmdebootstrap script to create image
|
# Run vmdebootstrap script to create image
|
||||||
|
|
Loading…
Reference in New Issue