diff --git a/hlna-dev-git/postinstall.sh b/hlna-dev-git/postinstall.sh index a233679..c48ce9e 100644 --- a/hlna-dev-git/postinstall.sh +++ b/hlna-dev-git/postinstall.sh @@ -1,14 +1,18 @@ -if test -f /home/$SUDO_USER/.zshrc; then -echo "zshrc" -echo 'alias hlna="hlna.py"'>>/home/$SUDO_USER/.zshrc -echo 'alias hlna-bot="hlna-bot.py"'>>/home/$SUDO_USER/.zshrc -fi -if test -f /home/$SUDO_USER/.config/fish/config.fish; then -echo 'alias hlna="hlna.py"'>>/home/$SUDO_USER/.config/fish/config.fish -echo 'alias hlna-bot="hlna-bot.py"'>>/home/$SUDO_USER/.config/fish/config.fish -fi -if test -f /home/$SUDO_USER/.bashrc; then -echo 'alias hlna="hlna.py"'>>/home/$SUDO_USER/.bashrc -echo 'alias hlna-bot="hlna-bot.py"'>>/home/$SUDO_USER/.bashrc -source /home/$SUDO_USER/.bashrc -fi \ No newline at end of file +line_to_add='alias hlna="hlna.py"' +file_paths=( "/home/$SUDO_USER/.zshrc" "/home/$SUDO_USER/.bashrc" "/home/$SUDO_USER/.config/fish/config.fish" ) + +for file_path in "${file_paths[@]}" +do + if [ -f "$file_path" ]; then + # Check if the line is already in the file + grep -qF "$line_to_add" "$file_path" + if [ $? -ne 0 ]; then + echo "$line_to_add" >> "$file_path" + echo "Строка добавлена to $file_path" + else + echo "Строка уже существует in $file_path" + fi + else + echo "$file_path не существует" + fi +done \ No newline at end of file diff --git a/hlna-dev-git/postremove.sh b/hlna-dev-git/postremove.sh new file mode 100644 index 0000000..e69de29