File: crosshurd

package info (click to toggle)
crosshurd 1.7.57
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 200 kB
  • sloc: sh: 542; makefile: 2
file content (145 lines) | stat: -rwxr-xr-x 2,987 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/sh

#DEB_HOST_GNU_SYSTEM=`dpkg-architecture -qDEB_HOST_GNU_SYSTEM`
DEB_HOST_GNU_CPU=`dpkg-architecture -qDEB_HOST_GNU_CPU`
#DEB_HOST_GNU_TYPE=`dpkg-architecture -qDEB_HOST_GNU_TYPE`

usage() {
      echo "Usage: $0 [ -t path ] [ -s system ] [ -c cpu ] [ -d distrib ]"
      echo
      echo "  system is one of linux-gnu, gnu, or kfreebsd-gnu."
      echo "  cpu is a GNU CPU (e.g. i386 or x86_64)."
      echo "  distrib is a distribution name ((old)*stable, testing, unstable)."
}

while [ $# -ge 1 ]
do
  case $1 in
    -t)
      shift
      TARGET=$1
      if [ -z "$TARGET" ]
      then
	echo "-t needs a target path"
	exit 1
      fi
      shift;;
    -s)
      shift
      DEB_TARGET_GNU_SYSTEM=$1
      if [ -z "$DEB_TARGET_GNU_SYSTEM" ]
      then
	echo "-s needs a target system (linux-gnu, gnu or kfreebsd-gnu)"
	exit 1
      fi
      shift;;
    -c)
      shift
      DEB_TARGET_GNU_CPU=$1
      if [ -z "$DEB_TARGET_GNU_CPU" ]
      then
	echo "-c needs a target CPU (e.g. i386 or x86_64)"
	exit 1
      fi
      shift;;
    -d)
      shift
      RELEASE=$1
      if [ -z "$RELEASE" ]
      then
	echo "-d needs a distribution name ((old)*stable, testing, unstable)"
	exit 1
      fi
      shift;;
    -h|--help)
      usage
      exit 0
      ;;
    *)
      echo "Unrecognized: $1"
      usage
      exit 1
      ;;
  esac
done

if [ -z "$TARGET" ]
then
  exec 3>&1
  TARGET=`dialog --inputbox "What is the target directory?" 0 0 "/root/jail" 2>&1 1>&3`
  retval=$?
  exec 3>&-
  case $retval in
      0) ;;
      1|255) exit ;;
  esac
fi

if [ -z "$DEB_TARGET_GNU_SYSTEM" ]
then
  exec 3>&1
  DEB_TARGET_GNU_SYSTEM=`dialog --menu "Target Debian system?" 0 0 4 linux-gnu GNU/Linux gnu GNU/Hurd kfreebsd-gnu GNU/kFreeBSD 2>&1 1>&3`
  retval=$?
  exec 3>&-
  case $retval in
      0) ;;
      1|255) exit ;;
  esac
fi

if [ -z "$DEB_TARGET_GNU_CPU" ]
then
  [ "$DEB_TARGET_GNU_SYSTEM" = gnu ] && DEB_HOST_GNU_CPU=i386

  exec 3>&1
  DEB_TARGET_GNU_CPU=`dialog --inputbox "Target CPU?" 0 0 "$DEB_HOST_GNU_CPU" 2>&1 1>&3`
  retval=$?
  exec 3>&-
  case $retval in
      0) ;;
      1|255) exit ;;
  esac
fi

case $DEB_TARGET_GNU_SYSTEM in
  linux-gnu)
    ;;
  *)
    RELEASE=unstable
    ;;
esac

if [ -z "$RELEASE" ]
then
  exec 3>&1
  RELEASE=`dialog --menu "Target Debian distribution?" 0 0 4 oldoldstable Old-old-stable oldstable Old-stable stable Stable testing Testing unstable Unstable 2>&1 1>&3`
  retval=$?
  exec 3>&-
  case $retval in
      0) ;;
      1|255) exit ;;
  esac
fi

#if [ "$DEB_TARGET_GNU_SYSTEM" = "gnu" ] ; then
#	exec 3>&1
#	FOO=`dialog --defaultno --yesno "Create a /usr -> . symlink?" 0 0 2>&1 1>&3`
#	retval=$?
#	exec 3>&-
#	0 is yes, 1 is no
#	case $retval in
#	    0) ln -s . $TARGET/usr ;;
#	    1) ;;
#	    255) exit ;;
#	esac
#fi

if [ -f /usr/bin/eatmydata ]
then
  eatmydata=/usr/bin/eatmydata
else
  eatmydata=
fi

$eatmydata /usr/share/crosshurd/makehurddir.sh "$TARGET" "$DEB_TARGET_GNU_CPU" "$DEB_TARGET_GNU_SYSTEM" "$RELEASE"