recipes: data/hierarchyfs: Set permissions for lock directory
[dragora.git] / recipes / data / hierarchyfs / recipe
blob96a62c454878c41f506d9a877be9d38692f2893a
1 # Build recipe for hierarchyfs.
3 # Copyright (c) 2017-2021 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
18 set -e
20 program=hierarchyfs
21 version=dragora
22 pkgversion=3.0
23 release=9
25 # Define a category for the output of the package name
26 pkgcategory=data
28 description="
29 Skeleton bases of Dragora GNU/Linux-Libre.
31 It contains the main hierarchy of directories, symlinks,
32 ownerships, and permissions for compose the basic structure
33 of the file system.
36 homepage=https://www.dragora.org
37 license=GPLv3+
39 build()
41     mkdir -p "$destdir"
42     cd "$destdir"
44     # Directories
46     mkdir -p \
47      usr/bin                   \
48      boot                      \
49      dev                       \
50      etc                       \
51      home                      \
52      lost+found                \
53      media                     \
54      mnt                       \
55      opt                       \
56      proc                      \
57      root                      \
58      run                       \
59      run/lock                  \
60      usr/sbin                  \
61      srv                       \
62      sys                       \
63      tmp                       \
64      usr                       \
65      var                       \
66      dev/pts                   \
67      etc/X11                   \
68      etc/opt                   \
69      etc/skel                  \
70      etc/xdg                   \
71      media/cdrecorder          \
72      media/cdrom               \
73      media/floppy              \
74      media/zip                 \
75      usr/bin                   \
76      usr/games                 \
77      usr/include               \
78      usr/lib/pkgconfig         \
79      usr/libexec               \
80      usr/local/bin             \
81      usr/local/etc             \
82      usr/local/games           \
83      usr/local/include         \
84      usr/local/lib/pkgconfig   \
85      usr/local/libexec         \
86      usr/local/sbin            \
87      usr/local/share/doc       \
88      usr/local/share/info      \
89      usr/local/share/man/man1  \
90      usr/local/share/man/man2  \
91      usr/local/share/man/man3  \
92      usr/local/share/man/man4  \
93      usr/local/share/man/man5  \
94      usr/local/share/man/man6  \
95      usr/local/share/man/man7  \
96      usr/local/share/man/man8  \
97      usr/local/src             \
98      usr/pkg                   \
99      usr/share/doc             \
100      usr/share/games           \
101      usr/share/info            \
102      usr/share/man/man1        \
103      usr/share/man/man2        \
104      usr/share/man/man3        \
105      usr/share/man/man4        \
106      usr/share/man/man5        \
107      usr/share/man/man6        \
108      usr/share/man/man7        \
109      usr/share/man/man8        \
110      usr/src                   \
111      var/cache/man             \
112      var/games                 \
113      var/lib                   \
114      var/local                 \
115      var/log                   \
116      var/mail                  \
117      var/opt                   \
118      var/spool/lpd             \
119      var/spool/news            \
120      var/tmp
122     # Copy local files
124     cp -p "${worktree}/archive/hierarchyfs/README.media" \
125           "media/README"
126     cp -p "${worktree}/archive/hierarchyfs/README.mnt" \
127           "mnt/README"
129     chmod 644 "media/README" "mnt/README"
131     # Copy files for the already created root account
132     cp -p "${worktree}"/archive/etc/skel/.*rc      \
133           "${worktree}"/archive/etc/skel/.profile  \
134           "${destdir}/root/"
136     touch \
137      "media/.graft-config" "mnt/.graft-config" "root/.graft-config"
139     # Manually include the post-install file for the package
141     mkdir -p "${destdir}/var/lib/qi"
143     cp -p "${CWD}/post-install.multidir" "${destdir}/var/lib/qi/${full_pkgname}.sh"
144     chmod 644 "${destdir}/var/lib/qi/${full_pkgname}.sh"
146     # Handle lib<equal> for the multi directory support
148     # Guess the suffix to compose the corresponding library directory
149     if test -f /tools/etc/stage1_is-multi-directory
150     then
151         libSuffix=$(cat /tools/etc/stage1_is-multi-directory)
152     fi
154     if test -n "$libSuffix"
155     then
156         echo "libSuffix detected."
157         echo "Changing value for post-install '${libSuffix}'"
159         sed -i s"/^libSuffix=X/libSuffix=${libSuffix}/" \
160          "${destdir}/var/lib/qi/${full_pkgname}.sh"
161     fi