From 51e9f9fa47b6c84c6c22bfdf540ab30e1f46bce5 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 22 Sep 2016 23:03:02 +0100 Subject: [PATCH] path --- src/freedombone-app-ipfs | 18 +++++----- src/freedombone-app-tox | 6 ++-- src/freedombone-image | 2 +- src/freedombone-image-customise | 60 ++++++++++++++++++--------------- 4 files changed, 46 insertions(+), 40 deletions(-) diff --git a/src/freedombone-app-ipfs b/src/freedombone-app-ipfs index 47ac6464..0a9b9a32 100755 --- a/src/freedombone-app-ipfs +++ b/src/freedombone-app-ipfs @@ -231,7 +231,7 @@ npm install -g ronin@${IPFS_JS_RONIN_VERSION} --save npm install -g ipfs@${IPFS_JS_VERSION} --save exit 0 EOF - chroot ${rootdir} chmod +x /root/install-ipfs.sh + chroot ${rootdir} /bin/chmod +x /root/install-ipfs.sh chroot ${rootdir} /root/install-ipfs.sh rm -f ${rootdir}/root/install-ipfs.sh @@ -243,17 +243,17 @@ EOF # directories to mount to if [ ! -d ${rootdir}/ipfs ]; then - chroot ${rootdir} mkdir /ipfs - chroot ${rootdir} mkdir /ipns - chroot ${rootdir} chown $MY_USERNAME:$MY_USERNAME /ipfs - chroot ${rootdir} chown $MY_USERNAME:$MY_USERNAME /ipns + chroot ${rootdir} /bin/mkdir /ipfs + chroot ${rootdir} /bin/mkdir /ipns + chroot ${rootdir} /bin/chown $MY_USERNAME:$MY_USERNAME /ipfs + chroot ${rootdir} /bin/chown $MY_USERNAME:$MY_USERNAME /ipns fi if [ -f ${rootdir}/etc/fuse.conf ]; then - chroot ${rootdir} chown $MY_USERNAME:$MY_USERNAME /etc/fuse.conf + chroot ${rootdir} /bin/chown $MY_USERNAME:$MY_USERNAME /etc/fuse.conf fi if [ -f ${rootdir}/dev/fuse ]; then - chroot ${rootdir} chown $MY_USERNAME:$MY_USERNAME /dev/fuse + chroot ${rootdir} /bin/chown $MY_USERNAME:$MY_USERNAME /dev/fuse fi IPFS_DAEMON_NAME=ipfs @@ -415,7 +415,7 @@ function mesh_install_ipfs_go { echo $"ipfs was not found in downloaded package" exit 638235 fi - chroot "$rootdir" cp $INSTALL_DIR/ipfs/go-ipfs/ipfs $IPFS_PATH + chroot "$rootdir" /bin/cp $INSTALL_DIR/ipfs/go-ipfs/ipfs $IPFS_PATH if [ ! -f $rootdir$IPFS_PATH/ipfs ]; then echo $'IPFS was not installed' exit 63722 @@ -434,7 +434,7 @@ function mesh_install_ipfs_go { echo '' >> $IPFS_USER_DAEMON echo '[Install]' >> $IPFS_USER_DAEMON echo 'WantedBy=default.target' >> $IPFS_USER_DAEMON - chroot ${rootdir} chown -R $MY_USERNAME:$MY_USERNAME /home/${MY_USERNAME}/.config + chroot ${rootdir} /bin/chown -R $MY_USERNAME:$MY_USERNAME /home/${MY_USERNAME}/.config } function install_ipfs_go { diff --git a/src/freedombone-app-tox b/src/freedombone-app-tox index 341945bf..942cb79c 100755 --- a/src/freedombone-app-tox +++ b/src/freedombone-app-tox @@ -465,8 +465,8 @@ EOF echo $"Toxcore compile $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed." if [ ${rootdir} ]; then - chroot ${rootdir} useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment $"Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd - chroot ${rootdir} chmod 700 /var/lib/tox-bootstrapd + chroot ${rootdir} /usr/sbin/useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment $"Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd + chroot ${rootdir} /bin/chmod 700 /var/lib/tox-bootstrapd else useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment $"Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd chmod 700 /var/lib/tox-bootstrapd @@ -641,7 +641,7 @@ function enable_tox_repo { echo 'deb http://download.opensuse.org/repositories/home:/antonbatenev:/tox/Debian_8.0/ /' > $rootdir/etc/apt/sources.list.d/tox.list - chroot "$rootdir" wget -q http://download.opensuse.org/repositories/home:antonbatenev:tox/Debian_8.0/Release.key -O- | apt-key add - + chroot "$rootdir" /usr/bin/wget -q http://download.opensuse.org/repositories/home:antonbatenev:tox/Debian_8.0/Release.key -O- | apt-key add - chroot "$rootdir" apt-get update echo "Tox Repository Installed." } diff --git a/src/freedombone-image b/src/freedombone-image index 9124e480..d2db9423 100755 --- a/src/freedombone-image +++ b/src/freedombone-image @@ -136,7 +136,7 @@ function image_setup { sudo pacman -S --noconfirm libc++ git gcc gcc-libs python-docutils mktorrent patch sudo pacman -S --noconfirm debootstrap xz dosfstools btrfs-progs syslinux python-pip sudo pacman -S --noconfirm qemu-static binfmt-qemu-static uboot-tools qemu parted - sudo pacman -S --noconfirm dpkg-devtools bin86 + sudo pacman -S --noconfirm dpkg-devtools bin86 arch-install-scripts mkdir ~/develop if [ ! -d ~/develop/python-cliapp ]; then git clone git://git.liw.fi/cliapp ~/develop/python-cliapp diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 182bb7e4..011e9b2c 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -118,18 +118,20 @@ ENABLE_ZERONET= MESH_TEXT_EDITOR='pluma' +PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin + function configure_backports { echo "deb http://${DEBIAN_REPO}/debian/ ${DEBIAN_VERSION}-backports main" >> $rootdir/etc/apt/sources.list } function configure_contrib_repo { if ! grep -q "contrib" $rootdir/etc/apt/sources.list; then - chroot "$rootdir" sed -i "s| main| main contrib|g" /etc/apt/sources.list + chroot "$rootdir" /bin/sed -i "s| main| main contrib|g" /etc/apt/sources.list fi } enable_eatmydata_override() { - chroot $rootdir apt-get install --no-install-recommends -y eatmydata + chroot $rootdir apt-get install -y eatmydata if [ -x $rootdir/usr/bin/eatmydata ] && \ [ ! -f $rootdir/etc/apt/apt.conf.d/95debian-edu-install-dpkg-eatmydata ]; then echo $"info: Adding apt config to call dpkg via eatmydata" @@ -269,7 +271,7 @@ configure_ssh() { mkdir $rootdir/home/$MY_USERNAME/.ssh fi echo "$SSH_PUBKEY" > $rootdir/home/$MY_USERNAME/.ssh/authorized_keys - chroot $rootdir chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh + chroot $rootdir /bin/chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh sed -i 's|PasswordAuthentication.*|PasswordAuthentication no|g' $rootdir/etc/ssh/sshd_config echo $"Using ssh public key:" echo $SSH_PUBKEY @@ -309,7 +311,7 @@ create_generic_image() { # The presence of this file indicates that the initial # setup has not yet been completed touch $rootdir/home/$MY_USERNAME/.initial_setup - chroot $rootdir chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.initial_setup + chroot $rootdir /bin/chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.initial_setup touch $rootdir/root/.initial_setup cat >> $rootdir/home/$MY_USERNAME/.bashrc <> $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop #echo 'StartupNotify=true' >> $rootdir/home/$MY_USERNAME/Desktop/terminal.desktop - chroot "$rootdir" chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop + chroot "$rootdir" /bin/chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop } function configure_user_interface { @@ -842,8 +844,8 @@ else fi fi EOF - chroot "$rootdir" chown $MY_USERNAME:$MY_USERNAME /usr/bin/list-tox-users - chroot "$rootdir" chmod +x /usr/bin/list-tox-users + chroot "$rootdir" /bin/chown $MY_USERNAME:$MY_USERNAME /usr/bin/list-tox-users + chroot "$rootdir" /bin/chmod +x /usr/bin/list-tox-users echo "* * * * * $MY_USERNAME bash -c /usr/bin/list-tox-users > /dev/null" >> $rootdir/etc/crontab if [[ $VARIANT != "usb" ]]; then @@ -874,7 +876,7 @@ EOF if [ -f $MESH_DESKTOP_BACKGROUND_IMAGE ]; then if [ -d $rootdir/usr/share/images/desktop-base ]; then cp $MESH_DESKTOP_BACKGROUND_IMAGE $rootdir/usr/share/images/desktop-base/${PROJECT_NAME}_mesh_background.png - chroot "$rootdir" rm /usr/share/images/desktop-base/desktop-background + chroot "$rootdir" /bin/rm /usr/share/images/desktop-base/desktop-background chroot "$rootdir" ln -s /usr/share/images/desktop-base/${PROJECT_NAME}_mesh_background.png /usr/share/images/desktop-base/desktop-background fi fi @@ -890,7 +892,7 @@ EOF mkdir -p $rootdir/home/${MY_USERNAME}/help/images cd $rootdir/root/${PROJECT_NAME}/website ./deploy.sh EN $rootdir/home/${MY_USERNAME}/help - chroot "$rootdir" chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/help + chroot "$rootdir" /bin/chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/help # Tox user interface enable_tox_repo @@ -899,7 +901,7 @@ EOF if [ ! -d ${rootdir}/home/${MY_USERNAME}/.config/tox ]; then mkdir ${rootdir}/home/${MY_USERNAME}/.config/tox cp /usr/local/bin/${PROJECT_NAME}-config-qtox ${rootdir}/home/${MY_USERNAME}/.config/tox/qtox.ini - chroot "$rootdir" chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.config + chroot "$rootdir" /bin/chown -R ${MY_USERNAME}:${MY_USERNAME} /home/${MY_USERNAME}/.config fi if [[ $VARIANT == "usb" ]]; then @@ -914,7 +916,7 @@ EOF chroot "$rootdir" mkdir /home/$GENERIC_IMAGE_USERNAME/.local/share/gajim/plugins -p chroot "$rootdir" git clone https://github.com/omemo/gajim-omemo /home/$GENERIC_IMAGE_USERNAME/.local/share/gajim/plugins/gajim-omemo chroot "$rootdir" pip install protobuf==2.6.1, python-axolotl==0.1.35 - chroot "$rootdir" chown -R $GENERIC_IMAGE_USERNAME:$GENERIC_IMAGE_USERNAME /home/$GENERIC_IMAGE_USERNAME/.local + chroot "$rootdir" /bin/chown -R $GENERIC_IMAGE_USERNAME:$GENERIC_IMAGE_USERNAME /home/$GENERIC_IMAGE_USERNAME/.local # IRC client chroot "$rootdir" apt-get -y install hexchat profanity @@ -948,22 +950,26 @@ fi username=$MY_USERNAME echo $"warning: creating initial user $username with well known password!" password=$MY_PASSWORD +chroot "$rootdir" /usr/bin/env -i \ + HOME=/root \ + PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin +echo "export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:" >> $rootdir/root/.bashrc chroot "$rootdir" adduser --gecos $username --disabled-password $username -echo $username:$password | chroot $rootdir /usr/sbin/chpasswd +echo $username:$password | chroot "$rootdir" /usr/sbin/chpasswd chroot "$rootdir" adduser $username sudo -case "$MACHINE" in - virtualbox) - # hide irrelevant console keyboard messages. - echo "echo \"4 4 1 7\" > /proc/sys/kernel/printk" \ - >> /etc/init.d/rc.local - ;; - qemu) - # hide irrelevant console keyboard messages. - echo "echo \"4 4 1 7\" > /proc/sys/kernel/printk" \ - >> /etc/init.d/rc.local - ;; -esac +#case "$MACHINE" in +# virtualbox) +# # hide irrelevant console keyboard messages. +# echo "echo \"4 4 1 7\" > /proc/sys/kernel/printk" \ +# >> /etc/init.d/rc.local +# ;; +# qemu) +# # hide irrelevant console keyboard messages. +# echo "echo \"4 4 1 7\" > /proc/sys/kernel/printk" \ +# >> /etc/init.d/rc.local +# ;; +#esac if [ ! $DEBIAN_REPO ]; then DEBIAN_REPO='ftp.de.debian.org' @@ -974,7 +980,7 @@ fi set_apt_sources $BUILD_MIRROR chroot "$rootdir" apt-get clean -chroot "$rootdir" rm -rf /var/lib/apt/lists/* +chroot "$rootdir" /bin/rm -rf /var/lib/apt/lists/* chroot "$rootdir" apt-get clean set_apt_sources $MIRROR configure_backports