Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit eab24d8

Browse files
committed
Initial commit.
1 parent 5a92bfe commit eab24d8

File tree

8 files changed

+750
-0
lines changed

8 files changed

+750
-0
lines changed

COPYING

+339
Large diffs are not rendered by default.

bin/emrk-factory-reset

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/sh
2+
#
3+
# emrk-factory-reset: removes and optionally backups
4+
# config boot which reset the router to defaults
5+
#
6+
# Maintainer: Daniil Baturin <daniil at baturin dot org>
7+
#
8+
# Copyright (C) 2013 SO3Group
9+
#
10+
# This program is free software; you can redistribute it and/or modify
11+
# it under the terms of the GNU General Public License version 2 as
12+
# published by the Free Software Foundation.
13+
#
14+
# This program is distributed in the hope that it will be useful,
15+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
# GNU General Public License for more details.
18+
#
19+
# You should have received a copy of the GNU General Public License
20+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
#
22+
#
23+
24+
ROOT_MNT_DIR=/mnt/root
25+
CONFIG=/config/config.boot
26+
27+
echo "This script will remove your boot config"
28+
echo "so next time the system boots it will boot"
29+
echo "with factory default one"
30+
echo
31+
echo "Do you want to continue?"
32+
yesno
33+
34+
if [ $? != 0 ]; then
35+
exit 0
36+
fi
37+
38+
if [ ! -f $ROOT_MNT_DIR/$CONFIG ]; then
39+
echo "Config file not found!"
40+
exit 1
41+
fi
42+
43+
echo "Do you want to make a backup copy of your config?"
44+
yesno
45+
46+
if [ $? == 0 ]; then
47+
cp $ROOT_MNT_DIR/$CONFIG $ROOT_MNT_DIR/config.boot.emrk-backup
48+
echo "Saved a backup copy to /config/config.boot.emrk-backup"
49+
fi
50+
51+
rm -f $ROOT_MNT_DIR/$CONFIG
52+
53+
echo "Factory reset finished, you may reboot the router"

bin/yesno

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#! /bin/sh
2+
#
3+
# Module: yesno
4+
#
5+
# **** License ****
6+
# This program is free software; you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License version 2 as
8+
# published by the Free Software Foundation.
9+
#
10+
# This program is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# A copy of the GNU General Public License is available as
16+
# `/usr/share/common-licenses/GPL' in the Debian GNU/Linux distribution
17+
# or on the World Wide Web at `http://www.gnu.org/copyleft/gpl.html'.
18+
# You can also obtain it by writing to the Free Software Foundation,
19+
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
20+
# MA 02110-1301, USA.
21+
#
22+
# Copyright (C) 2013 SO3 Group
23+
#
24+
# This code was originally developed by Vyatta, Inc.
25+
# Portions created by Vyatta are Copyright (C) 2010 Vyatta, Inc.
26+
# All Rights Reserved.
27+
#
28+
# Author: Stephen Hemminger
29+
# Description: yes or no question script
30+
#
31+
# **** End License ****
32+
33+
default=
34+
if [ "$1" = "-y" ]; then
35+
default='y'
36+
shift
37+
elif [ "$1" = "-n" ]; then
38+
default='n'
39+
shift
40+
fi
41+
42+
if [ $# -eq 0 ]; then
43+
prompt="yes or no: "
44+
else
45+
prompt="$*"
46+
fi
47+
48+
while true; do
49+
read -p "$prompt" || exit 1
50+
if [ -z "$REPLY" -a ! -z "$default" ];then
51+
REPLY=$default
52+
fi
53+
case "$REPLY" in
54+
y*|Y*)
55+
exit 0
56+
;;
57+
n*|n*)
58+
exit 1
59+
;;
60+
*)
61+
echo "Answer yes or no please"
62+
;;
63+
esac
64+
done

etc/fstab

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#/dev/root / ext3 defaults 0 0
2+
none /proc proc defaults 0 0
3+
#none /proc/bus/usb usbfs rw,nosuid,nodev,noexec 0 0
4+
none /dev/shm tmpfs defaults 0 0
5+
none /dev/pts devpts defaults 0 0
6+
none /sys sysfs defaults 0 0

etc/hosts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
127.0.0.1 localhost

0 commit comments

Comments
 (0)