| | |
| | | TAR_PATH=${PRJ_PATH}/../tarball |
| | | |
| | | # rootfs configuration |
| | | DEBIAN_URL=http://ftp.cn.debian.org/debian/ |
| | | ARCH=armhf |
| | | DEF_USER=lingyun |
| | | DEF_PASSWD=12345 |
| | |
| | | export LANG=C |
| | | |
| | | printf "\n\n -- debootstrap fetch start --\n\n" |
| | | echo "debootstrap --arch=${ARCH} --foreign ${DISTRO} ${ROOTFS_DIR} http://ftp.cn.debian.org/debian/" |
| | | debootstrap --arch=${ARCH} --foreign ${DISTRO} ${ROOTFS_DIR} http://ftp.cn.debian.org/debian/ |
| | | echo "debootstrap --arch=${ARCH} --foreign ${DISTRO} ${ROOTFS_DIR} ${DEBIAN_URL}" |
| | | debootstrap --arch=${ARCH} --foreign ${DISTRO} ${ROOTFS_DIR} ${DEBIAN_URL} |
| | | |
| | | chroot ${ROOTFS_DIR} debootstrap/debootstrap --second-stage |
| | | printf "\n\n -- debootstrap config start --\n\n" |
| | |
| | | |
| | | # Clear the MD5 value to install extra apps |
| | | sed -i -e "s|.*md5apt.*|\t\"md5apt\":\"MD5_Auto_Generate_Here\"|g" $APPS_CONF |
| | | |
| | | cd ${ROOTFS_DIR} |
| | | tar -cjf ../${ROOTFS_DIR}.orig.tar.bz2 * |
| | | cd - |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | chroot ${ROOTFS_DIR} apt update |
| | | chroot ${ROOTFS_DIR} apt install -y ${extra_apps} |
| | | chroot ${ROOTFS_DIR} apt autoremove |
| | | |
| | | umount ${ROOTFS_DIR}/{sys,proc,dev/pts,dev} |
| | | |
| | |
| | | # modify root password |
| | | chroot ${ROOTFS_DIR} sh -c "echo root:${DEF_PASSWD} | chpasswd" |
| | | |
| | | # add extra user account |
| | | # add default user account |
| | | set +e |
| | | grep "$DEF_USER" ${ROOTFS_DIR}/etc/passwd > /dev/null 2>&1 |
| | | if [ $? != 0 ] ; then |
| | | printf "\n\n -- setup default user account --\n\n" |
| | | chroot ${ROOTFS_DIR} sh -c "useradd -m -s /bin/bash ${DEF_USER}" |
| | | chroot ${ROOTFS_DIR} sh -c "echo ${DEF_USER}:${DEF_PASSWD} | chpasswd" |
| | | chroot ${ROOTFS_DIR} sh -c "usermod -G video,audio,sudo avnet" |
| | | echo "${DEF_USER} ALL=(ALL:ALL) NOPASSWD:ALL" >> ${ROOTFS_DIR}/etc/sudoers |
| | | chroot ${ROOTFS_DIR} sh -c "usermod -aG video,audio,sudo ${DEF_USER}" |
| | | fi |
| | | set -e |
| | | } |
| | |
| | | # update profile |
| | | sed -i "s|PS1='# '|PS1='\\\u@\\\h:\\\w# '|g" ${ROOTFS_DIR}/etc/profile |
| | | sed -i "s|PS1='$ '|PS1='\\\u@\\\h:\\\w$ '|g" ${ROOTFS_DIR}/etc/profile |
| | | |
| | | sed -i 's|PATH=.*|PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"|g' ${ROOTFS_DIR}/etc/profile |
| | | |
| | | # add ls alias for display with color |
| | | grep "^alias ls=" ${ROOTFS_DIR}/etc/profile > /dev/null 2>&1 |
| | |
| | | echo "alias ls='ls --color=auto'" >> ${ROOTFS_DIR}/etc/profile |
| | | fi |
| | | |
| | | # update sudo without passwd for yocto and debian |
| | | if [ $SYSTEM != buildroot ] ; then |
| | | sed -i "s|^%sudo.*|%sudo ALL=(ALL:ALL) NOPASSWD:ALL|g" ${ROOTFS_DIR}/etc/sudoers |
| | | fi |
| | | |
| | | # permit root ssh login |
| | | sed -i "s|^#PermitRootLogin.*|PermitRootLogin yes|g" ${ROOTFS_DIR}/etc/ssh/sshd_config |
| | | sed -i "s|^#PasswordAuthentication.*|PasswordAuthentication yes|g" ${ROOTFS_DIR}/etc/ssh/sshd_config |