среда, 6 ноября 2019 г.

test1

sudo lxc-create -t download -n hasp
Distribution:
ubuntu
Release:
bionic
Architecture:
amd64
Downloading the image index
Downloading the rootfs
Downloading the metadata
The image cache is now ready
Unpacking the rootfs

$ sudo lxc-ls
hasp

Запустить контейнер:

$ sudo lxc-start -n hasp


$ sudo lxc-attach -n hasp
root@bionic_lxc_clone:/# passwd ubuntu
# passwd ubuntu
Задать пароль.
Добавить пользователей:
# adduser user
# usermod -aG sudo user
# apt-get install usbutils samba ssh
# lsusb
# usb-devices
# apt install samba mc git curl wget libxslt1.1 nano
# locale-gen ru_RU.UTF-8 
# apt install -y libc6-i386 make
# exit


Запустить консоль:
$ sudo lxc-console -n hasp
$ git clone https://github.com/renbuar/setup-1c.git
$ cd setup-1c
$ sudo sh downloadpg.sh
$ sudo sh download.sh
$ poweroff
#$ sudo lxc-stop -n hasp

$ lsusb
Bus 001 Device 004: ID 0529:0001 Aladdin Knowledge Systems HASP copy protection dongle
Bus 001 Device 003: ID 0529:0001 Aladdin Knowledge Systems HASP copy protection dongle


$ sudo nano /var/lib/lxc/hasp/config

lxc.cgroup.devices.allow = c 189:* rwm
lxc.mount.entry = /dev/bus/usb/001 dev/bus/usb/001 none bind,optional,create=dir
lxc.mount.entry = /dev/aks/ dev/aks/ none bind,optional,create=dir
lxc.hook.autodev = /var/lib/lxc/hasp/autodev

Сохранить.

$ sudo nano /var/lib/lxc/hasp/autodev

#!/bin/bash
if [ -z " ${LXC_ROOTFS_MOUNT}" ]; then
    exit
fi
cd "${LXC_ROOTFS_MOUNT}/dev/"
ln -s /dev/aks/hasp/1-2 /dev/bus/usb/001/002
ln -s /dev/aks/hasp/1-3 /dev/bus/usb/001/003

Сохранить.

Запустить контейнер:

$ sudo lxc-start -n hasp



Запустить консоль:
$ sudo lxc-console -n hasp

user@hasp:~$ lsusb
Bus 001 Device 004: ID 0529:0001 Aladdin Knowledge Systems HASP copy protection dongle
Bus 001 Device 003: ID 0529:0001 Aladdin Knowledge Systems HASP copy protection dongle


$ ls /dev/bus/usb/001
001  002  003  004



Запустить контейнер:
$ sudo lxc-start -n hasp

Войти по ssh

$ cd setup-1c
$ sudo sh setup_pg11_1c.sh
$ sudo sh setup-1c.sh
$ sudo sh setup-2c.sh

$ lsusb
Bus 001 Device 004: ID 0529:0001 Aladdin Knowledge Systems HASP copy protection dongle
Bus 001 Device 003: ID 0529:0001 Aladdin Knowledge Systems HASP copy protection dongle

user@hasp:~/setup-1c$ usbkeytest --list
ID: 0529:0001, Bus: 001, Device: 004, Major: 189, Minor: 3
ID: 0529:0001, Bus: 001, Device: 003, Major: 189, Minor: 2
user@hasp:~/setup-1c$ usbkeytest --detect
aladdin
user@hasp:~/setup-1c$


$ sudo journalctl|grep aksusbd
Nov 06 14:26:01 hasp aksusbd[8526]: loaded, daemon version: 7.90.1.81737, key API (USB) version: 3.88 (parallel driver not available)
Nov 06 14:26:01 hasp haspd[8499]: Running aksusbd... [ DONE ]


user@u1604:~$ ps auxf|grep hasplmd
user     17328  0.0  0.0  15464  1088 pts/0    S+   17:45   0:00  |           \_ grep --color=auto hasplmd
root     10097  0.1  0.0  19504  6144 ?        Sl   17:26   0:01      \_ hasplmd -s


Загрузить базу demo

$ sudo -u postgres pg_probackup-11 backup -B /backup --instance main -b FULL --stream --compress --delete-wal --expired -j 4

$ sudo sh backup/restore_main.sh

$ xvfb-run /opt/1C/v8.3.15.1700/x86_64/./1cv8 CREATEINFOBASE Srvr='"hasp";Ref="demo";DBMS="PostgreSQL";DBSrvr="hasp port=5432";DB="demo";DBUID="postgres";DBPwd="pass";CrSQLDB="Y";SchJobDn="Y";' /Out "/home/user/log.txt"

$ xvfb-run /opt/1C/v8.3.15.1700/x86_64/./1cv8 DESIGNER /S"hasp\demo" /N"admin" /P"admin"  /IBcheckAndRepair -LogAndRefsIntegrity /Out"/home/user/log.txt"

$ ls -alFhR /dev/aks

mount --bind /dev/aks /path_to_your_container/rootfs/dev/aks

lxc.cgroup.devices.allow = c 189:* rwm
lxc.mount.entry = /dev/bus/usb/001 dev/bus/usb/001 none bind,optional,create=dir
lxc.mount.entry = /dev/aks/hasp/1-3 dev/aks/hasp/1-3 none bind,optional,create=file
lxc.mount.entry = /dev/aks/hasp/1-2 dev/aks/hasp/1-2 none bind,optional,create=file
 

#lxc.mount.entry = /dev/aks/ dev/aks/ none bind,optional,create=dir


$ sudo mkdir -p /dev/aks/hasp/
$ sudo ln -s  /dev/bus/usb/001/002 /dev/aks/hasp/1-2
$ sudo ln -s /dev/bus/usb/001/003 /dev/aks/hasp/1-3
$ sudo ln -s  /dev/bus/usb/001/001 /dev/aks/hasp/1-1
$ sudo ln -s /dev/bus/usb/001/004 /dev/aks/hasp/1-4


$ sudo service haspd start
   
ln -s /dev/aks/hasp/1-2 /dev/bus/usb/001/002
ln -s /dev/aks/hasp/1-3 /dev/bus/usb/001/003


s -alFhR /dev/bus/usb/
ls -alFhR /dev/aks/


$ sudo journalctl|grep aksusbd

$ sudo apt remove haspd
 

$ sudo dpkg -i aksusbd_7.101-1_amd64.deb$ sudo systemctl status aksusbd.service
$ sudo systemctl restart aksusbd.service

$ sudo mkdir -p /dev/aks/hasp/
$ sudo ln -s  /dev/bus/usb/001/002 /dev/aks/hasp/1-2
$ sudo ln -s /dev/bus/usb/001/003 /dev/aks/hasp/1-3
$ sudo ln -s  /dev/bus/usb/001/001 /dev/aks/hasp/1-1
$ sudo ln -s /dev/bus/usb/001/004 /dev/aks/hasp/1-4
$ sudo systemctl restart aksusbd.service

/etc/udev/80-hasp.rules 
 

Комментариев нет:

Отправить комментарий