Skip to content

Commit

Permalink
fix user create issue in distro container, fix update pause issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sabamdarif committed Nov 8, 2024
1 parent 962e8e8 commit 59c9efe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
36 changes: 11 additions & 25 deletions distro-container-setup
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,7 @@ proot-distro login $selected_distro -- /bin/bash -c 'bash pd_basic_setup.sh'
final_pass="root"
fi

if [[ "$pd_pass_type" == "1" ]];then
if [[ "$selected_distro" == "alpine" ]]; then
if [[ "$selected_distro" == "alpine" ]]; then
cat <<EOF > $distro_path/root/useradd.sh
#!/bin/bash
Expand All @@ -300,57 +299,44 @@ groupadd wheel
mkdir -p /home/$final_user_name
adduser -h /home/$final_user_name -s \$(which bash) -G users -D $final_user_name
chown ${final_user_name}:users /home/$final_user_name
chmod u+rw /etc/sudoers
echo "$final_user_name ALL=(ALL) NOPASSWD:ALL" | tee -a /etc/sudoers > /dev/null 2>&1
chmod u-w /etc/sudoers
echo "${final_user_name}:${final_pass}" | chpasswd
rm useradd.sh
EOF
else
else
cat <<EOF > $distro_path/root/useradd.sh
#!/bin/bash
groupadd storage
groupadd wheel
useradd -m -g users -s \$(which bash) ${final_user_name}
usermod -aG wheel,polkitd,audio,video,storage ${final_user_name}
chmod u+rw /etc/sudoers
echo "$final_user_name ALL=(ALL) NOPASSWD:ALL" | tee -a /etc/sudoers > /dev/null 2>&1
chmod u-w /etc/sudoers
echo "${final_user_name}:${final_pass}" | chpasswd
rm useradd.sh
EOF
fi
fi

if [[ "$selected_distro" == "alpine" ]]; then
proot-distro login $selected_distro -- /bin/sh -c 'bash useradd.sh'

if [[ "$pd_pass_type" == "1" ]];then
cat <<EOF > $distro_path/root/useradd.sh
#!/bin/bash
groupadd storage
groupadd wheel
mkdir -p /home/$final_user_name
adduser -h /home/$final_user_name -s \$(which bash) -G users -D $final_user_name
chown ${final_user_name}:users /home/$final_user_name
echo "${final_user_name}:${final_pass}" | chpasswd
chmod u+rw /etc/sudoers
echo "$final_user_name ALL=(ALL:ALL) ALL" | tee -a /etc/sudoers > /dev/null 2>&1
echo "$final_user_name ALL=(ALL) NOPASSWD:ALL" | tee -a /etc/sudoers > /dev/null 2>&1
chmod u-w /etc/sudoers
rm useradd.sh
EOF
else
EOF
elif [[ "$pd_pass_type" == "2" ]];then
cat <<EOF > $distro_path/root/useradd.sh
#!/bin/bash
groupadd storage
groupadd wheel
useradd -m -g users -s \$(which bash) ${final_user_name}
usermod -aG wheel,polkitd,audio,video,storage ${final_user_name}
echo "${final_user_name}:${final_pass}" | chpasswd
chmod u+rw /etc/sudoers
echo "$final_user_name ALL=(ALL:ALL) ALL" | tee -a /etc/sudoers > /dev/null 2>&1
chmod u-w /etc/sudoers
rm useradd.sh
EOF
fi

proot-distro login $selected_distro -- /bin/sh -c 'bash useradd.sh'
proot-distro login $selected_distro -- /bin/sh -c 'sudo -k'
}
Expand Down
1 change: 1 addition & 0 deletions setup-termux-desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2444,6 +2444,7 @@ function check_for_update_and_update_installer() {
if [[ -e "$PREFIX/bin/setup-termux-desktop" ]]; then
echo "${R}[${W}-${R}]${G} Checking for update..."${W}
echo
check_and_create_directory "$termux_desktop_path"
local current_script_hash=$(curl -sL https://raw.githubusercontent.com/sabamdarif/termux-desktop/main/setup-termux-desktop | sha256sum | cut -d ' ' -f 1)
local local_script_hash=$(basename $(sha256sum $PREFIX/bin/setup-termux-desktop | cut -d ' ' -f 1))
if [[ "$local_script_hash" != "$current_script_hash" ]]; then
Expand Down

0 comments on commit 59c9efe

Please sign in to comment.