| | |
| | | done |
| | | } |
| | | |
| | | |
| | | function update_debian() |
| | | { |
| | | if [ $SYSTEM != debian ] ; then |
| | | return; |
| | | fi |
| | | |
| | | # update PATH environment in /etc/profile |
| | | sed -i 's|PATH=.*|PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"|g' ${ROOTFS_DIR}/etc/profile |
| | | |
| | | # update sudo without passwd |
| | | sed -i "s|^%sudo.*|%sudo ALL=(ALL:ALL) NOPASSWD:ALL|g" ${ROOTFS_DIR}/etc/sudoers |
| | | |
| | | # enable ping command for all user |
| | | chmod 4755 ${ROOTFS_DIR}/usr/bin/ping* |
| | | } |
| | | |
| | | function do_modify() |
| | | { |
| | | msg_banner " modify rootfs environment" |
| | |
| | | # 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 |
| | | |
| | | update_debian |
| | | |
| | | # add vim alias for buildroot and yocto |
| | | if [ $SYSTEM != "debian" ] ; then |
| | | grep "alias vim=" ${ROOTFS_DIR}/etc/profile > /dev/null 2>&1 |