summaryrefslogtreecommitdiff
path: root/core/pkgutils/pkgmk-permissions-test.patch.new
blob: 870f0f5593d0aee23342eb70d1046635d38cd843 (plain)
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
--- a/pkgmk.in	2017-03-01 20:04:24.792329517 +0100
+++ b/pkgmk.in	2017-03-01 20:09:20.608612750 +0100
@@ -103,9 +103,14 @@
 		error "File '$1' is not writable."
 		exit 1
 	fi
+	if [ ! -e $1 ]; then
+		check_directory `dirname $1`
+	fi
 }
 
 download_file() {
+	check_directory "$PKGMK_SOURCE_DIR"
+
 	info "Downloading '$1'."
 
 	PKGMK_DOWNLOAD_PROG=${PKGMK_DOWNLOAD_PROG:-wget}
@@ -631,10 +636,13 @@
 	local ORIG_FILE LOCAL_FILE srcind
 
 	if [ -f $TARGET ]; then
+		check_directory "$PKGMK_PACKAGE_DIR"
 		info "Removing $TARGET"
 		rm -f $TARGET
 	fi
 
+	check_directory "$PKGMK_SOURCE_DIR"
+
 	srcind=0
 	while [ $srcind -lt ${#source[@]} ]; do
 		ORIG_FILE="${source[$srcind]}"
@@ -652,7 +660,6 @@
 
 	check_file "$PKGMK_FOOTPRINT"
 	make_footprint > $PKGMK_FOOTPRINT
-	touch $TARGET
 
 	info "Footprint updated."
 }
@@ -822,10 +829,6 @@
 		. $FILE
 	done
 
-	check_directory "$PKGMK_SOURCE_DIR"
-	check_directory "$PKGMK_PACKAGE_DIR"
-	check_directory "`dirname $PKGMK_WORK_DIR`"
-
 	check_pkgfile
 
 	case $PKGMK_COMPRESSION_MODE in
@@ -878,6 +881,8 @@
 
 	if [ "$PKGMK_EXTRACT_ONLY" = "yes" ]; then
 		download_source
+		check_directory "$PKGMK_PACKAGE_DIR"
+		check_directory "`dirname $PKGMK_WORK_DIR`"
 		make_work_dir
 		info "Extracting sources of package '$name-$version'."
 		unpack_source
@@ -897,6 +902,8 @@
 		info "Package '$TARGET' is up to date."
 	else
 		download_source
+		check_directory "$PKGMK_PACKAGE_DIR"
+		check_directory "`dirname $PKGMK_WORK_DIR`"
 		build_package
 	fi