source: trunk/mondo/src/autorun @ 1074

Last change on this file since 1074 was 649, checked in by bcornec, 13 years ago

merge -r617:641 $SVN_M/branches/stable

  • Property svn:keywords set to Id
  • Property svn:unix-mode set to 755
  • Property unix-mode set to yes
File size: 1.7 KB
Line 
1#!/bin/sh
2#
3# Autorun script for mondorestore CD  -  Hugo Rabson
4#
5# 05/02
6# - support for non-KDE desktops
7#
8# 04/28/2003
9# - rewrite
10#
11# 11/??/2002
12# - first copy
13#
14# Based on autorun script for the Ark Development Suite
15# Copyright (c) 2002 Bernhard Rosenkraenzer <bero@arklinux.org>
16##################################################################
17
18
19
20
21InBkgd() {
22   cd /
23   sleep 1
24   umount $1 &> /dev/null
25   eject $2 &> /dev/null
26}
27
28
29run_command_as_root() {
30    local command fnam subcom
31
32    subcom="$1"
33    command="xterm -e $subcom"
34    if which kdesux &> /dev/null ; then
35        kdesu +sb -c "$command"
36    else
37        fnam=/tmp/$$.$RANDOM.sh
38        echo -en "echo -en \"\
39To run mondorestore, you need to be root.\n\
40Please enter root's password now to proceed,\n\
41or press <Ctrl>-C to abort installation.\n\"\n\
42su - -c $subcom\n" > $fnam
43        chmod +x $fnam
44        xterm -e "$fnam"
45        rm -f $fnam
46    fi
47}
48
49# ------------------------- main -------------------------
50
51if [ -d "`dirname $0`" ]; then
52    cd "`dirname $0`"
53fi
54
55q=`pwd`
56r=`mount | grep $q | tr -s ' ' '\t' | cut -f1`
57
58ps ax | grep mondoarchive | grep -v grep && exit 0
59ps ax | grep mondorestore | grep -v grep && exit 0
60
61mr=`which mondorestore`
62if [ ! "$mr" ] ; then
63    p=$q/usr
64    mr=`find $p -name mondorestore -type f | head -n1`
65    [ ! -x "$mr" ] && mr=`find /mnt/cdrom -name mondorestore -type f | head -n1`
66    if [ -x "$mr" ] ; then
67      old_mr=$mr
68      new_mr=/tmp/$RANDOM.$RANDOM.$RANDOM
69      cp -f $old_mr $new_mr
70      mr=$new_mr
71    fi
72fi
73if [ -x "$mr" ] ; then
74    ls `pwd`/archives/0.afio* && additional="--live-from-cd"
75    cd /
76    umount /mnt/cdrom
77    subcom="$mr $additional"
78    run_command_as_root "$subcom"
79fi
80[ "$new_mr" ] && rm -f $new_mr
81exit $?
Note: See TracBrowser for help on using the repository browser.