1er commit

De la docs au format Mkdocs
This commit is contained in:
2018-09-16 14:48:15 +02:00
commit e82296ba06
140 changed files with 17082 additions and 0 deletions

273
docs/Synology/opkg/oPKG.md Normal file
View File

@@ -0,0 +1,273 @@
# opkg (Entware)
https://github.com/Entware/Entware/wiki
### Installer oPKG:
Se connecter en root:
```bash
ssh bruno@192.168.1.7
#puis
bruno@DS916:~ $ sudo -i
root@DS916:~#
```
Créer un dossier sur le disque:
```bash
mkdir -p /volume1/@Entware/opt
```
Supprimer le dossier /opt et monter le dossier optware
```bash
rm -rf /opt
mkdir /opt
mount -o bind "/volume1/@Entware/opt" /opt
```
Lancer le script d'installation:
- for armv7 (DS414)
```bash
wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | /bin/sh
```
- for x64 (DS916)
```bash
wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
```
Créer une tâche de démarrage:
DSM -> Panneau de configuration -> Planificateur de tâche -> Créer une tâche déclenchée
- Tâche: Entware
- Utilisateur: root
- Evènement: Démarrage
- Paramètres de tâche -> Exécuter la commande:
```bash
#!/bin/sh
# Mount/Start Entware
mkdir -p /opt
mount -o bind "/volume1/@Entware/opt" /opt
/opt/etc/init.d/rc.unslung start
# Add Entware Profile in Global Profile
if grep -qF '/opt/etc/profile' /etc/profile; then
echo "Confirmed: Entware Profile in Global Profile"
else
echo "Adding: Entware Profile in Global Profile"
cat >> /etc/profile <<"EOF"
# Load Entware Profile
. /opt/etc/profile
EOF
fi
# Update Entware List
/opt/bin/opkg update
```
Redémarrer le NAS
Ajouter `/opt/bin & /opt/sbin` à la variable $PATH
### Utiliser oPKG
Se connecter sous un compte admin:
```bash
ssh bruno@192.168.0.8
```
##### Mettre à jour la liste des paquets:
```bash
bruno@DS916:~ $ sudo opkg update
Password:
Downloading http://bin.entware.net/x64-k3.2/Packages.gz
Updated list of available packages in /opt/var/opkg-lists/entware
```
##### Mettre à jour tous les paquets:
```bash
bruno@DS916:~ $ sudo opkg upgrade
```
##### Installer un paquet:
```bash
bruno@DS916:~ $ sudo opkg install ffmpeg
Password:
Installing ffmpeg (3.2.10-3) to root...
Downloading http://bin.entware.net/x64-k3.2/ffmpeg_3.2.10-3_x64-3.2.ipk
```
##### Supprimer un paquet:
```bash
bruno@DS916:~ $ sudo opkg remove <paquet>
```
##### Marquer un paquet:
```bash
bruno@DS916:~ $ sudo opkg flag <flag><paquet>
```
##### Liste des paquets disponibles:
```bash
bruno@DS916:~ $ sudo opkg list [paquet]
```
http://bin.entware.net/armv7sf-k3.2/Packages.html
##### Liste des paquets installés:
```bash
bruno@DS916:~ $ sudo opkg list-installed
alsa-lib - 1.1.5-1
entware-opt - 227000-3
entware-release - 1.0-2
entware-upgrade - 1.0-1
...
```
##### Liste des mises-à-jour de paquets disponibles:
```bash
bruno@DS916:~ $ sudo opkg list-upgradable
```
##### Liste des fichiers d'un paquet:
```bash
bruno@DS916:~ $ sudo opkg files nano
Package nano (2.9.6-1) is installed on root and has the following files:
/opt/share/nano/texinfo.nanorc
/opt/share/nano/po.nanorc
...
```
##### Chercher un paquet:
```bash
bruno@DS916:~ $ sudo opkg search <paquet> ???
```
##### Afficher les infos sur un paquet:
```bash
bruno@DS916:~ $ sudo opkg info vim
Package: vim
Version: 8.0.586-2
Depends: libc, libssp, librt, libpthread, libncurses
Status: unknown ok not-installed
Section: utils
Architecture: x64-3.2
MD5Sum: 49db8c4294e7edd8236eb2609dfd4527
Size: 350167
Filename: vim_8.0.586-2_x64-3.2.ipk
Description: Vim is an almost compatible version of the UNIX editor Vi.
(Tiny build)
```
##### Status d'un paquet:
```bash
bruno@DS916:~ $ sudo opkg status nano
Package: nano
Version: 2.9.6-1
Depends: libc, libssp, librt, libpthread, libncursesw, zlib, file
Status: install user installed
Architecture: x64-3.2
Conffiles:
/opt/etc/nanorc ff3c86182093564e3313eeaa0eb367cb092c4bd838128bda02a91dd5e3017e63
Installed-Time: 1536489744
```
##### Options:
-V --verbosity <niveau> mode bavard
-A tous les paquets (pas seulement ceux installés)
https://wiki.openwrt.org/doc/techref/opkg
### Ne plus rentrer de mot-de-passe pour opkg:
```bash
bruno@DS916:~ $ cd kymsu/
-rwx------ 1 bruno users 1078 Sep 11 18:45 kymsu2.sh
-drwxr-xr-x 1 bruno users 30 Sep 12 16:39 plugins.d
```
Créer un fichier de config sudo pour l'utilisateur dans `sudoers.d` (apparemment, pas la peine de décommenter la ligne `#includedir /etc/sudoers.d` dans `sudoers`)
```bash
root@DS916:/etc/sudoers.d# ls -la
total 12
drwxr-x--- 2 root root 4096 Sep 12 20:08 .
drwxr-xr-x 48 root root 4096 Sep 10 17:07 ..
-r--r----- 1 root root 68 Sep 12 20:34 bruno
root@DS916:/etc/sudoers.d# nano bruno
```
```bash
bruno ALL=(ALL) NOPASSWD:/var/services/homes/bruno/kymsu/kymsu2.sh
```
Permet à l'utilisateur bruno de lancer le script kymsu2.sh avec sudo mais sans mot de passe.
Pas besoin de redémarrer.
Au prochain lancement du script par la commande sudo, le mot-de-passe n'est plus demandé:
```bash
bruno@DS916:~/kymsu $ sudo ./kymsu2.sh
📦 oPKG
Downloading http://bin.entware.net/x64-k3.2/Packages.gz
Updated list of available packages in /opt/var/opkg-lists/entware
No availables updates.
```
Pour cette commande (passage à root), le mot-de-pass est bien demandé pour la commande sudo:
```bash
bruno@DS916:~/kymsu $ sudo -i
Password:
```
Exécuter kymsu2.sh à distance:
```bash
bruno@silverbook:~$ ssh dsm916 ./kymsu/kymsu2.sh
```