Fix bashate issues

This commit is contained in:
Igor Malinovskiy 2015-06-03 16:31:19 +03:00
parent 50336185d9
commit d06057ef6b
12 changed files with 35 additions and 35 deletions

View File

@ -2,4 +2,4 @@
set -eu
install-packages samba samba-common samba-common-bin
install-packages samba samba-common samba-common-bin

View File

@ -7,4 +7,4 @@ set -eu
set -o pipefail
# Enable registry in samba config
sed -i "s/\[global\]/\[global\]\\n\\n include = registry\\n/g" /etc/samba/smb.conf
sed -i "s/\[global\]/\[global\]\\n\\n include = registry\\n/g" /etc/samba/smb.conf

View File

@ -7,4 +7,4 @@ set -eu
set -o pipefail
# Install required packages
install-packages nfs-common nfs-kernel-server portmap
install-packages nfs-common nfs-kernel-server portmap

View File

@ -7,4 +7,4 @@ set -eu
set -o pipefail
# Patch NFS init script to allow running nfs-kernel-server without exports:
sed -i 's/\s&&\sgrep\s-q\s.*\s\$export_files$//g' /etc/init.d/nfs-kernel-server
sed -i 's/\s&&\sgrep\s-q\s.*\s\$export_files$//g' /etc/init.d/nfs-kernel-server

View File

@ -1,3 +1,3 @@
export DIB_MANILA_USER_USERNAME=${DIB_MANILA_USER_USERNAME:-manila}
export DIB_MANILA_USER_AUTHORIZED_KEYS=${DIB_MANILA_USER_AUTHORIZED_KEYS:-}
export DIB_MANILA_USER_PASSWORD=${DIB_MANILA_USER_PASSWORD:-}
export DIB_MANILA_USER_PASSWORD=${DIB_MANILA_USER_PASSWORD:-}

View File

@ -10,4 +10,4 @@ if [ -n "$DIB_MANILA_USER_AUTHORIZED_KEYS" ]; then
if [ -f "$DIB_MANILA_USER_AUTHORIZED_KEYS" ]; then
cat $DIB_MANILA_USER_AUTHORIZED_KEYS >> $TMP_HOOKS_PATH/manilauser-ssh-authorized-keys
fi
fi
fi

View File

@ -26,4 +26,4 @@ if [ -f /tmp/in_target.d/devuser-ssh-authorized-keys ]; then
cp /tmp/in_target.d/manilauser-ssh-authorized-keys /home/${DIB_MANILA_USER_USERNAME}/.ssh/authorized_keys
fi
chown -R ${DIB_MANILA_USER_USERNAME}:${DIB_MANILA_USER_USERNAME} /home/${DIB_MANILA_USER_USERNAME}
chown -R ${DIB_MANILA_USER_USERNAME}:${DIB_MANILA_USER_USERNAME} /home/${DIB_MANILA_USER_USERNAME}

View File

@ -15,4 +15,4 @@ if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/fetch-public-ssh-keys.conf /etc/init/fetch-public-ssh-keys.conf
else
echo "Not supported"
fi
fi

View File

@ -4,4 +4,4 @@ start on (started networking)
task
exec /usr/local/sbin/fetch-public-ssh-keys.sh
exec /usr/local/sbin/fetch-public-ssh-keys.sh

View File

@ -7,34 +7,34 @@ MANILA_USER_HOME="/home/$MANILA_USER"
MANILA_USER_SSH_DIR="$MANILA_USER_HOME/.ssh"
if [ ! -d $MANILA_USER_SSH_DIR ]; then
mkdir -p $MANILA_USER_SSH_DIR
chmod 700 $MANILA_USER_SSH_DIR
chown -R $MANILA_USER $MANILA_USER_SSH_DIR
mkdir -p $MANILA_USER_SSH_DIR
chmod 700 $MANILA_USER_SSH_DIR
chown -R $MANILA_USER $MANILA_USER_SSH_DIR
fi
# Fetch public key using HTTP
ATTEMPTS=10
FAILED=0
while [ ! -f $MANILA_USER_SSH_DIR/authorized_keys ]; do
curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/metadata-key 2>/dev/null
if [ $? -eq 0 ]; then
cat /tmp/metadata-key >> $MANILA_USER_SSH_DIR/authorized_keys
chmod 0600 $MANILA_USER_SSH_DIR/authorized_keys
chown $MANILA_USER $MANILA_USER_SSH_DIR/authorized_keys
rm -f /tmp/metadata-key
echo "Successfully retrieved public key from instance metadata"
echo "*****************"
echo "AUTHORIZED KEYS"
echo "*****************"
cat $MANILA_USER_SSH_DIR/authorized_keys
echo "*****************"
else
FAILED=`expr $FAILED + 1`
if [ $FAILED -ge $ATTEMPTS ]; then
echo "Failed to retrieve public key from instance metadata after $FAILED attempts, quitting"
break
curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/metadata-key 2>/dev/null
if [ $? -eq 0 ]; then
cat /tmp/metadata-key >> $MANILA_USER_SSH_DIR/authorized_keys
chmod 0600 $MANILA_USER_SSH_DIR/authorized_keys
chown $MANILA_USER $MANILA_USER_SSH_DIR/authorized_keys
rm -f /tmp/metadata-key
echo "Successfully retrieved public key from instance metadata"
echo "*****************"
echo "AUTHORIZED KEYS"
echo "*****************"
cat $MANILA_USER_SSH_DIR/authorized_keys
echo "*****************"
else
FAILED=`expr $FAILED + 1`
if [ $FAILED -ge $ATTEMPTS ]; then
echo "Failed to retrieve public key from instance metadata after $FAILED attempts, quitting"
break
fi
echo "Could not retrieve public key from instance metadata (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..."
sleep 5
fi
echo "Could not retrieve public key from instance metadata (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..."
sleep 5
fi
done
done

View File

@ -10,4 +10,4 @@ sudo sed -i -E "s/#\s(deb.+universe)$/\1/g" /etc/apt/sources.list
apt-get update
apt-get upgrade -y
apt-get install python sudo openssh-server rpcbind -y
apt-get install python sudo openssh-server rpcbind -y

View File

@ -21,7 +21,7 @@ CACHED_FILE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
CACHED_FILE_LOCK=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE.lock
CACHED_SUMS=$DIB_IMAGE_CACHE/SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH
function get_ubuntu_tarball() {
function get_ubuntu_tarball {
if [ -n "$DIB_OFFLINE" -a -f "$CACHED_FILE" ] ; then
echo "Not checking freshness of cached $CACHED_FILE."
else