Add adguardhome

Add .gitkeep on empty folder
This commit is contained in:
thomas 2022-02-27 00:50:15 +01:00
parent 51bcd703d6
commit d7aa6ba89c
39 changed files with 112 additions and 3 deletions

View file

@ -15,6 +15,7 @@ debmaker_run
### packages available in shared repository ### packages available in shared repository
- [authelia](#authelia) - [authelia](#authelia)
- [adguardhome](#adguardhome)
- [element-web](#element-web) - [element-web](#element-web)
- [gotify](#gotify) - [gotify](#gotify)
- [grocy](#grocy) - [grocy](#grocy)
@ -26,6 +27,16 @@ debmaker_run
- [wallabag](#wallabag) - [wallabag](#wallabag)
- [zigbee2mqtt](#zigbee2mqtt) - [zigbee2mqtt](#zigbee2mqtt)
#### adguardhome
apt install -y wget ca-certificates
wget -qO - https://deb.lgy.fr/install.sh | bash
apt-get update
apt-get install -y adguardhome
systemctl enable --now adguardhome
#configuration with http://<ip>:3000
#### authelia #### authelia
apt install -y wget ca-certificates apt install -y wget ca-certificates
wget -qO - https://deb.lgy.fr/install.sh | bash wget -qO - https://deb.lgy.fr/install.sh | bash

10
adguardhome2deb Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
APP=adguardhome
VERSION=0.108.0-b.3
GIT_VERSION=v$VERSION
DEB_VERSION=$VERSION-1
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=4
source ./lib/function.sh

View file

@ -1,15 +1,18 @@
#!/bin/bash #!/bin/bash
source ressources/${APP}/${APP} source ressources/${APP}/${APP}
DEBOOTSTRAP_DIR=cache/debootstrap/ DEBOOTSTRAP_DIR=cache/debootstrap/
MOUNT_PATH=/mnt/debmaker MOUNT_PATH=/mnt/debmaker
zdebmaker_getDep(){ zdebmaker_getDep(){
sudo sleep 0
[ -d cache ] || mkdir cache [ -d cache ] || mkdir cache
[ -d dist ] || mkdir dist [ -d dist ] || mkdir dist
[ -d ${DEBOOTSTRAP_DIR} ] || debmaker_debootstrapUpdate [ -d ${DEBOOTSTRAP_DIR} ] || debmaker_debootstrapUpdate
} }
zdebmaker_createOS(){ zdebmaker_createOS(){
zdebmaker_getDep
dd if=/dev/zero of=cache/${DEBIAN_VERSION_CODENAME}.tmp bs=100M count=5 dd if=/dev/zero of=cache/${DEBIAN_VERSION_CODENAME}.tmp bs=100M count=5
sudo mkfs.ext4 cache/${DEBIAN_VERSION_CODENAME}.tmp sudo mkfs.ext4 cache/${DEBIAN_VERSION_CODENAME}.tmp
[ -d ${MOUNT_PATH}/${DEBIAN_VERSION_CODENAME}/ ] || sudo mkdir -p ${MOUNT_PATH}/${DEBIAN_VERSION_CODENAME}/ [ -d ${MOUNT_PATH}/${DEBIAN_VERSION_CODENAME}/ ] || sudo mkdir -p ${MOUNT_PATH}/${DEBIAN_VERSION_CODENAME}/
@ -20,6 +23,7 @@ zdebmaker_createOS(){
} }
zdebmaker_createAppOS(){ zdebmaker_createAppOS(){
zdebmaker_getDep
[ -f cache/${DEBIAN_VERSION_CODENAME} ] || zdebmaker_createOS [ -f cache/${DEBIAN_VERSION_CODENAME} ] || zdebmaker_createOS
[ "${IMAGE_SIZE}" == "" ] && IMAGE_SIZE=2 [ "${IMAGE_SIZE}" == "" ] && IMAGE_SIZE=2
@ -37,18 +41,21 @@ zdebmaker_createAppOS(){
} }
zdebmaker_inject(){ zdebmaker_inject(){
zdebmaker_getDep
sudo mount cache/${APP} ${MOUNT_PATH}/${APP}/ sudo mount cache/${APP} ${MOUNT_PATH}/${APP}/
[ -d ${MOUNT_PATH}/${APP}/tmp/dist ] || sudo mkdir ${MOUNT_PATH}/${APP}/tmp/dist/ [ -d ${MOUNT_PATH}/${APP}/tmp/dist ] || sudo mkdir ${MOUNT_PATH}/${APP}/tmp/dist/
[ -d ${MOUNT_PATH}/${APP}/tmp/src ] && sudo rm -rf ${MOUNT_PATH}/${APP}/tmp/src/ [ -d ${MOUNT_PATH}/${APP}/tmp/src ] && sudo rm -rf ${MOUNT_PATH}/${APP}/tmp/src/
sudo mkdir -p ${MOUNT_PATH}/${APP}/tmp/src sudo mkdir -p ${MOUNT_PATH}/${APP}/tmp/src
sudo cp -fr ressources/${APP}/* ${MOUNT_PATH}/${APP}/tmp/src sudo cp -fr ressources/${APP}/* ${MOUNT_PATH}/${APP}/tmp/src
sudo cp -fr lib/exec_in_chroot.sh ${MOUNT_PATH}/${APP}/tmp/src sudo cp -fr lib/exec_in_chroot.sh ${MOUNT_PATH}/${APP}/tmp/src
find ${MOUNT_PATH}/${APP}/tmp/src -name .gitkeep -exec rm {} \;
sudo umount ${MOUNT_PATH}/${APP}/ sudo umount ${MOUNT_PATH}/${APP}/
} }
debmaker_mount_proc_sys(){ debmaker_mount_proc_sys(){
OPEN_FILE=$1 OPEN_FILE=$1
OPEN_DIR=$2 OPEN_DIR=$2
zdebmaker_getDep
[ -d ${OPEN_FILE} ] || sudo mkdir -p ${OPEN_DIR} [ -d ${OPEN_FILE} ] || sudo mkdir -p ${OPEN_DIR}
sudo mount ${OPEN_FILE} ${OPEN_DIR} sudo mount ${OPEN_FILE} ${OPEN_DIR}
[ -d ${OPEN_DIR}/proc ] || sudo mkdir -p ${OPEN_DIR}/proc [ -d ${OPEN_DIR}/proc ] || sudo mkdir -p ${OPEN_DIR}/proc
@ -59,6 +66,7 @@ debmaker_mount_proc_sys(){
debmaker_umount_proc_sys(){ debmaker_umount_proc_sys(){
OPEN_DIR=$1 OPEN_DIR=$1
zdebmaker_getDep
sudo umount ${OPEN_DIR}/sys sudo umount ${OPEN_DIR}/sys
sudo umount ${OPEN_DIR}/proc sudo umount ${OPEN_DIR}/proc
sudo umount ${OPEN_DIR} sudo umount ${OPEN_DIR}
@ -66,12 +74,14 @@ debmaker_umount_proc_sys(){
debmaker_chroot() { debmaker_chroot() {
OPEN_FILE=$1 OPEN_FILE=$1
zdebmaker_getDep
debmaker_mount_proc_sys ${OPEN_FILE} ${MOUNT_PATH}/${APP}/ debmaker_mount_proc_sys ${OPEN_FILE} ${MOUNT_PATH}/${APP}/
sudo chroot ${MOUNT_PATH}/${APP}/ sudo chroot ${MOUNT_PATH}/${APP}/
debmaker_umount_proc_sys ${MOUNT_PATH}/${APP}/ debmaker_umount_proc_sys ${MOUNT_PATH}/${APP}/
} }
debmaker_run(){ debmaker_run(){
zdebmaker_getDep
[ -f cache/${APP} ] || zdebmaker_createAppOS [ -f cache/${APP} ] || zdebmaker_createAppOS
zdebmaker_inject zdebmaker_inject
debmaker_mount_proc_sys cache/${APP} ${MOUNT_PATH}/${APP}/ debmaker_mount_proc_sys cache/${APP} ${MOUNT_PATH}/${APP}/
@ -84,11 +94,9 @@ debmaker_run(){
} }
debmaker_debootstrapUpdate(){ debmaker_debootstrapUpdate(){
zdebmaker_getDep
[ -d ${DEBOOTSTRAP_DIR} ] || mkdir ${DEBOOTSTRAP_DIR} [ -d ${DEBOOTSTRAP_DIR} ] || mkdir ${DEBOOTSTRAP_DIR}
URL=https://salsa.debian.org/installer-team/debootstrap/-/archive/master/debootstrap-master.tar.gz URL=https://salsa.debian.org/installer-team/debootstrap/-/archive/master/debootstrap-master.tar.gz
FILES="debootstrap-master/debootstrap debootstrap-master/scripts/ debootstrap-master/functions" FILES="debootstrap-master/debootstrap debootstrap-master/scripts/ debootstrap-master/functions"
wget -qO - ${URL} | tar -C ${DEBOOTSTRAP_DIR} --strip-components=1 -zx ${FILES} wget -qO - ${URL} | tar -C ${DEBOOTSTRAP_DIR} --strip-components=1 -zx ${FILES}
} }
zdebmaker_getDep

View file

@ -0,0 +1,34 @@
#!/bin/bash
STEP="envinit prebuild build makedeb"
envinit() {
apt install -y --no-install-recommends build-essential git wget ca-certificates dpkg fakeroot
wget -qO - https://deb.nodesource.com/setup_16.x | bash
wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarnkey.gpg
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" > /etc/apt/sources.list.d/yarn.list
apt-get update
apt-get install -y nodejs yarn
wget -qO - https://go.dev/dl/go1.17.7.linux-amd64.tar.gz | tar -C /usr/local -xz
}
prebuild(){
GIT_VERSION=$1
git clone --depth 1 -b ${GIT_VERSION} https://github.com/AdguardTeam/AdGuardHome.git /tmp/adguardhome
}
build() {
cd /tmp/adguardhome
PATH=$PATH:/usr/local/go/bin
make
}
makedeb(){
GIT_VERSION=$1
DEB_VERSION=$2
PATH_DEB=/tmp/src/rootfs
cp /tmp/adguardhome/AdGuardHome ${PATH_DEB}/usr/bin/adguardhome
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}

View file

@ -0,0 +1,7 @@
Package: adguardhome
Version: %VERSION%
Section: base
Priority: optional
Architecture: amd64
Maintainer: Thomas Legay <thomas@syngate.fr>
Description: adguardhome

View file

@ -0,0 +1,17 @@
[Unit]
Description=AdGuard Home: Network-level blocker
ConditionFileIsExecutable=/usr/bin/adguardhome
After=syslog.target network-online.target
[Service]
EnvironmentFile=-/etc/default/adguardhome
StartLimitInterval=5
StartLimitBurst=10
ExecStart=/usr/bin/adguardhome -c /etc/adguardhome.yaml -w /var/lib/adguardhome
WorkingDirectory=/var/lib/adguardhome
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@