This commit is contained in:
2023-04-13 13:56:11 +03:00
parent aed4e4b334
commit 146def9fbc
9 changed files with 124 additions and 134 deletions

View File

@ -1,4 +1,3 @@
name='hlna-git'
version='latest'
release='1'
@ -22,18 +21,17 @@ version() {
}
scripts=(
['postinstall']='postinstall.sh'
['postremove']='postremove.sh'
['postinstall']='postinstall.sh'
['postremove']='postremove.sh'
)
prepare() {
pip3 install --upgrade --user click colorama click_completion pyTelegramBotAPI discord
pip3 install --upgrade rcon
pip3 install --upgrade --user click colorama click_completion pyTelegramBotAPI discord
pip3 install --upgrade rcon
}
package() {
install -Dm755 "${srcdir}/hln-a/hlna.py" "${pkgdir}/usr/bin/hlna.py"
install -Dm755 "${srcdir}/hln-a/hlna_bot.py" "${pkgdir}/usr/bin/hlna-bot.py"
install -Dm755 "${srcdir}/hln-a/hlna_bot.py" "${pkgdir}/usr/bin/hlna-bot.py"
install -Dm644 "${srcdir}/hln-a/LICENSE.md" "${pkgdir}/usr/share/licenses/hlna/license"
}

View File

@ -1,28 +1,27 @@
line1_to_add='alias hlna="hlna.py"'
line2_to_add='alias hlna-bot="hlna-bot.py"'
file_paths=( "/home/$SUDO_USER/.zshrc" "/home/$SUDO_USER/.bashrc" "/home/$SUDO_USER/.config/fish/config.fish" )
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 lines are already in the file
grep -qF "$line1_to_add" "$file_path"
if [ $? -ne 0 ]; then
echo "$line1_to_add" >> "$file_path"
echo "Alias hlna добавлен в $file_path"
else
echo "Alias hlna уже есть в файле $file_path"
fi
for file_path in "${file_paths[@]}"; do
if [ -f "$file_path" ]; then
# Check if the lines are already in the file
grep -qF "$line1_to_add" "$file_path"
if [ $? -ne 0 ]; then
echo "$line1_to_add" >>"$file_path"
echo "Alias hlna добавлен в $file_path"
else
echo "Alias hlna уже есть в файле $file_path"
fi
grep -qF "$line2_to_add" "$file_path"
if [ $? -ne 0 ]; then
echo "$line2_to_add" >> "$file_path"
echo "Alias hlna-bot добавлен в $file_path"
else
echo "Alias hlna-bot уже есть в файле $file_path"
fi
grep -qF "$line2_to_add" "$file_path"
if [ $? -ne 0 ]; then
echo "$line2_to_add" >>"$file_path"
echo "Alias hlna-bot добавлен в $file_path"
else
echo "Alias hlna-bot уже есть в файле $file_path"
fi
else
echo "$file_path не существует"
fi
done
else
echo "$file_path не существует"
fi
done

View File

@ -1,27 +1,26 @@
line1_to_remove='alias hlna="hlna.py"'
line2_to_remove='alias hlna-bot="hlna-bot.py"'
file_paths=( "/home/$SUDO_USER/.zshrc" "/home/$SUDO_USER/.bashrc" "/home/$SUDO_USER/.config/fish/config.fish" )
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 in the file
grep -qF "$line1_to_remove" "$file_path"
if [ $? -eq 0 ]; then
sed -i "/$line1_to_remove/d" "$file_path"
echo "Alias hlna удалён из $file_path"
else
echo "Alias hlna нет в $file_path"
fi
for file_path in "${file_paths[@]}"; do
if [ -f "$file_path" ]; then
# Check if the line is in the file
grep -qF "$line1_to_remove" "$file_path"
if [ $? -eq 0 ]; then
sed -i "/$line1_to_remove/d" "$file_path"
echo "Alias hlna удалён из $file_path"
else
echo "Alias hlna нет в $file_path"
fi
grep -qF "$line2_to_remove" "$file_path"
if [ $? -eq 0 ]; then
sed -i "/$line2_to_remove/d" "$file_path"
echo "Alias hlna-bot удалён из $file_path"
else
echo "Alias hlna-bot нет в $file_path"
fi
else
echo "$file_path не существует"
fi
done
grep -qF "$line2_to_remove" "$file_path"
if [ $? -eq 0 ]; then
sed -i "/$line2_to_remove/d" "$file_path"
echo "Alias hlna-bot удалён из $file_path"
else
echo "Alias hlna-bot нет в $file_path"
fi
else
echo "$file_path не существует"
fi
done