Changeset 667 for branches


Ignore:
Timestamp:
Apr 18, 2015, 1:51:17 AM (6 years ago)
Author:
ehem
Message:

Replace direct invocations of sudo, su and chroot with usage of the
appropriate variables. While not much more than a search and replace
operation, cleaning this up is an important precursor for subsequent
steps.

Location:
branches/contrib/debian
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/contrib/debian/buildenv/debian.mk

    r596 r667  
    1717
    1818SB2_ARCH:=$(call qstrip,$(CONFIG_ARCH))
    19 CHROOT:=sudo chroot $(DEBIAN_BUILD_DIR)
     19CHROOT:=$(SUROOT) chroot $(DEBIAN_BUILD_DIR)
    2020CHROOT_USER:=$(CHROOT) su - $(USER)
    21 SB2:=sudo chroot $(DEBIAN_BUILD_DIR) su - $(USER) -c bash -c "export LC_ALL=C; cd $(SB2_ARCH)-lenny && sb2"
    22 SB2E:=sudo chroot $(DEBIAN_BUILD_DIR) su - $(USER) -c bash -c "export LC_ALL=C; cd $(SB2_ARCH)-lenny && sb2 -e"
    23 SB2EF:=sudo chroot $(DEBIAN_BUILD_DIR) su - $(USER) -c bash -c "export LC_ALL=C; cd $(SB2_ARCH)-lenny && sb2 -eR"
     21SB2:=$(CHROOT_USER) -c bash -c "export LC_ALL=C; cd $(SB2_ARCH)-lenny && sb2"
     22SB2E:=$(CHROOT_USER) -c bash -c "export LC_ALL=C; cd $(SB2_ARCH)-lenny && sb2 -e"
     23SB2EF:=$(CHROOT_USER) -c bash -c "export LC_ALL=C; cd $(SB2_ARCH)-lenny && sb2 -eR"
    2424QEMU_BIN=$(DEBIAN_BUILD_DIR)/usr/local/bin/qemu-$(TARGET_ARCH)
    2525QEMU_BIN_STATIC=$(QEMU_BIN)-static
     
    4949        #fakeroot fakechroot debootstrap
    5050                                                #--variant=fakechroot
    51         sudo debootstrap    --include=$(subst $(space),$(empty),$(CONFIG_DEBIAN_BUILDENV_INCLUDE_PACKAGES)) \
     51        $(SUROOT) debootstrap    --include=$(subst $(space),$(empty),$(CONFIG_DEBIAN_BUILDENV_INCLUDE_PACKAGES)) \
    5252                                            $(DEBIAN_BUILD_VERSION) \
    5353                                                $(DEBIAN_BUILD_DIR) \
    5454                                                $(CONFIG_DEBIAN_BUILDENV_REPOSITORY)
    55         sudo bash -c "echo 127.0.0.1 `hostname -s` localhost >$(DEBIAN_BUILD_DIR)/etc/hosts"
    56         sudo bash -c "echo debwrt-$(TARGET_ARCH)-$(DEBIAN_BUILD_VERSION) > $(DEBIAN_BUILD_DIR)/etc/debian_chroot"
    57         sudo bash -c "echo syntax on >$(DEBIAN_BUILD_DIR)/etc/vimrc"
    58         sudo bash -c "echo 0 > /proc/sys/vm/mmap_min_addr" # for ARM targets
    59         sudo bash -c "echo \"deb $(call qstrip,$(CONFIG_DEBIAN_BUILDENV_REPOSITORY)) $(DEBIAN_BUILD_VERSION) main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
    60         sudo bash -c "echo \"deb-src $(call qstrip,$(CONFIG_DEBIAN_BUILDENV_REPOSITORY)) $(DEBIAN_BUILD_VERSION) main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
    61         sudo chown $(USER):$(GROUP) $(DEBIAN_BUILD_DIR)/usr/src
    62         sudo chroot $(DEBIAN_BUILD_DIR) apt-get update
    63         sudo chroot $(DEBIAN_BUILD_DIR) groupadd -g $(shell id -g) debwrt
    64         sudo chroot $(DEBIAN_BUILD_DIR) useradd -g debwrt -s /bin/bash -m -u $(shell id -u) $$USER
    65         sudo mkdir -p $(DEBIAN_BUILD_DIR)/etc/sudoers.d
    66         sudo bash -c "echo \"$(USER) ALL=(ALL) NOPASSWD: ALL\" >$(DEBIAN_BUILD_DIR)/etc/sudoers.d/debwrt"
    67         sudo chmod 0440 $(DEBIAN_BUILD_DIR)/etc/sudoers.d/debwrt
     55        $(SUROOT) bash -c "echo 127.0.0.1 `hostname -s` localhost >$(DEBIAN_BUILD_DIR)/etc/hosts"
     56        $(SUROOT) bash -c "echo debwrt-$(TARGET_ARCH)-$(DEBIAN_BUILD_VERSION) > $(DEBIAN_BUILD_DIR)/etc/debian_chroot"
     57        $(SUROOT) bash -c "echo syntax on >$(DEBIAN_BUILD_DIR)/etc/vimrc"
     58        $(SUROOT) bash -c "echo 0 > /proc/sys/vm/mmap_min_addr" # for ARM targets
     59        $(SUROOT) bash -c "echo \"deb $(call qstrip,$(CONFIG_DEBIAN_BUILDENV_REPOSITORY)) $(DEBIAN_BUILD_VERSION) main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
     60        $(SUROOT) bash -c "echo \"deb-src $(call qstrip,$(CONFIG_DEBIAN_BUILDENV_REPOSITORY)) $(DEBIAN_BUILD_VERSION) main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
     61        $(SUROOT) chown $(USER):$(GROUP) $(DEBIAN_BUILD_DIR)/usr/src
     62        $(CHROOT) apt-get update
     63        $(CHROOT) groupadd -g $(shell id -g) debwrt
     64        $(CHROOT) useradd -g debwrt -s /bin/bash -m -u $(shell id -u) $$USER
     65        $(SUROOT) mkdir -p $(DEBIAN_BUILD_DIR)/etc/sudoers.d
     66        $(SUROOT) bash -c "echo \"$(USER) ALL=(ALL) NOPASSWD: ALL\" >$(DEBIAN_BUILD_DIR)/etc/sudoers.d/debwrt"
     67        $(SUROOT) chmod 0440 $(DEBIAN_BUILD_DIR)/etc/sudoers.d/debwrt
    6868        touch $@
    6969
    7070debian/buildenv/prepare-sb2:
    71         sudo chroot $(DEBIAN_BUILD_DIR) bash -c "export LC_ALL=C; apt-get -y --force-yes install g++-4.3-$(SB2_ARCH)-linux-gnu libc6-dev-$(SB2_ARCH)-cross build-essential debootstrap fakeroot zlib1g-dev qemu-user scratchbox2 dh-make"
     71        $(CHROOT) bash -c "export LC_ALL=C; apt-get -y --force-yes install g++-4.3-$(SB2_ARCH)-linux-gnu libc6-dev-$(SB2_ARCH)-cross build-essential debootstrap fakeroot zlib1g-dev qemu-user scratchbox2 dh-make"
    7272        touch $@
    7373
     
    108108debian/buildenv/emdebian-prepare: debian/buildenv/prepare
    109109        @echo "I: Adding squeeze source incase Emdebiand squeeze is missing packages in wheezy or higher..."
    110         sudo bash -c "echo \"deb $(call qstrip,$(CONFIG_EMDEBIAN_BUILDENV_REPOSITORY)) $(EMDEBIAN_RELEASE) main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
    111         sudo bash -c "echo \"deb $(call qstrip,$(CONFIG_DEBIAN_BUILDENV_REPOSITORY)) squeeze main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
    112         sudo bash -c "echo \"deb-src $(call qstrip,$(CONFIG_DEBIAN_BUILDENV_REPOSITORY)) squeeze main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
     110        $(SUROOT) bash -c "echo \"deb $(call qstrip,$(CONFIG_EMDEBIAN_BUILDENV_REPOSITORY)) $(EMDEBIAN_RELEASE) main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
     111        $(SUROOT) bash -c "echo \"deb $(call qstrip,$(CONFIG_DEBIAN_BUILDENV_REPOSITORY)) squeeze main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
     112        $(SUROOT) bash -c "echo \"deb-src $(call qstrip,$(CONFIG_DEBIAN_BUILDENV_REPOSITORY)) squeeze main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
    113113        # Add lenny repo, just for apt-cross
    114         #sudo bash -c "echo \"deb  http://archive.debian.org/debian lenny main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
    115         #sudo bash -c "echo -e \"Package: *\nPin: release a=lenny\nPin-Priority: 200\" > $(DEBIAN_BUILD_DIR)/etc/apt/preferences"
    116         sudo chroot $(DEBIAN_BUILD_DIR) apt-get update
    117         #sudo chroot $(DEBIAN_BUILD_DIR) apt-get -y install apt-cross
    118         #sudo chroot $(DEBIAN_BUILD_DIR) apt-get -y install libmpfr1ldbl
    119         sudo chroot $(DEBIAN_BUILD_DIR) apt-get -y install emdebian-archive-keyring xapt dpkg-cross
    120         sudo chroot $(DEBIAN_BUILD_DIR) bash -c "export LC_ALL=C; apt-get -y --force-yes install build-essential dh-make debootstrap fakeroot zlib1g-dev openssh-client vim pkg-config dpatch libncurses5-dev devscripts subversion automake gcc-multilib g++-multilib quilt"
     114        #$(SUROOT) bash -c "echo \"deb  http://archive.debian.org/debian lenny main\" >> $(DEBIAN_BUILD_DIR)/etc/apt/sources.list"
     115        #$(SUROOT) bash -c "echo -e \"Package: *\nPin: release a=lenny\nPin-Priority: 200\" > $(DEBIAN_BUILD_DIR)/etc/apt/preferences"
     116        $(CHROOT) apt-get update
     117        #$(CHROOT) apt-get -y install apt-cross
     118        #$(CHROOT) apt-get -y install libmpfr1ldbl
     119        $(CHROOT) apt-get -y install emdebian-archive-keyring xapt dpkg-cross
     120        $(CHROOT) bash -c "export LC_ALL=C; apt-get -y --force-yes install build-essential dh-make debootstrap fakeroot zlib1g-dev openssh-client vim pkg-config dpatch libncurses5-dev devscripts subversion automake gcc-multilib g++-multilib quilt"
    121121ifeq ($(TARGET_ARCH),arm)
    122         sudo chroot $(DEBIAN_BUILD_DIR) bash -c "export LC_ALL=C; apt-get -y --force-yes install libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi gcc-4.3-arm-linux-gnu g++-4.4-arm-linux-gnueabi linux-kernel-headers-armel-cross"
     122        $(CHROOT) bash -c "export LC_ALL=C; apt-get -y --force-yes install libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi gcc-4.3-arm-linux-gnu g++-4.4-arm-linux-gnueabi linux-kernel-headers-armel-cross"
    123123else
    124         sudo chroot $(DEBIAN_BUILD_DIR) bash -c "export LC_ALL=C; apt-get -y --force-yes install libc6-$(TARGET_ARCH)-cross libc6-dev-$(TARGET_ARCH)-cross binutils-$(TARGET_ARCH)-linux-gnu gcc-4.3-$(TARGET_ARCH)-linux-gnu g++-4.3-$(TARGET_ARCH)-linux-gnu linux-kernel-headers-$(TARGET_ARCH)-cross"
     124        $(CHROOT) bash -c "export LC_ALL=C; apt-get -y --force-yes install libc6-$(TARGET_ARCH)-cross libc6-dev-$(TARGET_ARCH)-cross binutils-$(TARGET_ARCH)-linux-gnu gcc-4.3-$(TARGET_ARCH)-linux-gnu g++-4.3-$(TARGET_ARCH)-linux-gnu linux-kernel-headers-$(TARGET_ARCH)-cross"
    125125endif
    126126        touch $@
     
    150150
    151151debian/buildenv/scratchbox-prepare:
    152         sudo chroot $(DEBIAN_BUILD_DIR) su - $(USER) -c bash -c "mkdir -p $(SB2_ARCH)-lenny"
    153         sudo chroot $(DEBIAN_BUILD_DIR) su - $(USER) -c bash -c "cd $(SB2_ARCH)-lenny && sb2-init -c /usr/local/bin/qemu-$(SB2_ARCH) MIPS \"$(SB2_ARCH)-linux-gnu-gcc\""
    154         sudo chroot $(DEBIAN_BUILD_DIR) su - $(USER) -c bash -c "fakeroot /usr/sbin/debootstrap --include=file,iputils-ping,netbase,strace,vim,wget,tcpdump --variant=scratchbox --foreign --arch $(SB2_ARCH) lenny $(SB2_ARCH)-lenny/ $(CONFIG_DEBIAN_BUILDENV_REPOSITORY)"
    155         sudo chroot $(DEBIAN_BUILD_DIR) su - $(USER) -c bash -c  "cd $(SB2_ARCH)-lenny && sb2 -eR ./debootstrap/debootstrap --second-stage"
     152        $(CHROOT_USER) -c bash -c "mkdir -p $(SB2_ARCH)-lenny"
     153        $(CHROOT_USER) -c bash -c "cd $(SB2_ARCH)-lenny && sb2-init -c /usr/local/bin/qemu-$(SB2_ARCH) MIPS \"$(SB2_ARCH)-linux-gnu-gcc\""
     154        $(CHROOT_USER) -c bash -c "fakeroot /usr/sbin/debootstrap --include=file,iputils-ping,netbase,strace,vim,wget,tcpdump --variant=scratchbox --foreign --arch $(SB2_ARCH) lenny $(SB2_ARCH)-lenny/ $(CONFIG_DEBIAN_BUILDENV_REPOSITORY)"
     155        $(CHROOT_USER) -c bash -c  "cd $(SB2_ARCH)-lenny && sb2 -eR ./debootstrap/debootstrap --second-stage"
    156156
    157157debian/buildenv/clean: debian/buildenv/qemu-clean
    158158        # sudo should not be needed if fakechroot would have worked
    159         sudo rm -rf $(DEBIAN_BUILD_DIR)
     159        $(SUROOT) rm -rf $(DEBIAN_BUILD_DIR)
    160160        rm -f debian/buildenv/prepare
    161161        rm -f debian/buildenv/qemu-prepare
  • branches/contrib/debian/rootfs/debian.mk

    r621 r667  
    2323DEBIAN_ROOTFS_INCLUDE_PACKAGES_DEBIAN_VERSION:=$(wildcard debian/rootfs/include_packages.list.$(DEBIAN_BUILD_VERSION))
    2424
     25### temporary during work towards functioning fakeroot/fakechroot
     26CHROOT:=$(SUROOT) chroot $(ROOTFS_BUILD_DIR)
     27CHROOT_USER:=$(CHROOT) su - $(USER)
     28### temporary during work towards functioning fakeroot/fakechroot
     29
    2530define qemu-prepare
    2631        @if [ ! -x $(QEMU_BIN_STATIC) ]; then echo "E: can't find qemu ($(QEMU_BIN_STATIC))"; fi
    2732        @if [ ! -e /proc/sys/fs/binfmt_misc/qemu-$(TARGET_ARCH) ]; then echo "E: can't find binfmt_misc qemu-$(TARGET_ARCH) ( /proc/sys/fs/binfmt_misc/qemu-$(TARGET_ARCH)).\nE: install qemu-user-static, or\nE: disable second stage with qemu with menuconfig (DEBIAN_ROOTFS_QEMU_2ND_STAGE)."; fi
    2833        @if [ ! -x $(QEMU_BIN_STATIC) -o ! -e /proc/sys/fs/binfmt_misc/qemu-$(TARGET_ARCH) ]; then echo "E: abort - qemu not available in chroot"; exit 1; fi
    29         @if [ ! -e $(ROOTFS_BUILD_DIR)$(QEMU_INTERPRETER) ]; then sudo cp $(QEMU_BIN_STATIC) $(ROOTFS_BUILD_DIR)$(QEMU_INTERPRETER); fi
    30         @if ! sudo chroot $(ROOTFS_BUILD_DIR) /bin/ls >/dev/null; then echo "E: qemu can't execute binaries for $(TARGET_ARCH)"; echo "E: abort"; exit 1; fi
    31         @if ! (mount | grep -q $(ROOTFS_BUILD_DIR)/proc); then sudo chroot $(ROOTFS_BUILD_DIR) mount -t proc none /proc; fi
    32         @if ! (mount | grep -q $(ROOTFS_BUILD_DIR)/sys ); then sudo chroot $(ROOTFS_BUILD_DIR) mount -t sysfs none /sys; fi
     34        @if [ ! -e $(ROOTFS_BUILD_DIR)$(QEMU_INTERPRETER) ]; then $(SUROOT) cp $(QEMU_BIN_STATIC) $(ROOTFS_BUILD_DIR)$(QEMU_INTERPRETER); fi
     35        @if ! $(CHROOT) /bin/ls >/dev/null; then echo "E: qemu can't execute binaries for $(TARGET_ARCH)"; echo "E: abort"; exit 1; fi
     36        @if ! (mount | grep -q $(ROOTFS_BUILD_DIR)/proc); then $(CHROOT) mount -t proc none /proc; fi
     37        @if ! (mount | grep -q $(ROOTFS_BUILD_DIR)/sys ); then $(CHROOT) mount -t sysfs none /sys; fi
    3338        @mount
    3439endef
    3540
    3641define qemu-cleanup
    37         @if (mount | grep -q $(ROOTFS_BUILD_DIR)/proc); then sudo umount $(ROOTFS_BUILD_DIR)/proc; fi
    38         @if (mount | grep -q $(ROOTFS_BUILD_DIR)/sys ); then sudo umount $(ROOTFS_BUILD_DIR)/sys ; fi
    39         @sudo rm -f $(ROOTFS_BUILD_DIR)$(QEMU_INTERPRETER)
     42        @if (mount | grep -q $(ROOTFS_BUILD_DIR)/proc); then $(SUROOT) umount $(ROOTFS_BUILD_DIR)/proc; fi
     43        @if (mount | grep -q $(ROOTFS_BUILD_DIR)/sys ); then $(SUROOT) umount $(ROOTFS_BUILD_DIR)/sys ; fi
     44        @$(SUROOT) rm -f $(ROOTFS_BUILD_DIR)$(QEMU_INTERPRETER)
    4045endef
    4146
     
    5358chr:
    5459        $(call qemu-prepare)
    55         @sudo bash -c "echo "debwrt-$(TARGET_ARCH)" > $(ROOTFS_BUILD_DIR)/etc/debian_chroot"
    56         @sudo cp $(ROOTFS_BUILD_DIR)/etc/resolv.conf $(ROOTFS_BUILD_DIR)/etc/resolv.conf_debwrt
    57         @sudo bash -c "cat /etc/resolv.conf | grep nameserver >$(ROOTFS_BUILD_DIR)/etc/resolv.conf"
    58         @sudo chroot $(ROOTFS_BUILD_DIR)
    59         @sudo rm -f $(ROOTFS_BUILD_DIR)/etc/debian_chroot
    60         @sudo cp $(ROOTFS_BUILD_DIR)/etc/resolv.conf_debwrt $(ROOTFS_BUILD_DIR)/etc/resolv.conf
     60        @$(SUROOT) bash -c "echo "debwrt-$(TARGET_ARCH)" > $(ROOTFS_BUILD_DIR)/etc/debian_chroot"
     61        @$(SUROOT) cp $(ROOTFS_BUILD_DIR)/etc/resolv.conf $(ROOTFS_BUILD_DIR)/etc/resolv.conf_debwrt
     62        @$(SUROOT) bash -c "cat /etc/resolv.conf | grep nameserver >$(ROOTFS_BUILD_DIR)/etc/resolv.conf"
     63        @$(CHROOT)
     64        @$(SUROOT) rm -f $(ROOTFS_BUILD_DIR)/etc/debian_chroot
     65        @$(SUROOT) cp $(ROOTFS_BUILD_DIR)/etc/resolv.conf_debwrt $(ROOTFS_BUILD_DIR)/etc/resolv.conf
    6166        $(call qemu-cleanup)
    6267
     
    8691debian/rootfs/install: debian/rootfs
    8792        if [ -d /media/DEBWRT_ROOT ]; then \
    88                 sudo rm -rf /media/DEBWRT_ROOT/*; \
    89                 sudo bash -c "tar cf - -C $(ROOTFS_BUILD_DIR) . | tar xf - -C /media/DEBWRT_ROOT"; \
     93                $(SUROOT) rm -rf /media/DEBWRT_ROOT/*; \
     94                $(SUROOT) bash -c "tar cf - -C $(ROOTFS_BUILD_DIR) . | tar xf - -C /media/DEBWRT_ROOT"; \
    9095        fi
    9196        #touch $@
     
    103108debian/rootfs/save:
    104109ifeq ($(DEBIAN_ROOTFS_QEMU_2ND_STAGE),y)
    105         sudo bash -c "tar cjf $(INSTALL_DIR)/$(ROOTFS_TAR_BZ2) -C $(ROOTFS_BUILD_DIR) ."
     110        $(SUROOT) bash -c "tar cjf $(INSTALL_DIR)/$(ROOTFS_TAR_BZ2) -C $(ROOTFS_BUILD_DIR) ."
    106111else
    107112        if [ -d /media/DEBWRT_ROOT ]; then \
    108                 sudo bash -c "tar cjf $(ROOTFS_TAR_BZ2) -C /media/DEBWRT_ROOT ."; \
     113                $(SUROOT) bash -c "tar cjf $(ROOTFS_TAR_BZ2) -C /media/DEBWRT_ROOT ."; \
    109114        fi
    110115endif
     
    112117debian/rootfs/files-install: debian/rootfs/bootstrap
    113118        if [ ! -f $(ROOTFS_BUILD_DIR)/etc/init.d/rcS.debian -a -e $(ROOTFS_BUILD_DIR)/etc/init.d/rcS ]; then \
    114                 sudo mv -v $(ROOTFS_BUILD_DIR)/etc/init.d/rcS $(ROOTFS_BUILD_DIR)/etc/init.d/rcS.debian; \
     119                $(SUROOT) mv -v $(ROOTFS_BUILD_DIR)/etc/init.d/rcS $(ROOTFS_BUILD_DIR)/etc/init.d/rcS.debian; \
    115120        fi
    116121        if [ ! -p $(ROOTFS_BUILD_DIR)/dev/initctl ]; then  \
    117                 sudo mkdir -p $(ROOTFS_BUILD_DIR)/dev;         \
    118                 sudo mkfifo   $(ROOTFS_BUILD_DIR)/dev/initctl; \
     122                $(SUROOT) mkdir -p $(ROOTFS_BUILD_DIR)/dev;         \
     123                $(SUROOT) mkfifo   $(ROOTFS_BUILD_DIR)/dev/initctl; \
    119124        fi
    120125        chmod 600 $(DEBWRT_EXTRA_ROOTFS_FILES_DIR)/etc/ssh/ssh_host_rsa_key
    121126        chmod 600 $(DEBWRT_EXTRA_ROOTFS_FILES_DIR)/etc/ssh/ssh_host_dsa_key
    122         sudo bash -c "tar cf - --exclude=".svn" -C $(DEBWRT_EXTRA_ROOTFS_FILES_DIR) . | tar -xovf - -C $(ROOTFS_BUILD_DIR)"
    123         sudo cat $(ROOTFS_BUILD_DIR)/etc/securetty \
     127        $(SUROOT) bash -c "tar cf - --exclude=".svn" -C $(DEBWRT_EXTRA_ROOTFS_FILES_DIR) . | tar -xovf - -C $(ROOTFS_BUILD_DIR)"
     128        $(SUROOT) cat $(ROOTFS_BUILD_DIR)/etc/securetty \
    124129                $(TOPDIR)/debian/rootfs/securetty.tail \
    125130                >> $(TOPDIR)/securetty.temp
    126         sudo mv $(TOPDIR)/securetty.temp $(ROOTFS_BUILD_DIR)/etc/securetty
     131        $(SUROOT) mv    $(TOPDIR)/securetty.temp $(ROOTFS_BUILD_DIR)/etc/securetty
    127132        touch $@
    128133
    129134debian/rootfs/modules-install: debian/rootfs/bootstrap
    130135ifneq ($(DEBWRT_MODULES_ARCHIVE),)
    131         sudo tar xof $(DEBWRT_MODULES_ARCHIVE) -C $(ROOTFS_BUILD_DIR)
    132         #sudo depmod -a -b $(ROOTFS_BUILD_DIR) $(MODULES_VERSION)
     136        $(SUROOT) tar xof $(DEBWRT_MODULES_ARCHIVE) -C $(ROOTFS_BUILD_DIR)
     137        #$(SUROOT) depmod -a -b $(ROOTFS_BUILD_DIR) $(MODULES_VERSION)
    133138else
    134139        @echo "W: Can't install kernel module to the change root. Kernel modules archive missing. ($(DEBWRT_MODULES_ARCHIVE))"
     
    139144#          list(DEBWRT_ROOTFS_PKGLST_DEPS) is managed in debian/package-host/debian.mk.
    140145debian/rootfs/bootstrap: debian/rootfs/clean-rootfs-dir
    141         sudo debootstrap --arch=$(TARGET_ARCH)\
     146        $(SUROOT) debootstrap --arch=$(TARGET_ARCH)\
    142147                     --foreign \
    143148                     --include=$(call rootfs-package-list) \
     
    146151                     $(CONFIG_DEBIAN_BUILDENV_REPOSITORY)
    147152        # complete ROOTFS/dev/ with additional device files
    148         sudo bash -c "cd $(ROOTFS_BUILD_DIR)/dev ; /sbin/MAKEDEV -v consoleonly"
    149         sudo bash -c "cd $(ROOTFS_BUILD_DIR)/dev ; /sbin/MAKEDEV -v sda"
     153        $(SUROOT) bash -c "cd $(ROOTFS_BUILD_DIR)/dev ; /sbin/MAKEDEV -v consoleonly"
     154        $(SUROOT) bash -c "cd $(ROOTFS_BUILD_DIR)/dev ; /sbin/MAKEDEV -v sda"
    150155        touch $@
    151156
     
    154159                n=`basename $$deb`; \
    155160                echo -n "I: Extracting $${n}..."; \
    156                 sudo bash -c "dpkg --extract "$$deb" $(ROOTFS_BUILD_DIR)" ; \
     161                $(SUROOT) bash -c "dpkg --extract "$$deb" $(ROOTFS_BUILD_DIR)" ; \
    157162                echo "done"; \
    158163        done
     
    165170                pname=`echo $$pfname | sed 's/_.*//'`; \
    166171                echo "Installing DebWrt package: $$pname"; \
    167                 sudo cp $$package $(ROOTFS_BUILD_DIR)/var/cache/apt/archives; \
    168                 sudo dpkg-deb -x $$package $(ROOTFS_BUILD_DIR); \
    169                 sudo bash -c "echo \"$$pname /var/cache/apt/archives/$$pfname\" >>$(ROOTFS_BUILD_DIR)/debootstrap/debpaths" ;\
    170                 sudo sed -i "s/$$/$$pname /" $(ROOTFS_BUILD_DIR)/debootstrap/base ;\
     172                $(SUROOT) cp $$package $(ROOTFS_BUILD_DIR)/var/cache/apt/archives; \
     173                $(SUROOT) dpkg-deb -x $$package $(ROOTFS_BUILD_DIR); \
     174                $(SUROOT) bash -c "echo \"$$pname /var/cache/apt/archives/$$pfname\" >>$(ROOTFS_BUILD_DIR)/debootstrap/debpaths" ;\
     175                $(SUROOT) sed -i "s/$$/$$pname /" $(ROOTFS_BUILD_DIR)/debootstrap/base ;\
    171176        done
    172177        touch $@
     
    174179debian/rootfs/clean-rootfs-dir:
    175180        mkdir -p $(BUILD_DIR_BASE)
    176         sudo rm -rf $(ROOTFS_BUILD_DIR)
     181        $(SUROOT) rm -rf $(ROOTFS_BUILD_DIR)
    177182        touch $@
    178183
    179184debian/rootfs/post-setup: debian/rootfs/bootstrap
    180         sudo mkdir -p $(ROOTFS_BUILD_DIR)/etc/apt
     185        $(SUROOT) mkdir -p $(ROOTFS_BUILD_DIR)/etc/apt
    181186        # note: unfortunately /etc/apt/sources.list is cleaned after running second stage install
    182         sudo bash -c "echo \"deb http://ftp.debian.org/debian $(DEBIAN_BUILD_VERSION) main\" > $(ROOTFS_BUILD_DIR)/etc/apt/sources.list"
    183         sudo bash -c "echo \"$(DEBWRTVERSION)\" >$(ROOTFS_BUILD_DIR)/etc/debwrt_version"
    184         sudo bash -c "echo \"$(DEBIAN_BUILD_VERSION)\" >$(ROOTFS_BUILD_DIR)/etc/debian_release"
     187        $(SUROOT) bash -c "echo \"deb http://ftp.debian.org/debian $(DEBIAN_BUILD_VERSION) main\" > $(ROOTFS_BUILD_DIR)/etc/apt/sources.list"
     188        $(SUROOT) bash -c "echo \"$(DEBWRTVERSION)\" >$(ROOTFS_BUILD_DIR)/etc/debwrt_version"
     189        $(SUROOT) bash -c "echo \"$(DEBIAN_BUILD_VERSION)\" >$(ROOTFS_BUILD_DIR)/etc/debian_release"
    185190        touch $@
    186191
     
    188193debian/rootfs/second-stage-qemu: debian/rootfs/bootstrap debian/buildenv/qemu-build
    189194        $(call qemu-prepare)
    190         sudo chroot $(ROOTFS_BUILD_DIR) /usr/sbin/PostInstall && sudo rm -f $(ROOTFS_BUILD_DIR)/usr/sbin/PostInstall
     195        $(CHROOT) /usr/sbin/PostInstall && $(SUROOT) rm -f $(ROOTFS_BUILD_DIR)/usr/sbin/PostInstall
    191196        $(call qemu-cleanup)
    192197else
     
    198203
    199204debian/rootfs/clean:
    200         sudo rm -rf $(ROOTFS_BUILD_DIR)
     205        $(SUROOT) rm -rf $(ROOTFS_BUILD_DIR)
    201206        rm -f debian/rootfs/debwrt-packages
    202207        rm -f debian/rootfs/bootstrap
Note: See TracChangeset for help on using the changeset viewer.