Roll all the scripts into the customisation script
It's ugly, but only a temporary file
This commit is contained in:
parent
35894edacf
commit
e158148c1f
|
@ -72,8 +72,8 @@ vendor_dir="${basedir}/vendor"
|
|||
vmdebootstrap_dir="${vendor_dir}/vmdebootstrap"
|
||||
|
||||
if [ -z "$MIRROR" ] || [ -z "$SUITE" ] ; then
|
||||
echo $"error: Missing MIRROR and SUITE settings inherited from Makefile."
|
||||
exit 1
|
||||
echo $"error: Missing MIRROR and SUITE settings inherited from Makefile."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Packages to install in all Freedombone environments
|
||||
|
@ -92,7 +92,7 @@ dev_pkgs="build-essential devscripts make man-db emacs org-mode git mercurial"
|
|||
echo Building $MACHINE $PROJECT_NAME for $ARCHITECTURE.
|
||||
|
||||
case "$MACHINE" in
|
||||
beaglebone)
|
||||
beaglebone)
|
||||
extra_pkgs="$beaglebone_pkgs"
|
||||
extra_opts="\
|
||||
--variant minbase \
|
||||
|
@ -105,7 +105,7 @@ case "$MACHINE" in
|
|||
--roottype btrfs \
|
||||
"
|
||||
;;
|
||||
cubietruck | a20-olinuxino-lime | a20-olinuxino-lime2 | a20-olinuxino-micro | cubieboard2)
|
||||
cubietruck | a20-olinuxino-lime | a20-olinuxino-lime2 | a20-olinuxino-micro | cubieboard2)
|
||||
extra_pkgs="$a20_pkgs"
|
||||
extra_opts="\
|
||||
--variant minbase \
|
||||
|
@ -118,12 +118,12 @@ case "$MACHINE" in
|
|||
--roottype btrfs \
|
||||
"
|
||||
;;
|
||||
virtualbox)
|
||||
virtualbox)
|
||||
extra_opts="\
|
||||
--grub \
|
||||
--roottype btrfs \
|
||||
" ;;
|
||||
qemu)
|
||||
qemu)
|
||||
extra_opts="\
|
||||
--grub \
|
||||
--roottype btrfs \
|
||||
|
@ -168,37 +168,81 @@ else
|
|||
VMDEBOOTSTRAP=vmdebootstrap
|
||||
fi
|
||||
|
||||
PROJECT_INSTALL_DIR=/usr/local/bin
|
||||
if [ -f /usr/bin/${PROJECT_NAME} ]; then
|
||||
PROJECT_INSTALL_DIR=/usr/bin
|
||||
fi
|
||||
|
||||
echo $'Making customised customisation script'
|
||||
TEMP_CUSTOMISE=/etc/${PROJECT_NAME}/image-customise
|
||||
if [ -f /usr/local/bin/${PROJECT_NAME}-image-customise ]; then
|
||||
sudo cp /usr/local/bin/${PROJECT_NAME}-image-customise $TEMP_CUSTOMISE
|
||||
else
|
||||
sudo cp /usr/bin/${PROJECT_NAME}-image-customise $TEMP_CUSTOMISE
|
||||
TEMP_CUSTOMISE2=/tmp/${PROJECT_NAME}-image-customise2
|
||||
TEMP_CUSTOMISE3=/tmp/${PROJECT_NAME}-image-customise3
|
||||
TEMP_CUSTOMISE4=/tmp/${PROJECT_NAME}-image-customise4
|
||||
|
||||
# cat all the things together
|
||||
cp $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars $TEMP_CUSTOMISE2
|
||||
echo $'Adding utilities to customised customisation script'
|
||||
UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
|
||||
for f in $UTILS_FILES
|
||||
do
|
||||
cat $f >> $TEMP_CUSTOMISE2
|
||||
done
|
||||
echo $'Adding base system to customised customisation script'
|
||||
BASE_SYSTEM_FILES=/usr/share/${PROJECT_NAME}/base/${PROJECT_NAME}-base-*
|
||||
for f in $BASE_SYSTEM_FILES
|
||||
do
|
||||
cat $f >> $TEMP_CUSTOMISE2
|
||||
done
|
||||
echo $'Adding apps to customised customisation script'
|
||||
APP_FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
||||
for f in $APP_FILES
|
||||
do
|
||||
cat $f >> $TEMP_CUSTOMISE2
|
||||
done
|
||||
echo $'Removing headers from customised customisation script'
|
||||
sed -i 's|#!/bin/bash||g' $TEMP_CUSTOMISE2
|
||||
|
||||
echo $'Changing values within customised customisation script'
|
||||
cp $PROJECT_INSTALL_DIR/${PROJECT_NAME}-image-customise $TEMP_CUSTOMISE3
|
||||
sed -i "s|MY_USERNAME=.*|MY_USERNAME=${MY_USERNAME}|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|MY_PASSWORD=.*|MY_PASSWORD=${MY_PASSWORD}|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|ROUTER_IP_ADDRESS=.*|ROUTER_IP_ADDRESS=${ROUTER_IP_ADDRESS}|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|BOX_IP_ADDRESS=.*|BOX_IP_ADDRESS=${BOX_IP_ADDRESS}|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|NAMESERVER1=.*|NAMESERVER1=${NAMESERVER1}|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|NAMESERVER2=.*|NAMESERVER2=${NAMESERVER1}|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|PROJECT_NAME=.*|PROJECT_NAME=${PROJECT_NAME}|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|CONFIG_FILENAME=.*|CONFIG_FILENAME=${CONFIG_FILENAME}|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|SSH_PUBKEY=.*|SSH_PUBKEY=${SSH_PUBKEY}|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|GENERIC_IMAGE=.*|GENERIC_IMAGE=${GENERIC_IMAGE}|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|MINIMAL_INSTALL=.*|MINIMAL_INSTALL=\"${MINIMAL_INSTALL}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|SSH_PORT=.*|SSH_PORT=\"${SSH_PORT}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|ONION_ONLY=.*|ONION_ONLY=\"${ONION_ONLY}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|PROJECT_REPO=.*|PROJECT_REPO=\"${PROJECT_REPO}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|DEBIAN_INSTALL_ONLY=.*|DEBIAN_INSTALL_ONLY=\"${DEBIAN_INSTALL_ONLY}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|WIFI_INTERFACE=.*|WIFI_INTERFACE=\"${WIFI_INTERFACE}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|WIFI_SSID=.*|WIFI_SSID=\"${WIFI_SSID}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|WIFI_TYPE=.*|WIFI_TYPE=\"${WIFI_TYPE}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|WIFI_PASSPHRASE=.*|WIFI_PASSPHRASE=\"${WIFI_PASSPHRASE}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|WIFI_HOTSPOT=.*|WIFI_HOTSPOT=\"${WIFI_HOTSPOT}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|WIFI_NETWORKS_FILE=.*|WIFI_NETWORKS_FILE=\"${WIFI_NETWORKS_FILE}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|VARIANT=.*|VARIANT=\"${VARIANT}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|MINIMUM_PASSWORD_LENGTH=.*|MINIMUM_PASSWORD_LENGTH=\"${MINIMUM_PASSWORD_LENGTH}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i "s|INSECURE=.*|INSECURE=\"${INSECURE}\"|g" $TEMP_CUSTOMISE3
|
||||
sed -i 's|#!/bin/bash||g' $TEMP_CUSTOMISE3
|
||||
|
||||
echo "#!/bin/bash" > $TEMP_CUSTOMISE4
|
||||
cat $TEMP_CUSTOMISE2 $TEMP_CUSTOMISE3 >> $TEMP_CUSTOMISE4
|
||||
if [ -f $TEMP_CUSTOMISE ]; then
|
||||
sudo rm $TEMP_CUSTOMISE
|
||||
fi
|
||||
sudo sed -i "s|MY_USERNAME=.*|MY_USERNAME=${MY_USERNAME}|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|MY_PASSWORD=.*|MY_PASSWORD=${MY_PASSWORD}|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|ROUTER_IP_ADDRESS=.*|ROUTER_IP_ADDRESS=${ROUTER_IP_ADDRESS}|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|BOX_IP_ADDRESS=.*|BOX_IP_ADDRESS=${BOX_IP_ADDRESS}|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|NAMESERVER1=.*|NAMESERVER1=${NAMESERVER1}|g" $TEMP_CUSTOMISE
|
||||
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|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|GENERIC_IMAGE=.*|GENERIC_IMAGE=${GENERIC_IMAGE}|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|MINIMAL_INSTALL=.*|MINIMAL_INSTALL=\"${MINIMAL_INSTALL}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|SSH_PORT=.*|SSH_PORT=\"${SSH_PORT}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|ONION_ONLY=.*|ONION_ONLY=\"${ONION_ONLY}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|PROJECT_REPO=.*|PROJECT_REPO=\"${PROJECT_REPO}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|DEBIAN_INSTALL_ONLY=.*|DEBIAN_INSTALL_ONLY=\"${DEBIAN_INSTALL_ONLY}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|WIFI_INTERFACE=.*|WIFI_INTERFACE=\"${WIFI_INTERFACE}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|WIFI_SSID=.*|WIFI_SSID=\"${WIFI_SSID}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|WIFI_TYPE=.*|WIFI_TYPE=\"${WIFI_TYPE}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|WIFI_PASSPHRASE=.*|WIFI_PASSPHRASE=\"${WIFI_PASSPHRASE}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|WIFI_HOTSPOT=.*|WIFI_HOTSPOT=\"${WIFI_HOTSPOT}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|WIFI_NETWORKS_FILE=.*|WIFI_NETWORKS_FILE=\"${WIFI_NETWORKS_FILE}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|VARIANT=.*|VARIANT=\"${VARIANT}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|MINIMUM_PASSWORD_LENGTH=.*|MINIMUM_PASSWORD_LENGTH=\"${MINIMUM_PASSWORD_LENGTH}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|INSECURE=.*|INSECURE=\"${INSECURE}\"|g" $TEMP_CUSTOMISE
|
||||
sudo mv $TEMP_CUSTOMISE4 $TEMP_CUSTOMISE
|
||||
rm $TEMP_CUSTOMISE2 $TEMP_CUSTOMISE3 $TEMP_CUSTOMISE4
|
||||
if [ ! -f $TEMP_CUSTOMISE ]; then
|
||||
echo $'Customised customisation script could not be created'
|
||||
exit 735892
|
||||
fi
|
||||
echo $'Customised customisation script created'
|
||||
|
||||
|
||||
echo $"starting $VMDEBOOTSTRAP"
|
||||
# Run vmdebootstrap script to create image
|
||||
|
|
Loading…
Reference in New Issue