install_initramfs
        Installs a file or creates a directory

install_alt_initramfs
        Installs a file from either
          ${PTXDIST_WORKSPACE}/initramfs/...
        or
          ${PTXDIST_TOPDIR}/generic/initramfs/...

install_initramfs_link
        Creates a symbolic link

install_initramfs_node
        Creates a device node

Signed-off-by: Jon Ringle <[email protected]>
---
 rules/post/install.make |  127 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 127 insertions(+), 0 deletions(-)

diff --git a/rules/post/install.make b/rules/post/install.make
index 3a86afe..8b2261f 100644
--- a/rules/post/install.make
+++ b/rules/post/install.make
@@ -180,6 +180,133 @@ install_alternative =                                     
                                \
        echo "f:$$FILE:$$OWN:$$GRP:$$PER" >> $(STATEDIR)/$$PACKET.perms;
 
 #
+# install_initramfs
+#
+# Installs a file with user/group ownership and permissions via
+# initramfs.
+#
+# $1: packet label (not used)
+# $2: UID
+# $3: GID
+# $4: permissions (octal)
+# $5: source file
+# $6: dest file
+#
+install_initramfs =                                                            
                \
+       PACKET=$(strip $(1));                                                   
                \
+       OWN=$(strip $(2));                                                      
                \
+       GRP=$(strip $(3));                                                      
                \
+       PER=$(strip $(4));                                                      
                \
+       SRC=$(strip $(5));                                                      
                \
+       DST=$(strip $(6));                                                      
                \
+       PKG_PKGDIR="$(PKGDIR)/$($(PTX_MAP_TO_PACKAGE_$(notdir $(basename 
$(basename $@)))))";   \
+                                                                               
                \
+       if [ "$$SRC" = "-" ]; then                                              
                \
+               SRC=$${PKG_PKGDIR}/$$DST;                                       
                \
+       fi;                                                                     
                \
+                                                                               
                \
+       if [ -z "$(6)" ]; then                                                  
                \
+               echo "install_initramfs:";                                      
                \
+               echo "  dir=$$SRC";                                             
                \
+               echo "  owner=$$OWN";                                           
                \
+               echo "  group=$$GRP";                                           
                \
+               echo "  permissions=$$PER";                                     
                \
+               echo "dir $$SRC $$PER $$OWN $$GRP" >> $(KLIBC_CONTROL);         
                \
+       else                                                                    
                \
+               echo "install_initramfs:";                                      
                \
+               echo "  installing $$DST from $$SRC";                           
                \
+               echo "  owner=$$OWN";                                           
                \
+               echo "  group=$$GRP";                                           
                \
+               echo "  permissions=$$PER";                                     
                \
+               echo "file $$DST $$SRC $$PER $$OWN $$GRP" >> $(KLIBC_CONTROL);  
                \
+       fi;
+
+#
+# install_alt_initramfs
+#
+# Installs a file with user/group ownership and permissions via
+# initramfs.
+#
+# This macro first looks in $(PTXDIST_WORKSPACE)/initramfs for the file to 
copy and then
+# in $(PTXDIST_TOPDIR)/generic/initramfs and installs the file under $(ROOTDIR)
+#
+# $1: packet label (not used)
+# $2: UID
+# $3: GID
+# $4: permissions (octal)
+# $5: source file
+#
+install_alt_initramfs =                                                        
                \
+       PACKET=$(strip $(1));                                                   
        \
+       OWN=$(strip $(2));                                                      
        \
+       GRP=$(strip $(3));                                                      
        \
+       PER=$(strip $(4));                                                      
        \
+       FILE=$(strip $(5));                                                     
        \
+       if [ -f $(PTXDIST_WORKSPACE)/initramfs$$FILE$(PTXDIST_PLATFORMSUFFIX) 
]; then   \
+               
SRC=$(PTXDIST_WORKSPACE)/initramfs$$FILE$(PTXDIST_PLATFORMSUFFIX);      \
+       elif [ -f $(PTXDIST_WORKSPACE)/initramfs$$FILE ]; then                  
        \
+               SRC=$(PTXDIST_WORKSPACE)/initramfs$$FILE;                       
        \
+       else                                                                    
        \
+               SRC=$(PTXDIST_TOPDIR)/generic/initramfs$$FILE;                  
        \
+       fi;                                                                     
        \
+       echo "install_alt_initramfs:";                                          
        \
+       echo "  installing $$FILE from $$SRC";                                  
        \
+       echo "  owner=$$OWN";                                                   
        \
+       echo "  group=$$GRP";                                                   
        \
+       echo "  permissions=$$PER";                                             
        \
+       echo "file $$FILE $$SRC $$PER $$OWN $$GRP" >> $(KLIBC_CONTROL);
+
+#
+# install_initramfs_link
+#
+# Installs a soft link in initramfs
+#
+# $1: packet label (not used)
+# $2: source
+# $3: destination
+# slink <name> <target> <mode> <uid> <gid>
+#
+install_initramfs_link =                                                       
\
+       PACKET=$(strip $(1));                                                   
\
+       SRC=$(strip $(2));                                                      
\
+       DST=$(strip $(3));                                                      
\
+       echo "install_initramfs_link: src=$$SRC dst=$$DST ";                    
\
+       echo "slink $$SRC $$DST 0755 0 0" >> $(KLIBC_CONTROL);
+
+#
+# install_initramfs_node
+#
+# Installs a device node via initramfs
+#
+# $1: packet label (not used)
+# $2: UID
+# $3: GID
+# $4: permissions (octal)
+# $5: type
+# $6: major
+# $7: minor
+# $8: device node name
+#
+install_initramfs_node =               \
+       PACKET=$(strip $(1));           \
+       OWN=$(strip $(2));              \
+       GRP=$(strip $(3));              \
+       PER=$(strip $(4));              \
+       TYP=$(strip $(5));              \
+       MAJ=$(strip $(6));              \
+       MIN=$(strip $(7));              \
+       DEV=$(strip $(8));              \
+       echo "install_initramfs_node:"; \
+       echo "  owner=$$OWN";           \
+       echo "  group=$$GRP";           \
+       echo "  permissions=$$PER";     \
+       echo "  type=$$TYP";            \
+       echo "  major=$$MAJ";           \
+       echo "  minor=$$MIN";           \
+       echo "  name=$$DEV";            \
+       echo "nod $$DEV $$PER $$OWN $$GRP $$TYP $$MAJ $$MIN" >> 
$(KLIBC_CONTROL);
+
+#
 # install_replace
 #
 # Replace placeholder with value in a previously
-- 
1.6.3.3.334.g916e1


--
ptxdist mailing list
[email protected]

Reply via email to