diff --git a/doc/bash_tips.md b/doc/bash_tips.md index 6a1f84f..485eb10 100644 --- a/doc/bash_tips.md +++ b/doc/bash_tips.md @@ -61,3 +61,5 @@ count=$((count+1)) >&2 echo $code fi ``` + +## sudo -E or better source if already root diff --git a/doc/index.md b/doc/index.md index 0d87ecc..929edac 100644 --- a/doc/index.md +++ b/doc/index.md @@ -1,10 +1,10 @@ # Documentation -## Initiate +## Initiate again Rk: useful when timezone has changed or ghostty command has been installed afterwards -`miaou-bash --self-upgrade` +`miaou-bash --self-upgrade` #TODO: does not apply anymore ## debug, use of MIAOU_DEBUG diff --git a/lib/initiate.bash b/lib/initiate.bash index fcc21f6..9ef1941 100644 --- a/lib/initiate.bash +++ b/lib/initiate.bash @@ -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 }