Skip to content

Commit

Permalink
Changed a format for privileged users to UID:GID
Browse files Browse the repository at this point in the history
  • Loading branch information
meefik committed Jan 3, 2020
1 parent 95f7f2c commit cc09794
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 45 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ Help for the parameters of the main components:
--user-password="changeme"
Password will be assigned to the specified user.
--privileged-users="android messagebus"
A list of users separated by a space to be added to Android groups.
--privileged-users="android:aid_inet android:aid_media_rw"
A list of users in a format UID:GID separated by a space to be added UID to GID.
```

Expand Down
2 changes: 1 addition & 1 deletion cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
################################################################################

VERSION="2.5.0"
VERSION="2.5.1"

################################################################################
# Common
Expand Down
2 changes: 1 addition & 1 deletion include/bootstrap/archlinux/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pacman_install()
[ -n "${packages}" ] || return 1
(set -e
#rm -f ${CHROOT_DIR}/var/lib/pacman/db.lck || true
chroot_exec -u root pacman -Syq --overwrite --noconfirm ${packages}
chroot_exec -u root pacman -Syq --overwrite="*" --noconfirm ${packages}
rm -f "${CHROOT_DIR}"/var/cache/pacman/pkg/* || true
exit 0)
return $?
Expand Down
39 changes: 10 additions & 29 deletions include/bootstrap/fedora/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Linux Deploy Component
# (c) Anton Skshidlevsky <[email protected]>, GPLv3

[ -n "${SUITE}" ] || SUITE="28"
# 31 doesn't support while rpm2cpio in busybox doesn't support zstd
[ -n "${SUITE}" ] || SUITE="30"

if [ -z "${ARCH}" ]
then
Expand All @@ -14,45 +15,25 @@ then
esac
fi

[ -n "${SOURCE_PATH}" ] || SOURCE_PATH="http://dl.fedoraproject.org/pub/archive/"
[ -n "${SOURCE_PATH}" ] || SOURCE_PATH="http://dl.fedoraproject.org/pub/"

dnf_install()
{
local packages="$@"
[ -n "${packages}" ] || return 1
(set -e
chroot_exec -u root dnf --nogpgcheck -y install ${packages}
chroot_exec -u root dnf clean packages
chroot_exec -u root dnf -y install ${packages}
exit 0)
return $?
}

yum_repository()
{
find "${CHROOT_DIR}/etc/yum.repos.d/" -name '*.repo' | while read f; do sed -i 's/^enabled=.*/enabled=0/g' "${f}"; done
local repo_file="${CHROOT_DIR}/etc/yum.repos.d/fedora-${SUITE}-${ARCH}.repo"
local repo_url
if [ "${ARCH}" = "i386" ]
then repo_url="${SOURCE_PATH%/}/fedora-secondary/releases/${SUITE}/Everything/${ARCH}/os"
else repo_url="${SOURCE_PATH%/}/fedora/linux/releases/${SUITE}/Everything/${ARCH}/os"
fi
echo "[fedora-${SUITE}-${ARCH}]" > "${repo_file}"
echo "name=Fedora ${SUITE} - ${ARCH}" >> "${repo_file}"
echo "failovermethod=priority" >> "${repo_file}"
echo "baseurl=${repo_url}" >> "${repo_file}"
echo "enabled=1" >> "${repo_file}"
echo "metadata_expire=7d" >> "${repo_file}"
echo "gpgcheck=0" >> "${repo_file}"
chmod 644 "${repo_file}"
}

do_install()
{
is_archive "${SOURCE_PATH}" && return 0

msg ":: Installing ${COMPONENT} ... "

local core_packages="audit-libs basesystem bash bash-completion bzip2-libs ca-certificates chkconfig coreutils cpio cracklib crypto-policies cryptsetup-libs curl cyrus-sasl-lib dbus dbus-libs device-mapper-libs dnf dnf-conf dnf-plugins-core dnf-yum elfutils-libelf elfutils-libs expat fedora-gpg-keys fedora-release fedora-repos file-libs filesystem gawk gdbm glib2 glibc glibc-common gmp gnupg2 gnutls gobject-introspection gpgme grep gzip info iptables-libs json-c keyutils-libs kmod-libs krb5-libs libacl libarchive libargon2 libassuan libattr libblkid libcap libcap-ng libcom_err libcomps libcurl libdb libdb-utils libdnf libffi libgcc libgcrypt libgpg-error libidn2 libmetalink libmodulemd libmount libnghttp2 libnsl2 libpcap libpsl libpwquality librepo libreport-filesystem libseccomp libselinux libsemanage libsepol libsigsegv libsmartcols libsolv libssh libtasn1 libtirpc libunistring libutempter libuuid libverto libxcrypt libxml2 libyaml libzstd lua-libs lz4-libs mpfr ncurses ncurses-base ncurses-libs nettle nspr nss nss-softokn nss-softokn-freebl nss-sysinit nss-util openldap openssl-libs p11-kit p11-kit-trust pam pcre pcre2 popt python3 python3-dnf python3-dnf-plugins-core python3-gobject-base python3-gpg python3-hawkey python3-iniparse python3-libcomps python3-librepo python3-libs python3-pip python3-rpm python3-setuptools python3-six python3-smartcols qrencode-libs readline rootfiles rpm rpm-build-libs rpm-libs rpm-plugin-selinux sed setup shadow-utils sqlite-libs sudo systemd systemd-libs tzdata util-linux vim-minimal which xz-libs zlib"
local core_packages="acl alternatives audit-libs basesystem bash brotli bzip2-libs ca-certificates coreutils coreutils-common cracklib crypto-policies cryptsetup-libs curl cyrus-sasl-lib dbus dbus-broker dbus-common device-mapper device-mapper-libs dnf dnf-data dnf-yum elfutils-default-yama-scope elfutils-libelf elfutils-libs expat fedora-gpg-keys fedora-release fedora-release-common fedora-repos file-libs filesystem findutils gawk gdbm-libs glib2 glibc glibc-common glibc-minimal-langpack gmp gnupg2 gnutls gpgme grep gzip ima-evm-utils iptables-libs json-c keyutils-libs kmod-libs krb5-libs libacl libarchive libargon2 libassuan libattr libblkid libcap libcap-ng libcom_err libcomps libcurl libdb libdb-utils libdnf libfdisk libffi libgcc libgcrypt libgpg-error libidn2 libksba libmetalink libmodulemd1 libmount libnghttp2 libnsl2 libpcap libpsl libpwquality librepo libreport-filesystem libseccomp libselinux libsemanage libsepol libsigsegv libsmartcols libsolv libssh libsss_idmap libsss_nss_idmap libstdc++ libtasn1 libtirpc libunistring libusbx libutempter libuuid libverto libxcrypt libxml2 libyaml libzstd lua-libs lz4-libs mpfr ncurses ncurses-base ncurses-libs nettle npth openldap openssl-libs p11-kit p11-kit-trust pam pcre pcre2 popt publicsuffix-list-dafsa python3 python3-dnf python3-gpg python3-hawkey python3-libcomps python3-libdnf python3-libs python3-rpm python-pip-wheel python-setuptools-wheel qrencode-libs readline rootfiles rpm rpm-build-libs rpm-libs rpm-sign-libs sed setup shadow-utils sqlite-libs sssd-client sudo systemd systemd-libs systemd-pam systemd-rpm-macros tar tzdata util-linux vim-minimal xz-libs zchunk-libs zlib"

local repo_url
if [ "${ARCH}" = "i386" ]
Expand Down Expand Up @@ -111,13 +92,13 @@ do_install()

component_exec core/mnt core/net

msg -n "Updating repository ... "
yum_repository
msg -n "Setting dnf excludes ..."
echo "exclude=grubby" >> "${CHROOT_DIR}"/etc/dnf/dnf.conf
is_ok "fail" "done"

msg "Installing minimal environment: "
dnf_install @minimal-environment --exclude filesystem,openssh-server
is_ok || return 1
msg -n "Upgrading packages ..."
chroot_exec -u root dnf -y upgrade --refresh
is_ok "fail" "done"

if [ -n "${EXTRA_PACKAGES}" ]; then
msg "Installing extra packages: "
Expand Down
23 changes: 12 additions & 11 deletions include/core/aid/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,26 @@ do_configure()
fi
# add android groups
if [ -n "${PRIVILEGED_USERS}" ]; then
local aid uid
local aid
for aid in $(cat "${COMPONENT_DIR}/android_groups")
do
local xname=$(echo ${aid} | awk -F: '{print $1}')
local xid=$(echo ${aid} | awk -F: '{print $2}')
sed -i "s|^${xname}:.*|${xname}:x:${xid}:${USER_NAME}|" "${CHROOT_DIR}/etc/group"
sed -i "s|^${xname}:.*|${xname}:x:${xid}:|" "${CHROOT_DIR}/etc/group"
if ! $(grep -q "^${xname}:" "${CHROOT_DIR}/etc/group"); then
echo "${xname}:x:${xid}:${USER_NAME}" >> "${CHROOT_DIR}/etc/group"
echo "${xname}:x:${xid}:" >> "${CHROOT_DIR}/etc/group"
fi
if ! $(grep -q "^${xname}:" "${CHROOT_DIR}/etc/passwd"); then
echo "${xname}:x:${xid}:${xid}::/:/bin/false" >> "${CHROOT_DIR}/etc/passwd"
fi
# add users to aid_inet group
for uid in ${PRIVILEGED_USERS}
do
if ! $(grep -q "^${xname}:.*${uid}" "${CHROOT_DIR}/etc/group"); then
sed -i "s|^\(${xname}:.*\)|\1,${uid}|" "${CHROOT_DIR}/etc/group"
fi
done
done
local usr
for usr in ${PRIVILEGED_USERS}
do
local uid=${usr%%:*}
local gid=${usr##*:}
sed -i "s|^\(${gid}:.*:[^:]+\)$|\1,${uid}|" "${CHROOT_DIR}/etc/group"
sed -i "s|^\(${gid}:.*:\)$|\1${uid}|" "${CHROOT_DIR}/etc/group"
done
fi
return 0
Expand All @@ -49,7 +50,7 @@ do_help()
{
cat <<EOF
--privileged-users="${PRIVILEGED_USERS}"
A list of users separated by a space to be added to Android groups.
A list of users in a format UID:GID separated by a space to be added UID to GID.
EOF
}
2 changes: 1 addition & 1 deletion include/desktop/dbus/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ do_install()
pacman_install ${packages}
;;
fedora:*)
packages="dbus"
packages="dbus dbus-tools"
dnf_install ${packages}
;;
centos:*)
Expand Down

0 comments on commit cc09794

Please sign in to comment.