Aller au contenu

opkg (Entware)

https://github.com/Entware/Entware/wiki

Installer oPKG:

Se connecter en root:

ssh bruno@192.168.1.7
#puis
bruno@DS916:~ $ sudo -i
root@DS916:~#

Créer un dossier sur le disque:

mkdir -p /volume1/@Entware/opt

Supprimer le dossier /opt et monter le dossier optware

rm -rf /opt
mkdir /opt
mount -o bind "/volume1/@Entware/opt" /opt

Lancer le script d'installation:

  • for armv7 (DS414)
wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | /bin/sh
  • for x64 (DS916)
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:
#!/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:

ssh bruno@192.168.0.8
Mettre à jour la liste des paquets:
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:
bruno@DS916:~ $ sudo opkg upgrade
Installer un paquet:
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:
bruno@DS916:~ $ sudo opkg remove <paquet>
Marquer un paquet:
bruno@DS916:~ $ sudo opkg flag <flag><paquet>
Liste des paquets disponibles:
bruno@DS916:~ $ sudo opkg list [paquet]

http://bin.entware.net/armv7sf-k3.2/Packages.html

Liste des paquets installés:
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:
bruno@DS916:~ $ sudo opkg list-upgradable
Liste des fichiers d'un paquet:
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:
bruno@DS916:~ $ sudo opkg find '*php*'
Afficher les infos sur un paquet:
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:
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 : mode bavard

  • -A : tous les paquets (pas seulement ceux installés)

https://wiki.openwrt.org/doc/techref/opkg

Using GCC for native compilation

Ne plus rentrer de mot-de-passe pour opkg:

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)

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
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é:

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:

bruno@DS916:~/kymsu $ sudo -i
Password:

Exécuter kymsu2.sh à distance:

bruno@silverbook:~$ ssh dsm916 ./kymsu/kymsu2.sh

Paquets opkg

$ sudo opkg find '*lsof*'
lsof - 4.94.0-1 - LiSt Open Files - a diagnostic tool

Compiler dcraw.

Télécharger les sources, puis:

$ gcc -o dcraw -O4 dcraw.c -lm -DNO_JPEG -DNODEPS

$ gcc -o dcraw -O4 dcraw.c -lm -DNODEPS
Identifier sans décoder (-i)

$ dcraw -i 2006-08-25_Brocard_0370.CR2
2006-08-25_Brocard_0370.CR2 is a Canon EOS 20D image.
Identifier sans décoder (+mode verbose) (-i -v)

$ dcraw -i -v 2020-10-16_Brocard_3606.CR3

Filename: 2020-10-16_Brocard_3606.CR3
Timestamp: Fri Oct 16 18:38:17 2020
Camera make: Canon
Camera model: EOS 90D
Owner: @Bruno Pesenti
ISO speed: 1600
Shutter: 1/49.4 sec
Aperture: f/4.0
Focal length: 500.0 mm
Embedded ICC profile: no
Number of raw images: 1
Thumb size:  6960 x 4640
Full size:   7128 x 4732
Image size:  7128 x 4732
Output size: 7128 x 4732
Raw colors: 3
Filter pattern: RG/GB
Daylight multipliers: 1.000000 1.000000 1.000000

Convertir dans l'espace sRGB (-o 1)

$ dcraw -o 1 -v 2020-10-16_Brocard_3606.CR3
Loading Canon EOS 90D image from 2020-10-16_Brocard_3606.CR3 ...
Scaling with darkness 0, saturation 255, and
multipliers 1.000000 1.000000 1.000000 1.000000
AHD interpolation...
Building histograms...
Writing data to 2020-10-16_Brocard_3606.ppm ...

Use the cameras White Balance (WB) (-w) et crér un fichier TIFF (-t)

$ dcraw -o 1 -w -T 2016-09-28_Brocard_7953.CR2

https://gist.github.com/darencard/500eca3d09e32283d5fe6377270fd9e8


Dernière mise à jour: March 4, 2022