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"
|
vmdebootstrap_dir="${vendor_dir}/vmdebootstrap"
|
||||||
|
|
||||||
if [ -z "$MIRROR" ] || [ -z "$SUITE" ] ; then
|
if [ -z "$MIRROR" ] || [ -z "$SUITE" ] ; then
|
||||||
echo $"error: Missing MIRROR and SUITE settings inherited from Makefile."
|
echo $"error: Missing MIRROR and SUITE settings inherited from Makefile."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Packages to install in all Freedombone environments
|
# 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.
|
echo Building $MACHINE $PROJECT_NAME for $ARCHITECTURE.
|
||||||
|
|
||||||
case "$MACHINE" in
|
case "$MACHINE" in
|
||||||
beaglebone)
|
beaglebone)
|
||||||
extra_pkgs="$beaglebone_pkgs"
|
extra_pkgs="$beaglebone_pkgs"
|
||||||
extra_opts="\
|
extra_opts="\
|
||||||
--variant minbase \
|
--variant minbase \
|
||||||
|
@ -105,7 +105,7 @@ case "$MACHINE" in
|
||||||
--roottype btrfs \
|
--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_pkgs="$a20_pkgs"
|
||||||
extra_opts="\
|
extra_opts="\
|
||||||
--variant minbase \
|
--variant minbase \
|
||||||
|
@ -118,12 +118,12 @@ case "$MACHINE" in
|
||||||
--roottype btrfs \
|
--roottype btrfs \
|
||||||
"
|
"
|
||||||
;;
|
;;
|
||||||
virtualbox)
|
virtualbox)
|
||||||
extra_opts="\
|
extra_opts="\
|
||||||
--grub \
|
--grub \
|
||||||
--roottype btrfs \
|
--roottype btrfs \
|
||||||
" ;;
|
" ;;
|
||||||
qemu)
|
qemu)
|
||||||
extra_opts="\
|
extra_opts="\
|
||||||
--grub \
|
--grub \
|
||||||
--roottype btrfs \
|
--roottype btrfs \
|
||||||
|
@ -168,37 +168,81 @@ else
|
||||||
VMDEBOOTSTRAP=vmdebootstrap
|
VMDEBOOTSTRAP=vmdebootstrap
|
||||||
fi
|
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'
|
echo $'Making customised customisation script'
|
||||||
TEMP_CUSTOMISE=/etc/${PROJECT_NAME}/image-customise
|
TEMP_CUSTOMISE=/etc/${PROJECT_NAME}/image-customise
|
||||||
if [ -f /usr/local/bin/${PROJECT_NAME}-image-customise ]; then
|
TEMP_CUSTOMISE2=/tmp/${PROJECT_NAME}-image-customise2
|
||||||
sudo cp /usr/local/bin/${PROJECT_NAME}-image-customise $TEMP_CUSTOMISE
|
TEMP_CUSTOMISE3=/tmp/${PROJECT_NAME}-image-customise3
|
||||||
else
|
TEMP_CUSTOMISE4=/tmp/${PROJECT_NAME}-image-customise4
|
||||||
sudo cp /usr/bin/${PROJECT_NAME}-image-customise $TEMP_CUSTOMISE
|
|
||||||
|
# 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
|
fi
|
||||||
sudo sed -i "s|MY_USERNAME=.*|MY_USERNAME=${MY_USERNAME}|g" $TEMP_CUSTOMISE
|
sudo mv $TEMP_CUSTOMISE4 $TEMP_CUSTOMISE
|
||||||
sudo sed -i "s|MY_PASSWORD=.*|MY_PASSWORD=${MY_PASSWORD}|g" $TEMP_CUSTOMISE
|
rm $TEMP_CUSTOMISE2 $TEMP_CUSTOMISE3 $TEMP_CUSTOMISE4
|
||||||
sudo sed -i "s|ROUTER_IP_ADDRESS=.*|ROUTER_IP_ADDRESS=${ROUTER_IP_ADDRESS}|g" $TEMP_CUSTOMISE
|
if [ ! -f $TEMP_CUSTOMISE ]; then
|
||||||
sudo sed -i "s|BOX_IP_ADDRESS=.*|BOX_IP_ADDRESS=${BOX_IP_ADDRESS}|g" $TEMP_CUSTOMISE
|
echo $'Customised customisation script could not be created'
|
||||||
sudo sed -i "s|NAMESERVER1=.*|NAMESERVER1=${NAMESERVER1}|g" $TEMP_CUSTOMISE
|
exit 735892
|
||||||
sudo sed -i "s|NAMESERVER2=.*|NAMESERVER2=${NAMESERVER1}|g" $TEMP_CUSTOMISE
|
fi
|
||||||
sudo sed -i "s|PROJECT_NAME=.*|PROJECT_NAME=${PROJECT_NAME}|g" $TEMP_CUSTOMISE
|
echo $'Customised customisation script created'
|
||||||
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
|
|
||||||
|
|
||||||
echo $"starting $VMDEBOOTSTRAP"
|
echo $"starting $VMDEBOOTSTRAP"
|
||||||
# Run vmdebootstrap script to create image
|
# Run vmdebootstrap script to create image
|
||||||
|
|
Loading…
Reference in New Issue