#!/bin/sh # # Copyright (c) 2005 Canonical LTD # # Author: Matt Zimmerman # # 2006, Oliver Grawert # Vagrant Cascadian # 2007, Scott Balneaves # Oliver Grawert # 2008, Vagrant Cascadian # Oliver Grawert # Warren Togami # Eric Harrison # Scott Balneaves # 2010, Gideon Romm # 2012, Alkis Georgopoulos # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, you can find it on the World Wide # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301, USA. # usage() { cat <&1 >"$EXPORT" | grep -v ^# >&2 else UPDATE=1 fi # UPDATE is either set with -u or automatically when no hostnames are passed if [ -n "$UPDATE" ]; then if [ -z "$CHROOTS" ]; then BASE=${BASE:-"/opt/ltsp"} CHROOTS=$(list_chroots nfs) fi for chroot in $CHROOTS; do test -x "$BASE/$chroot/bin/true" || continue mkdir -p "$BASE/$chroot/etc/ssh" # Do the work once; next times, use cp if [ -z "$firstfile" ]; then firstfile="$BASE/$chroot/etc/ssh/ssh_known_hosts" echo '# ssh keys for LTSP' > "$firstfile" for key in $(find /etc/ssh/ -type f -name 'ssh_host_*_key.pub'); do sed 's/^/server /' "$key" >> "$firstfile" done for file in $(find /etc/ltsp/ -type f -name 'ssh_known_hosts.*') ; do cat "$file" >> "$firstfile" done else cp "$firstfile" "$BASE/$chroot/etc/ssh/ssh_known_hosts" fi done if [ -z "$firstfile" ]; then die "No LTSP chroots found, please run ltsp-build-client" fi fi