| 1 |
########################################################### |
|---|
| 2 |
# |
|---|
| 3 |
# adduser |
|---|
| 4 |
# |
|---|
| 5 |
########################################################### |
|---|
| 6 |
|
|---|
| 7 |
# You must replace "adduser" and "ADDUSER" with the lower case name and |
|---|
| 8 |
# upper case name of your new package. Some places below will say |
|---|
| 9 |
# "Do not change this" - that does not include this global change, |
|---|
| 10 |
# which must always be done to ensure we have unique names. |
|---|
| 11 |
|
|---|
| 12 |
# |
|---|
| 13 |
# ADDUSER_VERSION, ADDUSER_SITE and ADDUSER_SOURCE define |
|---|
| 14 |
# the upstream location of the source code for the package. |
|---|
| 15 |
# ADDUSER_DIR is the directory which is created when the source |
|---|
| 16 |
# archive is unpacked. |
|---|
| 17 |
# ADDUSER_UNZIP is the command used to unzip the source. |
|---|
| 18 |
# It is usually "zcat" (for .gz) or "bzcat" (for .bz2) |
|---|
| 19 |
# |
|---|
| 20 |
# You should change all these variables to suit your package. |
|---|
| 21 |
# Please make sure that you add a description, and that you |
|---|
| 22 |
# list all your packages' dependencies, seperated by commas. |
|---|
| 23 |
# |
|---|
| 24 |
# If you list yourself as MAINTAINER, please give a valid email |
|---|
| 25 |
# address, and indicate your irc nick if it cannot be easily deduced |
|---|
| 26 |
# from your name or email address. If you leave MAINTAINER set to |
|---|
| 27 |
# "NSLU2 Linux" other developers will feel free to edit. |
|---|
| 28 |
# |
|---|
| 29 |
ADDUSER_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com> |
|---|
| 30 |
ADDUSER_DESCRIPTION=a multi-call binary for login and user account administration |
|---|
| 31 |
ADDUSER_SECTION=core |
|---|
| 32 |
ADDUSER_PRIORITY=optional |
|---|
| 33 |
ADDUSER_DEPENDS= |
|---|
| 34 |
ADDUSER_SUGGESTS= |
|---|
| 35 |
ADDUSER_CONFLICTS= |
|---|
| 36 |
# The defconfig will need to be reviewed after changes in version of busybox. |
|---|
| 37 |
ADDUSER_VERSION:=$(shell sed -n -e 's/^BUSYBOX_VERSION *=\([0-9]\)/\1/p' make/busybox.mk) |
|---|
| 38 |
# |
|---|
| 39 |
# ADDUSER_IPK_VERSION should be incremented when the ipk changes. |
|---|
| 40 |
# |
|---|
| 41 |
ADDUSER_IPK_VERSION=1 |
|---|
| 42 |
|
|---|
| 43 |
# |
|---|
| 44 |
# ADDUSER_CONFFILES should be a list of user-editable files |
|---|
| 45 |
#ADDUSER_CONFFILES=/opt/etc/adduser.conf /opt/etc/init.d/SXXadduser |
|---|
| 46 |
|
|---|
| 47 |
# |
|---|
| 48 |
# ADDUSER_PATCHES should list any patches, in the the order in |
|---|
| 49 |
# which they should be applied to the source code. |
|---|
| 50 |
# |
|---|
| 51 |
ADDUSER_PATCHES=$(ADDUSER_SOURCE_DIR)/install.sh.patch |
|---|
| 52 |
|
|---|
| 53 |
# |
|---|
| 54 |
# If the compilation of the package requires additional |
|---|
| 55 |
# compilation or linking flags, then list them here. |
|---|
| 56 |
# |
|---|
| 57 |
ADDUSER_CPPFLAGS= |
|---|
| 58 |
ADDUSER_LDFLAGS= |
|---|
| 59 |
|
|---|
| 60 |
# |
|---|
| 61 |
# ADDUSER_BUILD_DIR is the directory in which the build is done. |
|---|
| 62 |
# ADDUSER_SOURCE_DIR is the directory which holds all the |
|---|
| 63 |
# patches and ipkg control files. |
|---|
| 64 |
# ADDUSER_IPK_DIR is the directory in which the ipk is built. |
|---|
| 65 |
# ADDUSER_IPK is the name of the resulting ipk files. |
|---|
| 66 |
# |
|---|
| 67 |
# You should not change any of these variables. |
|---|
| 68 |
# |
|---|
| 69 |
ADDUSER_BUILD_DIR=$(BUILD_DIR)/adduser |
|---|
| 70 |
ADDUSER_SOURCE_DIR=$(SOURCE_DIR)/adduser |
|---|
| 71 |
ADDUSER_IPK_DIR=$(BUILD_DIR)/adduser-$(ADDUSER_VERSION)-ipk |
|---|
| 72 |
ADDUSER_IPK=$(BUILD_DIR)/adduser_$(ADDUSER_VERSION)-$(ADDUSER_IPK_VERSION)_$(TARGET_ARCH).ipk |
|---|
| 73 |
|
|---|
| 74 |
# |
|---|
| 75 |
# This is the dependency on the source code. If the source is missing, |
|---|
| 76 |
# then it will be fetched from the site using wget. |
|---|
| 77 |
# |
|---|
| 78 |
#$(DL_DIR)/$(ADDUSER_SOURCE): |
|---|
| 79 |
# $(WGET) -P $(DL_DIR) $(ADDUSER_SITE)/$(ADDUSER_SOURCE) |
|---|
| 80 |
|
|---|
| 81 |
# |
|---|
| 82 |
# The source code depends on it existing within the download directory. |
|---|
| 83 |
# This target will be called by the top level Makefile to download the |
|---|
| 84 |
# source code's archive (.tar.gz, .bz2, etc.) |
|---|
| 85 |
# |
|---|
| 86 |
adduser-source: $(DL_DIR)/$(BUSYBOX_SOURCE) |
|---|
| 87 |
|
|---|
| 88 |
# |
|---|
| 89 |
# This target unpacks the source code in the build directory. |
|---|
| 90 |
# If the source archive is not .tar.gz or .tar.bz2, then you will need |
|---|
| 91 |
# to change the commands here. Patches to the source code are also |
|---|
| 92 |
# applied in this target as required. |
|---|
| 93 |
# |
|---|
| 94 |
# This target also configures the build within the build directory. |
|---|
| 95 |
# Flags such as LDFLAGS and CPPFLAGS should be passed into configure |
|---|
| 96 |
# and NOT $(MAKE) below. Passing it to configure causes configure to |
|---|
| 97 |
# correctly BUILD the Makefile with the right paths, where passing it |
|---|
| 98 |
# to Make causes it to override the default search paths of the compiler. |
|---|
| 99 |
# |
|---|
| 100 |
# If the compilation of the package requires other packages to be staged |
|---|
| 101 |
# first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage"). |
|---|
| 102 |
# |
|---|
| 103 |
$(ADDUSER_BUILD_DIR)/.configured: $(ADDUSER_SOURCE_DIR)/defconfig make/adduser.mk |
|---|
| 104 |
$(MAKE) $(DL_DIR)/$(BUSYBOX_SOURCE) |
|---|
| 105 |
rm -rf $(BUILD_DIR)/$(BUSYBOX_DIR) $(ADDUSER_BUILD_DIR) |
|---|
| 106 |
$(BUSYBOX_UNZIP) $(DL_DIR)/$(BUSYBOX_SOURCE) | tar -C $(BUILD_DIR) -xvf - |
|---|
| 107 |
cat $(ADDUSER_PATCHES) | patch -d $(BUILD_DIR)/$(BUSYBOX_DIR) -p1 |
|---|
| 108 |
mv $(BUILD_DIR)/$(BUSYBOX_DIR) $(ADDUSER_BUILD_DIR) |
|---|
| 109 |
cp $(ADDUSER_SOURCE_DIR)/defconfig $(ADDUSER_BUILD_DIR)/.config |
|---|
| 110 |
ifeq (module-init-tools, $(filter module-init-tools, $(PACKAGES))) |
|---|
| 111 |
ifneq ($(OPTWARE_TARGET), $(filter fsg3v4 syno-x07, $(OPTWARE_TARGET))) |
|---|
| 112 |
# default off, turn on if linux 2.6 |
|---|
| 113 |
sed -i -e "s/^.*CONFIG_MONOTONIC_SYSCALL.*/CONFIG_MONOTONIC_SYSCALL=y/" \ |
|---|
| 114 |
$(ADDUSER_BUILD_DIR)/.config |
|---|
| 115 |
endif |
|---|
| 116 |
endif |
|---|
| 117 |
sed -i -e 's/-strip /-$$(STRIP) /' $(ADDUSER_BUILD_DIR)/scripts/Makefile.IMA |
|---|
| 118 |
ifeq ($(OPTWARE_TARGET), $(filter ds101g, $(OPTWARE_TARGET))) |
|---|
| 119 |
sed -i -e '/sort-common/d; /sort-section/d' $(ADDUSER_BUILD_DIR)/scripts/trylink |
|---|
| 120 |
endif |
|---|
| 121 |
$(MAKE) HOSTCC=$(HOSTCC) CC=$(TARGET_CC) CROSS=$(TARGET_CROSS) \ |
|---|
| 122 |
-C $(ADDUSER_BUILD_DIR) oldconfig |
|---|
| 123 |
# -C $(ADDUSER_BUILD_DIR) menuconfig |
|---|
| 124 |
touch $@ |
|---|
| 125 |
|
|---|
| 126 |
adduser-unpack: $(ADDUSER_BUILD_DIR)/.configured |
|---|
| 127 |
|
|---|
| 128 |
# |
|---|
| 129 |
# This builds the actual binary. |
|---|
| 130 |
# |
|---|
| 131 |
$(ADDUSER_BUILD_DIR)/.built: $(ADDUSER_BUILD_DIR)/.configured |
|---|
| 132 |
rm -f $@ |
|---|
| 133 |
CPPFLAGS="$(STAGING_CPPFLAGS) $(ADDUSER_CPPFLAGS)" \ |
|---|
| 134 |
LDFLAGS="$(STAGING_LDFLAGS) $(ADDUSER_LDFLAGS)" \ |
|---|
| 135 |
$(BUSYBOX_BUILD_EXTRA_ENV) \ |
|---|
| 136 |
$(MAKE) CROSS="$(TARGET_CROSS)" PREFIX="/opt" \ |
|---|
| 137 |
HOSTCC=$(HOSTCC) CC=$(TARGET_CC) STRIP=$(TARGET_STRIP) \ |
|---|
| 138 |
EXTRA_CFLAGS="$(TARGET_CFLAGS) -fomit-frame-pointer" \ |
|---|
| 139 |
-C $(ADDUSER_BUILD_DIR) |
|---|
| 140 |
touch $@ |
|---|
| 141 |
|
|---|
| 142 |
# |
|---|
| 143 |
# This is the build convenience target. |
|---|
| 144 |
# |
|---|
| 145 |
adduser: $(ADDUSER_BUILD_DIR)/.built |
|---|
| 146 |
|
|---|
| 147 |
# |
|---|
| 148 |
# This rule creates a control file for ipkg. It is no longer |
|---|
| 149 |
# necessary to create a seperate control file under sources/adduser |
|---|
| 150 |
# |
|---|
| 151 |
$(ADDUSER_IPK_DIR)/CONTROL/control: |
|---|
| 152 |
@install -d $(@D) |
|---|
| 153 |
@rm -f $@ |
|---|
| 154 |
@echo "Package: adduser" >>$@ |
|---|
| 155 |
@echo "Architecture: $(TARGET_ARCH)" >>$@ |
|---|
| 156 |
@echo "Priority: $(ADDUSER_PRIORITY)" >>$@ |
|---|
| 157 |
@echo "Section: $(ADDUSER_SECTION)" >>$@ |
|---|
| 158 |
@echo "Version: $(ADDUSER_VERSION)-$(ADDUSER_IPK_VERSION)" >>$@ |
|---|
| 159 |
@echo "Maintainer: $(ADDUSER_MAINTAINER)" >>$@ |
|---|
| 160 |
@echo "Source: $(ADDUSER_SITE)/$(ADDUSER_SOURCE)" >>$@ |
|---|
| 161 |
@echo "Description: $(ADDUSER_DESCRIPTION)" >>$@ |
|---|
| 162 |
@echo "Depends: $(ADDUSER_DEPENDS)" >>$@ |
|---|
| 163 |
@echo "Suggests: $(ADDUSER_SUGGESTS)" >>$@ |
|---|
| 164 |
@echo "Conflicts: $(ADDUSER_CONFLICTS)" >>$@ |
|---|
| 165 |
# |
|---|
| 166 |
# This builds the IPK file. |
|---|
| 167 |
# |
|---|
| 168 |
# Binaries should be installed into $(ADDUSER_IPK_DIR)/opt/sbin or $(ADDUSER_IPK_DIR)/opt/bin |
|---|
| 169 |
# (use the location in a well-known Linux distro as a guide for choosing sbin or bin). |
|---|
| 170 |
# Libraries and include files should be installed into $(ADDUSER_IPK_DIR)/opt/{lib,include} |
|---|
| 171 |
# Configuration files should be installed in $(ADDUSER_IPK_DIR)/opt/etc/adduser/... |
|---|
| 172 |
# Documentation files should be installed in $(ADDUSER_IPK_DIR)/opt/doc/adduser/... |
|---|
| 173 |
# Daemon startup scripts should be installed in $(ADDUSER_IPK_DIR)/opt/etc/init.d/S??adduser |
|---|
| 174 |
# |
|---|
| 175 |
# You may need to patch your application to make it use these locations. |
|---|
| 176 |
# |
|---|
| 177 |
$(ADDUSER_IPK): $(ADDUSER_BUILD_DIR)/.built |
|---|
| 178 |
rm -rf $(ADDUSER_IPK_DIR) $(BUILD_DIR)/adduser_*_$(TARGET_ARCH).ipk |
|---|
| 179 |
install -d $(ADDUSER_IPK_DIR)/opt/bin |
|---|
| 180 |
install -m 755 $(ADDUSER_BUILD_DIR)/busybox $(ADDUSER_IPK_DIR)/opt/bin/adduser |
|---|
| 181 |
cd $(ADDUSER_IPK_DIR)/opt/bin && ln -fs adduser addgroup |
|---|
| 182 |
cd $(ADDUSER_IPK_DIR)/opt/bin && ln -fs adduser delgroup |
|---|
| 183 |
cd $(ADDUSER_IPK_DIR)/opt/bin && ln -fs adduser deluser |
|---|
| 184 |
cd $(ADDUSER_IPK_DIR)/opt/bin && ln -fs adduser adduser-su |
|---|
| 185 |
$(MAKE) $(ADDUSER_IPK_DIR)/CONTROL/control |
|---|
| 186 |
install -m 644 $(ADDUSER_SOURCE_DIR)/postinst $(ADDUSER_IPK_DIR)/CONTROL/postinst |
|---|
| 187 |
install -m 644 $(ADDUSER_SOURCE_DIR)/prerm $(ADDUSER_IPK_DIR)/CONTROL/prerm |
|---|
| 188 |
if test -n "$(UPD-ALT_PREFIX)"; then \ |
|---|
| 189 |
sed -i -e '/^[ ]*update-alternatives /s|update-alternatives|$(UPD-ALT_PREFIX)/bin/&|' \ |
|---|
| 190 |
$(ADDUSER_IPK_DIR)/CONTROL/postinst $(ADDUSER_IPK_DIR)/CONTROL/prerm; \ |
|---|
| 191 |
fi |
|---|
| 192 |
cd $(BUILD_DIR); $(IPKG_BUILD) $(ADDUSER_IPK_DIR) |
|---|
| 193 |
|
|---|
| 194 |
# |
|---|
| 195 |
# This is called from the top level makefile to create the IPK file. |
|---|
| 196 |
# |
|---|
| 197 |
adduser-ipk: $(ADDUSER_IPK) |
|---|
| 198 |
|
|---|
| 199 |
# |
|---|
| 200 |
# This is called from the top level makefile to clean all of the built files. |
|---|
| 201 |
# |
|---|
| 202 |
adduser-clean: |
|---|
| 203 |
-$(MAKE) -C $(ADDUSER_BUILD_DIR) clean |
|---|
| 204 |
|
|---|
| 205 |
# |
|---|
| 206 |
# This is called from the top level makefile to clean all dynamically created |
|---|
| 207 |
# directories. |
|---|
| 208 |
# |
|---|
| 209 |
adduser-dirclean: |
|---|
| 210 |
rm -rf $(BUILD_DIR)/$(BUSYBOX_DIR) $(ADDUSER_BUILD_DIR) $(ADDUSER_IPK_DIR) $(ADDUSER_IPK) |
|---|
| 211 |
|
|---|
| 212 |
# |
|---|
| 213 |
# Some sanity check for the package. |
|---|
| 214 |
# |
|---|
| 215 |
adduser-check: $(ADDUSER_IPK) |
|---|
| 216 |
perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^ |
|---|