From b5d62545bed110b271638e12fbd4bd1ba4a5f3d0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 4 Dec 2015 12:09:07 +0000 Subject: [PATCH] Option to change the ssh port used by images --- man/freedombone-image.1.gz | Bin 2171 -> 2202 bytes src/freedombone-image | 12 ++++++++++-- src/freedombone-image-customise | 5 ++++- src/freedombone-image-make | 2 ++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/man/freedombone-image.1.gz b/man/freedombone-image.1.gz index c26f15b89baa236019c030ec2c1a030bc03a4507..a4438262914b11f7c5ae3109b72e1dadd372d4de 100644 GIT binary patch literal 2202 zcmV;L2xa#liwFQaf?-ww1GQLTZ`-^P{;pqf@Rw{rBscEcqHnMcual;Uu_O&*r(Kr~ z10_*55s6eq%885p_&rBTw(7K9zpN+ik=_#&zMddDV($la=ibpMSpoa5JCHzh@wJbnis7l?w{+ja zJ1r`Sr<(3-VeO-7ay-QfGLSaK?(*$s(2Z=|*1Wn)?=8@k`ElPTaB7PWK~Uh`IM zkLdorYOJGo*K>lsHNKnOgm)9VpUceX{MpNl?y+8|W!u03qp46OyJ_jZLqvV$=Xfc# zY~bPjM%w>q!%LOY*i#OdtX&~K(>T&?mBO_StaoSg)7#n2V)o&B6fIWDQuYf8cx;qo z^ntygN@b0izoSevdD0y_yPhwmmzUFU?mJmaolBi5oSWguRQ5TPIXx=3I*ua3AKT_Q zv33Z`QM~ClQQE39j{&mOP9dzZzqfD%HVW>)*pC0)|R&C6*iaX|{_^fiVZEFvI8?$Sj zA>JHCvw}9J1rEp&5Df{SwQ3wnhB@dnV9Bkd2I1*l$P2zXfI$t8^Jh}~^k7qzoDjI< z8kI(ktc^!lX&(%6`8 zs1kZZ46P+)JH~vs#8WAjrS$THdU-UF>g`aS3(mlAQ%^m>TV&!;!9|NZ*62y!L29P3pu za3D7*7tX~>tR*pRSXvbbztf$B`1`^uvnPYkIZDvuiCl!5Wc85*y{~E{EMms2gkJjX z4fP#kmk~|`+JWO*2+a2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yubFwmg!5&4XhG;)f;<4S6xF53n3}xSO@f;-{_QBmeiCAQ;jY>bh=ZA#qR6`%~997^$&hbS1rdcupMOpMwW?(%)Ru zb`Il?gIYLO+oRzS_wYrVCK$Dbsj!PC8*YI$RMxh#{~ws~{p{lAZV(-tl&*}!)x4s= zq$d3XdSq}alW_w3f3+$5-(v``j+7 x 1 ]] do key="$1" @@ -152,6 +155,10 @@ case $key in shift MINIMAL_INSTALL="$1" ;; + --ssh|--sshport) + shift + SSH_PORT="$1" + ;; *) # unknown option ;; @@ -218,7 +225,8 @@ make $IMAGE_TYPE \ IMAGE_SIZE="$IMAGE_SIZE" \ SSH_PUBKEY="$SSH_PUBKEY" \ GENERIC_IMAGE="$GENERIC_IMAGE" \ - MINIMAL_INSTALL="$MINIMAL_INSTALL" + MINIMAL_INSTALL="$MINIMAL_INSTALL" \ + SSH_PORT="$SSH_PORT" if [ ! "$?" = "0" ]; then echo $'Build failed' @@ -262,7 +270,7 @@ Image was created. You will be able to log into it with: " if [[ $IMAGE_TYPE != "virtualbox"* && $IMAGE_TYPE != "qemu"* ]]; then - echo $" ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p 2222 + echo $" ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p $SSH_PORT Password: $PASSWORD " diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index a1bdf69d..37c7c850 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -62,6 +62,9 @@ SSH_PUBKEY="no" # Whether this is a generic image for mass redistribution on the interwebs GENERIC_IMAGE="no" +# default SSH port +SSH_PORT=2222 + enable_eatmydata_override() { chroot $rootdir apt-get install --no-install-recommends -y eatmydata if [ -x $rootdir/usr/bin/eatmydata ] && \ @@ -176,7 +179,7 @@ following commands, then enter your details. } configure_ssh() { - sed -i "s/Port .*/Port 2222/g" $rootdir/etc/ssh/sshd_config + sed -i "s/Port .*/Port ${SSH_PORT}/g" $rootdir/etc/ssh/sshd_config if [[ "$SSH_PUBKEY" != "no" ]]; then if [ ! -d $rootdir/home/$MY_USERNAME/.ssh ]; then diff --git a/src/freedombone-image-make b/src/freedombone-image-make index 09852ae9..f07faa4d 100755 --- a/src/freedombone-image-make +++ b/src/freedombone-image-make @@ -52,6 +52,7 @@ export CONFIG_FILENAME export SSH_PUBKEY export GENERIC_IMAGE export MINIMAL_INSTALL +export SSH_PORT # Locate vmdebootstrap program fetched in Makefile basedir=`pwd` @@ -164,6 +165,7 @@ sudo sed -i "s|CONFIG_FILENAME=.*|CONFIG_FILENAME=${CONFIG_FILENAME}|g" $TEMP_CU 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 echo $"starting $VMDEBOOTSTRAP" # Run vmdebootstrap script to create image