.linx-env v1
This commit is contained in:
11
applications/install.sh
Normal file
11
applications/install.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# desktop apps
|
||||
cp ~/.linux-env/applications/*/*.desktop ~/.local/share/applications/
|
||||
cp ~/.linux-env/applications/*/*.sh ~/.local/bin/
|
||||
cp ~/.linux-env/applications/*/*.svg ~/.local/share/icons/
|
||||
|
||||
chmod +x ~/.local/share/applications/*.desktop
|
||||
chmod +x ~/.local/bin/*.sh
|
||||
|
||||
update-desktop-database ~/.local/share/applications/
|
||||
gtk-update-icon-cache ~/.local/share/icons/ # inutile sauf si tu fais un vrai thème d'icônes
|
||||
@@ -1,6 +1,8 @@
|
||||
# .linux-env
|
||||
alias dlmusic='MUSIC_PATH="/mnt/media/music/evilspins/$(date +"%Y")" && mkdir -p $MUSIC_PATH && NOW=$(date +"%Y%m%d%H") && pip install -U yt-dlp && yt-dlp -f bestaudio -x --audio-format mp3 --audio-quality 0 -o $MUSIC_PATH"/"$NOW"__%(title)s__%(artist)s__%(id)s.%(ext)s" $1'
|
||||
alias dlvideo='VIDEO_PATH="/mnt/media/video/autre" && cd "$VIDEO_PATH" && pip install -U yt-dlp && yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4" --merge-output-format mp4 "$@"'
|
||||
alias dlfilm='VIDEO_PATH="/mnt/media/video/film" && yt-dlp -o $VIDEO_PATH $1'
|
||||
alias dlimage='IMAGE_PATH="/mnt/media/image/screenshit" && wget -P $IMAGE_PATH $1'
|
||||
alias search='find ./ -iname "*$1*"'
|
||||
alias searchinside='grep -rwl "*$1*" ./'
|
||||
# .linux-env
|
||||
4
bashrc/install.sh
Normal file
4
bashrc/install.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
sed -i '/# .linux-env/,/# .linux-env/d' ~/.bashrc
|
||||
cat ~/.linux-env/bashrc/.bashrc >> ~/.bashrc
|
||||
@@ -1,13 +0,0 @@
|
||||
[Unit]
|
||||
Description=Pad Dolphin Watcher Service (User)
|
||||
After=graphical.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/python3 /home/%u/.local/bin/gamecube-pad.py
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
WorkingDirectory=/home/%u
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -1,46 +1,77 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SERVICE_NAME="gamecube-pad.service"
|
||||
SERVICE_PATH="$HOME/.config/systemd/user/gamecube-pad.service"
|
||||
PYTHON_SCRIPT="/home/$USER/.local/bin/gamecube-pad.py"
|
||||
PYTHON_SCRIPT="$HOME/.local/bin/gamecube-pad.py"
|
||||
AUTOSTART_DIR="$HOME/.config/autostart"
|
||||
AUTOSTART_FILE="$AUTOSTART_DIR/gamecube-pad.desktop"
|
||||
|
||||
install_service() {
|
||||
echo "[+] Installation des dépendances..."
|
||||
sudo apt install -y python3-evdev python3-uinput xdotool wmctrl
|
||||
SILENT=false
|
||||
if [[ "$1" == "silent" ]]; then
|
||||
SILENT=true
|
||||
fi
|
||||
|
||||
echo "[+] Copie du script Python..."
|
||||
mkdir -p "$(dirname "$PYTHON_SCRIPT")"
|
||||
cp gamecube-pad.py "$PYTHON_SCRIPT"
|
||||
chmod +x "$PYTHON_SCRIPT"
|
||||
|
||||
echo "[+] Copie du fichier systemd utilisateur..."
|
||||
mkdir -p "$HOME/.config/systemd/user"
|
||||
cp gamecube-pad.service "$SERVICE_PATH"
|
||||
|
||||
echo "[+] Activation du service..."
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable gamecube-pad.service
|
||||
systemctl --user restart gamecube-pad.service
|
||||
|
||||
echo "[✓] Installation terminée. Consultez les logs avec : journalctl --user -u gamecube-pad.service -f"
|
||||
log() {
|
||||
if [ "$SILENT" = false ]; then
|
||||
echo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
uninstall_service() {
|
||||
echo "[+] Arrêt et suppression du service..."
|
||||
systemctl --user stop gamecube-pad.service || true
|
||||
systemctl --user disable gamecube-pad.service || true
|
||||
rm -f "$SERVICE_PATH"
|
||||
check_and_install_deps() {
|
||||
for pkg in evdev uinput; do
|
||||
if ! python3 -c "import $pkg" &>/dev/null; then
|
||||
log "[!] Dépendance manquante : $pkg. Installation avec pip..."
|
||||
python3 -m pip install --user "$pkg" &>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
for cmd in xdotool wmctrl; do
|
||||
if ! command -v "$cmd" &>/dev/null; then
|
||||
log "[!] Commande manquante : $cmd. Merci de l’installer via votre gestionnaire de paquets."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
install_script() {
|
||||
check_and_install_deps
|
||||
|
||||
log "[+] Copie du script Python..."
|
||||
mkdir -p "$(dirname "$PYTHON_SCRIPT")"
|
||||
cp "$HOME/.linux-env/gamecube-pad/gamecube-pad.py" "$PYTHON_SCRIPT"
|
||||
chmod +x "$PYTHON_SCRIPT"
|
||||
|
||||
log "[+] Création du fichier autostart..."
|
||||
mkdir -p "$AUTOSTART_DIR"
|
||||
cat > "$AUTOSTART_FILE" <<EOF
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Exec=$PYTHON_SCRIPT
|
||||
Hidden=false
|
||||
NoDisplay=false
|
||||
X-GNOME-Autostart-enabled=true
|
||||
Name=GameCube Pad
|
||||
Comment=Lance le script GameCube Pad au démarrage
|
||||
EOF
|
||||
|
||||
log "[✓] Installation terminée. Le script se lancera automatiquement à l'ouverture de session."
|
||||
}
|
||||
|
||||
uninstall_script() {
|
||||
log "[+] Suppression du script Python et autostart..."
|
||||
rm -f "$PYTHON_SCRIPT"
|
||||
systemctl --user daemon-reload
|
||||
echo "[✓] Désinstallation terminée."
|
||||
rm -f "$AUTOSTART_FILE"
|
||||
log "[✓] Désinstallation terminée."
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
uninstall)
|
||||
uninstall_service
|
||||
uninstall_script
|
||||
;;
|
||||
silent)
|
||||
SILENT=true
|
||||
uninstall_script &>/dev/null
|
||||
install_script &>/dev/null
|
||||
;;
|
||||
*)
|
||||
install_service
|
||||
install_script
|
||||
;;
|
||||
esac
|
||||
|
||||
22
install.sh
22
install.sh
@@ -1,10 +1,16 @@
|
||||
# desktop apps
|
||||
cp ./applications/*/*.desktop ~/.local/share/applications/
|
||||
cp ./applications/*/*.sh ~/.local/bin/
|
||||
cp ./applications/*/*.svg ~/.local/share/icons/
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
chmod +x ~/.local/share/applications/*.desktop
|
||||
chmod +x ~/.local/bin/*.sh
|
||||
# Chemin de base : le dossier où se trouve ce script
|
||||
BASE_DIR="$(dirname "$(realpath "$0")")"
|
||||
|
||||
update-desktop-database ~/.local/share/applications/
|
||||
# gtk-update-icon-cache ~/.local/share/icons/ # inutile sauf si tu fais un vrai thème d'icônes
|
||||
echo "[+] Recherche et exécution des install.sh..."
|
||||
|
||||
# Boucle récursive sur tous les fichiers install.sh
|
||||
find "$BASE_DIR" -type f -name "install.sh" ! -path "$BASE_DIR/install.sh" | while read -r script; do
|
||||
echo "[+] Lancement : $script"
|
||||
chmod +x "$script"
|
||||
"$script"
|
||||
done
|
||||
|
||||
echo "[✓] Tous les install.sh ont été exécutés."
|
||||
|
||||
Reference in New Issue
Block a user