#!/bin/bash

curdir=$(cd "$(dirname "$0")";pwd)

chmod +x -R ./*
mkdir -p /root/bin-AOI

dpkg --list | grep linux
apt-mark hold linux-headers-5.4.0-26-generic
apt-mark hold linux-image-5.4.0-26-generic
apt-mark hold linux-modules-extra-5.4.0-26-generic

#lib-----------------------------------------------------------------------------------------
cd $curdir
cp opencvlib.tar.xz /lib
tar -Jxvf /lib/opencvlib.tar.xz -C /lib
rm /lib/opencvlib.tar.xz

cp libxls.tar.gz /lib
tar -zxvf /lib/libxls.tar.gz -C /lib
rm /lib/libxls.tar.gz 

cp ffmpeglib.tar.xz /lib
tar -Jxvf /lib/ffmpeglib.tar.xz -C /lib
rm /lib/ffmpeglib.tar.xz 

cp gxilib.tar.xz /lib
tar -Jxvf /lib/gxilib.tar.xz -C /lib
rm /lib/gxilib.tar.xz 

#热成像
cp hotshow.tar.xz /lib
tar -Jxvf /lib/hotshow.tar.xz -C /lib
cp -rdf /lib/libV17/* /lib
rm -rf /lib/libV17
rm /lib/hotshow.tar.xz 

#v16--new----------------------------------------
cd $curdir
cp libBSYV_20q510.tar.xz /lib
tar -Jxvf /lib/libBSYV_20q510.tar.xz -C /lib
rm /lib/libBSYV_20q510.tar.xz

cd $curdir
cp qt515-g93-release.tar.xz /lib
tar -Jxvf /lib/qt515-g93-release.tar.xz -C /lib
rm /lib/qt515-g93-release.tar.xz

cd $curdir
cp system-plugins.tar.xz /lib
tar -Jxvf /lib/system-plugins.tar.xz -C /lib
rm /lib/system-plugins.tar.xz

cd $curdir
cp tslib122-g93-release.tar.xz /lib
tar -Jxvf /lib/tslib122-g93-release.tar.xz -C /lib
mv /lib/ts_calibrate /root/bin-AOI/tsc
mv /lib/ts.conf /etc/
rm /lib/tslib122-g93-release.tar.xz

cd $curdir
cp glog050-g93-release.tar.xz /lib
tar -Jxvf /lib/glog050-g93-release.tar.xz -C /lib
rm -f /lib/glog050-g93-release.tar.xz

#cd $curdir/library
#rsync --progress -ar miniconda3.tar.xz /opt
#cd /opt
#tar -Jxvf miniconda3.tar.xz
#rm -f miniconda3.tar.xz

#cameralib-----------------------------------------------------------------------------------------
./ueyesdk-setup-4.82-usb-amd64.gz.run

cd $curdir
cp libMVSDK.so /lib

cp libHik.tar.gz /lib
tar -zxvf /lib/libHik.tar.gz -C /lib
rm /lib/libHik.tar.gz 

#alsa-----------------------------------------------------------------------------------------
#cd $curdir
#tar -zxf alsadeb.tar.gz 
#rm -f alsadeb.tar.gz
#chmod -R 777 ./* 
#mv ./libasound.so* ./libasound.la  /lib
#已下是之前未发现的依赖删除一些文件
#apt-get -f -y -q remove xmlto alsa-utils
##dpkg -i xmlto_0.0.25-2_amd64.deb
#dpkg -i libsamplerate0_0.1.8-7_amd64.deb
#dpkg -i libasound2-data_1.0.27.2-3ubuntu7_all.deb
#dpkg -i libasound2-dev_1.0.27.2-3ubuntu7_amd64.deb
#dpkg -i linux-sound-base_1.0.25+dfsg-0ubuntu4_all.deb
#dpkg -i libasound2_1.0.27.2-3ubuntu7_amd64.deb
#dpkg -i alsa-base_1.0.25+dfsg-0ubuntu4_all.deb
#dpkg -i alsa-utils_1.0.27.2-1ubuntu2_amd64.deb
#rm -f ./*.deb

cd $curdir
cp cap.tar.gz gomp.tar.xz /lib/x86_64-linux-gnu/
cd /lib/x86_64-linux-gnu
tar -zxvf cap.tar.gz
rm -f cap.tar.gz
tar -Jxvf gomp.tar.xz
rm -f gomp.tar.xz

cd $curdir
#cp -rf fonts /lib/
cp -rf fonts /usr/share/

#安装包-----------------------------------------------------------------------------------------
cp $curdir/source.list /etc/apt/sources.list #
cd $curdir/debpack

dpkg -i ethstatus_0.4.9_amd64.deb

dpkg -i openssh-client_1%3a8.2p1-4ubuntu0.2_amd64.deb
dpkg -i libwrap0_7.6.q-30_amd64.deb
dpkg -i ncurses-term_6.2-0ubuntu2_all.deb
dpkg -i openssh-sftp-server_1%3a8.2p1-4ubuntu0.2_amd64.deb
dpkg -i openssh-server_1%3a8.2p1-4ubuntu0.2_amd64.deb
dpkg -i ssh-import-id_5.10-0ubuntu1_all.deb
/etc/init.d/ssh restart

dpkg -i rar_2%3a5.5.0-1build1_amd64.deb

dpkg -i net-tools_1.60+git20180626.aebd88e-1ubuntu1_amd64.deb
#wireless-tools
dpkg -i libiw30_30~pre9-13ubuntu1_amd64.deb
dpkg -i wireless-tools_30~pre9-13ubuntu1_amd64.deb
#wpa
dpkg -i libnl-route-3-200_3.4.0-1_amd64.deb
dpkg -i libpcsclite1_1.8.26-3_amd64.deb
dpkg -i wpasupplicant_2%3a2.9-1ubuntu4.3_amd64.deb

#grub-----------------------------------------------------------------------------------------
cd $curdir
cp -f grub /etc/default/
cp -f rcS /etc/default/
cp -f 00_header /etc/grub.d/
cp -f 10_linux /etc/grub.d/
update-grub

cd $curdir
cp 10-network-security.conf /etc/sysctl.d/
ufw disable

#开机时间等等network
cd $curdir
cp systemd-networkd-wait-online.service /etc/systemd/system/network-online.target.wants/

#root自动登录 --不能设置root密码 --ssh也无法使用root登陆
cd $curdir
cp getty@tty1.service /etc/systemd/system/getty.target.wants/
cp passwd /etc/passwd

#crontab
cd $curdir
cp -f crontab_root.txt /var/spool/cron/crontabs/root
crontab -u root /var/spool/cron/crontabs/root
service cron restart

cd $curdir
#时间区
rm /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

cd $curdir
cp dvcmvscf.cft /var/.vcmvscf.cft   #试用时间管理
cp pointercal /etc/pointercal
cp -rdf bin-AOI/* /root/bin-AOI
cp dprofile /root/.profile

cd $curdir
cp -f root_dbashrc /root/.bashrc
source /root/.bashrc

cd $curdir #获取vcmvscf
#cp getvcmvscf /root/bin-AOI
#./getvcmvscf-16 #成功注册会重启














