summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2013-11-02 20:34:02 +0100
committerDaniil Baturin <daniil@baturin.org>2013-11-02 20:34:02 +0100
commitc34fc7c364b2b78cdcbf7d213a459577b09bf663 (patch)
treeb199a351dfc9877f65653e024f3484aa26371942 /scripts
parent23eb364b82fde5d46ef30469faf7a4faeb33582b (diff)
downloadvyatta-cfg-system-c34fc7c364b2b78cdcbf7d213a459577b09bf663.tar.gz
vyatta-cfg-system-c34fc7c364b2b78cdcbf7d213a459577b09bf663.zip
Remove init-floppy script
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/init-floppy135
1 files changed, 0 insertions, 135 deletions
diff --git a/scripts/init-floppy b/scripts/init-floppy
deleted file mode 100755
index 1ae0d79b..00000000
--- a/scripts/init-floppy
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/bin/bash
-# **** License ****
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# 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.
-#
-# This code was originally developed by Vyatta, Inc.
-# Portions created by Vyatta are Copyright (C) 2007 Vyatta, Inc.
-# All Rights Reserved.
-#
-# Author: Robert Bays <robert@vyatta.com>
-# **** End License ****
-
-shopt -s xpg_echo
-
-test -f /etc/default/vyatta && \
- source /etc/default/vyatta
-: ${vyatta_sbindir:=/opt/vyatta/sbin}
-: ${vyatta_sysconfdir:=/opt/vyatta/etc}
-
-if [ -n "$1" ]; then
- DRIVE=$1
-else
- DRIVE="/dev/fd0"
-fi
-
-failure ()
-{
- echo "$*"
- exit 1
-}
-
-# Look and see if we have a floppy drive
-if sed -n '/[0-9]\+ fd$/ { q 1 }' /proc/devices || [ ! -e $DRIVE ] ; then
- failure "No floppy device"
-fi
-
-echo "This will erase all data on floppy $DRIVE."
-read -p 'Continue (y/n)? [y] ' -n 1 -t 5 yorn
-
-if [[ "$yorn" == [nN]* ]] ; then
- echo
- exit 0
-fi
-
-fd=/media/floppy
-
-unbind_notice="\rUnbinding config from floppy...\c"
-unbind__error="\rError: Couldn't unbind ${vyatta_sysconfdir}/config."
-umount_notice="\rAttempting to unmount floppy...\c"
-umount__error="\rError: Couldn't unmount $DRIVE."
-format_notice="\rFormatting floppy $DRIVE... \c"
-format__error="\rPlease insert a floppy disk in $DRIVE and rerun."
-create_notice="\rCreating file system... \c"
-create__error="\rError: Couldn't create filesystem on floppy $DRIVE"
-mount__notice="\rMounting formatted floppy... \c"
-mount___error="\rError: Couldn't mount floppy $DRIVE to $fd"
-config_notice="\rSaving config... \c"
-config__error="\rError: Couldn't save config in $fd/config/config.boot"
-bind___notice="\rRedirecting config directory...\c"
-bind____error="\rError: redirect to floppy"
-saved__notice="\rYour configuration directory was saved to: $fd/config"
-
-mkdir -p $fd
-
-if grep -q "$DRIVE ${vyatta_sysconfdir}/config" /proc/mounts ; then
- echo "$unbind_notice"
- /bin/umount ${vyatta_sysconfdir}/config &>/dev/null || \
- failure $unbind__error
-fi
-
-if grep -q $DRIVE /proc/mounts ; then
- echo "$umount_notice"
- /bin/umount $fd &>/dev/null || \
- failure "$umount__error"
-fi
-
-echo "$format_notice"
-/usr/sbin/fdformat -n $DRIVE &>/dev/null || \
- failure "$format__error"
-
-echo "$create_notice"
-/sbin/mke2fs -q $DRIVE &>/dev/null || \
- failure "$create__error"
-
-echo "$mount__notice"
-/bin/mount /dev/fd0 $fd -t ext2 -o sync,noatime,noexec,nosuid,nodev &>/dev/null || \
- failure "$mount___error"
-
-#
-# Check to make sure we have enough space to copy the config dir
-#
-fd_space_avail=`df -k $fd | tail -1 | awk '{ print $4 }'`
-space_needed=`du -s ${vyatta_sysconfdir}/config | awk '{ print $1 }'`
-
-if [ $fd_space_avail -gt $space_needed ]; then
- echo "$config_notice"
- /bin/mkdir $fd/config
- /usr/bin/find ${vyatta_sysconfdir}/config -maxdepth 1 -mindepth 1 \
- -exec /bin/cp '-a' '{}' "$fd/config" ';'
- /bin/chgrp -R vyattacfg $fd/config
- /bin/chmod -R 775 $fd/config
-else
- echo 'Not enough space to save current configuration directory'
- failure "$config__error"
-fi
-
-echo "$bind___notice"
-/bin/mount -o bind $fd/config ${vyatta_sysconfdir}/config &>/dev/null || \
- failure "$bind____error"
-# also, bind mount config directory to /config
-/bin/mkdir -p /config
-/bin/mount -o bind $fd/config /config &>/dev/null || \
- failure "$bind____error"
-
-echo "$saved__notice"
-
-if cli-shell-api existsActive system config-management commit-revisions ; then
- val=`cli-shell-api returnActiveValue \
- system config-management commit-revisions`
- if [ $? == "0" ] ; then
- ${vyatta_sbindir}/vyatta-config-mgmt.pl \
- --action=update-revs --revs=$val
- fi
-fi
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 4
-# End: