useless sudo in initiate

This commit is contained in:
pvincent
2026-09-02 01:11:33 +04:00
parent 0196b2c907
commit 6441474965
3 changed files with 19 additions and 17 deletions
+15 -15
View File
@@ -54,10 +54,10 @@ function fix_users_bashrc {
>&2 echo "WARN: .bashrc for user <$user> has forked from skeleton, please resolve conflict manually from backup: $backup"
fi
done
sudo mv /etc/skel/.bashrc /etc/skel/.bashrc.ORIGINAL
mv /etc/skel/.bashrc /etc/skel/.bashrc.ORIGINAL
echo 'fixing users .bashrc...DONE'
fi
sudo ln -sf "$MIAOU_BASH_DIR"/etc/skel/.bashrc /etc/skel/.bashrc
ln -sf "$MIAOU_BASH_DIR"/etc/skel/.bashrc /etc/skel/.bashrc
}
function link_etc {
@@ -66,23 +66,23 @@ function link_etc {
if [[ -L "$target" ]]; then
if [[ "$(readlink "$target")" != "$source" ]]; then
sudo ln -sf "$source" "$target"
ln -sf "$source" "$target"
echo "link $target updated"
fi
else
if [[ -f "$target" ]]; then
sudo mv "$target" "$target$BACKUP_SUFFIX"
mv "$target" "$target$BACKUP_SUFFIX"
echo "$target$BACKUP_SUFFIX saved!"
fi
sudo mkdir -p "$(dirname "$target")"
sudo ln -s "$source" "$target"
mkdir -p "$(dirname "$target")"
ln -s "$source" "$target"
echo "link $target created"
fi
}
function arch_profile {
if ! cmp -s /etc/profile "$MIAOU_BASH_DIR"/etc/profile.arch; then
sudo cp "$MIAOU_BASH_DIR"/etc/profile.arch /etc/profile
cp "$MIAOU_BASH_DIR"/etc/profile.arch /etc/profile
echo 'arch /etc/profile fixed!'
fi
}
@@ -195,14 +195,14 @@ function ghostty_global_config {
}
function link_bin_scripts {
sudo ln -sf "$MIAOU_BASH_DIR"/bin/miaou-bash /usr/bin/
sudo ln -sf "$MIAOU_BASH_DIR"/bin/pkg_add /usr/bin/
ln -sf "$MIAOU_BASH_DIR"/bin/miaou-bash /usr/bin/
ln -sf "$MIAOU_BASH_DIR"/bin/pkg_add /usr/bin/
}
function create_sudoers {
if [[ ! -f /etc/sudoers.d/miaou-bash ]]; then
echo 'Defaults:%sudo env_keep += "MIAOU_BASH_DIR"' | sudo tee /etc/sudoers.d/miaou-bash >/dev/null
sudo chmod 440 /etc/sudoers.d/miaou-bash
echo 'Defaults:%sudo env_keep += "MIAOU_BASH_DIR"' >/etc/sudoers.d/miaou-bash
chmod 440 /etc/sudoers.d/miaou-bash
fi
}
@@ -222,8 +222,8 @@ function launch_hooks {
function apply_mode {
if [[ "$MIAOU_BASH_MODE" == hosted ]]; then
sudo mkdir /var/lib/miaou-bash -p
sudo cp "$MIAOU_BASH_DIR"/.semver_git_tag /var/lib/miaou-bash/semver_current
mkdir /var/lib/miaou-bash -p
cp "$MIAOU_BASH_DIR"/.semver_git_tag /var/lib/miaou-bash/semver_current
fi
}
@@ -232,7 +232,7 @@ function fix_locales {
declare -a expected_locales=(en_US.utf8 es_ES.utf8 fr_FR.utf8)
declare -A found_locales
for locale in "${expected_locales[@]}"; do found_locales["$locale"]=false; done
mapfile -t gen_locales < <(sudo locale -a)
mapfile -t gen_locales < <(locale -a)
for locale in "${gen_locales[@]}"; do
if [[ -v found_locales["$locale"] ]]; then found_locales["$locale"]=true; fi
done
@@ -245,7 +245,7 @@ function fix_locales {
fi
done
if [[ "$should_regenerate" == 'true' ]]; then
sudo locale-gen
locale-gen
fi
}