From 82f496ea505406df4119a52e7d77c8e8ca02a5c0 Mon Sep 17 00:00:00 2001 From: Robert Nelson <robertcnelson@gmail.com> Date: Thu, 22 Aug 2013 11:57:45 -0500 Subject: [PATCH] cleanup: drop chroot_no_sudo, just do not install it if chroot_very_small_image is selected Signed-off-by: Robert Nelson <robertcnelson@gmail.com> --- bare_image.sh | 2 -- base_image.sh | 2 -- build_image.sh | 2 -- scripts/chroot.sh | 8 ++++++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/bare_image.sh b/bare_image.sh index 10204a5ff..d6df7e24d 100755 --- a/bare_image.sh +++ b/bare_image.sh @@ -72,7 +72,6 @@ minimal_armel () { chroot_very_small_image="${chroot_very_small_image}" chroot_no_lsb_release="${chroot_no_lsb_release}" - chroot_no_sudo="${chroot_no_sudo}" chroot_rcnee_startup_scripts="${chroot_rcnee_startup_scripts}" chroot_ENABLE_DEB_SRC="${chroot_ENABLE_DEB_SRC}" chroot_KERNEL_HTTP_DIR="${chroot_KERNEL_HTTP_DIR}" @@ -148,7 +147,6 @@ is_debian () { exclude_pkgs_list="aptitude,aptitude-common,groff-base,info,install-info,libept1.4.12,manpages,man-db,tasksel,tasksel-data,vim-common,vim-tiny,wget,whiptail" chroot_very_small_image="enable" chroot_no_lsb_release="Debian" - chroot_no_sudo="enable" } #13.04 diff --git a/base_image.sh b/base_image.sh index 29c5c5461..6b91d2545 100755 --- a/base_image.sh +++ b/base_image.sh @@ -72,7 +72,6 @@ minimal_armel () { chroot_very_small_image="${chroot_very_small_image}" chroot_no_lsb_release="${chroot_no_lsb_release}" - chroot_no_sudo="${chroot_no_sudo}" chroot_rcnee_startup_scripts="${chroot_rcnee_startup_scripts}" chroot_ENABLE_DEB_SRC="${chroot_ENABLE_DEB_SRC}" chroot_KERNEL_HTTP_DIR="${chroot_KERNEL_HTTP_DIR}" @@ -148,7 +147,6 @@ is_debian () { exclude_pkgs_list="" # chroot_very_small_image="enable" # chroot_no_lsb_release="Debian" -# chroot_no_sudo="enable" } #13.04 diff --git a/build_image.sh b/build_image.sh index e782f8b4e..979933a6d 100755 --- a/build_image.sh +++ b/build_image.sh @@ -85,7 +85,6 @@ minimal_armel () { chroot_very_small_image="${chroot_very_small_image}" chroot_no_lsb_release="${chroot_no_lsb_release}" - chroot_no_sudo="${chroot_no_sudo}" chroot_rcnee_startup_scripts="${chroot_rcnee_startup_scripts}" chroot_ENABLE_DEB_SRC="${chroot_ENABLE_DEB_SRC}" chroot_KERNEL_HTTP_DIR="${chroot_KERNEL_HTTP_DIR}" @@ -197,7 +196,6 @@ is_debian () { exclude_pkgs_list="" # chroot_very_small_image="enable" # chroot_no_lsb_release="Debian" -# chroot_no_sudo="enable" } #12.10 diff --git a/scripts/chroot.sh b/scripts/chroot.sh index da3371cef..56ede3d46 100755 --- a/scripts/chroot.sh +++ b/scripts/chroot.sh @@ -462,9 +462,11 @@ cat > ${DIR}/chroot_script.sh <<-__EOF__ groupadd admin || true default_groups="admin,adm,dialout,cdrom,floppy,audio,dip,video" - if [ "x${chroot_no_sudo}" = "x" ] ; then + if [ "x${chroot_very_small_image}" = "x" ] ; then packages="sudo" for pkg in \${packages} ; do check_n_install ; done + fi + if [ -f /etc/sudoers ] ; then echo "%admin ALL=(ALL) ALL" >>/etc/sudoers fi @@ -474,7 +476,9 @@ cat > ${DIR}/chroot_script.sh <<-__EOF__ case "\${distro}" in Debian) - usermod -aG sudo ${user_name} || true + if [ -f /etc/sudoers ] ; then + usermod -aG sudo ${user_name} || true + fi usermod -aG dialout ${user_name} || true passwd <<-EOF -- GitLab