File: file

package info (click to toggle)
debian-installer-utils 1.155
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 944 kB
  • sloc: sh: 1,001; ansic: 160; makefile: 62
file content (19 lines) | stat: -rw-r--r-- 379 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
protocol_fetch() {
	local FILE="${1#file://*}"
	local media_mounted=
	local retval=1

	if [ "${FILE#/media/}" != "$FILE" ] && mountmedia; then
		media_mounted=1
	fi

	if [ ! -e "$FILE" ]; then
		retval=4
	elif cp "$FILE" $2; then
		# only if the file exists, and the cp succeeds, do we return 0
		retval=0
	fi

	[ -n "$media_mounted" ] && umount /media || true
	return $retval
}