Add linkding

This commit is contained in:
thomas 2023-01-18 01:56:13 +01:00
parent 8e369abbb2
commit d71fcdf702
7 changed files with 119 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#### linkding
##### Information
Site : https://github.com/sissbruecker/linkding
Source : https://github.com/sissbruecker/linkding
##### Install
```bash
apt install -y wget ca-certificates
wget -qO - https://deb.lgy.fr/install.sh | bash
apt-get update
apt-get install -y linkding
su - -s /usr/bin/bash linkding -c "export LD_SUPERUSER_NAME=thomas;export LD_SUPERUSER_PASSWORD=supertoto;python /usr/share/linkding/manage.py create_initial_superuser"
systemctl enable --now linkding
```

55
ressources/linkding/debmaker Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash
VERSION=1.15.1
APP=linkding
DEPOT=https://github.com/sissbruecker/linkding
GIT_VERSION=last
DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M)
DEBIAN_VERSION_CODENAME=bookworm
IMAGE_SIZE=6
PACKAGE_DEPENDENCY="nodejs python-is-python3 python3-pip"
main(){
base_package_upgrade
envinit
get_git_source
build
makedeb
}
envinit() {
configure_depot_nodejs
install_package_dependency
}
build() {
cd /tmp/${APP}/
pip3 install -r requirements.txt
npm install
npm run build
python manage.py compilescss
python manage.py collectstatic --ignore=*.scss
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
cd /tmp/${APP}/
mkdir -p ${PATH_DEB}/usr/share/linkding/
cp -pfr bookmarks siteroot assets static node_modules manage.py requirements.prod.txt requirements.txt ${PATH_DEB}/usr/share/linkding/
mkdir -p ${PATH_DEB}/etc/default
cp -p .env.sample ${PATH_DEB}/etc/default/linkding
mkdir -p ${PATH_DEB}/var/lib/linkding/data
ln -s /var/lib/linkding/data ${PATH_DEB}/usr/share/linkding/data
cp version.txt ${PATH_DEB}/var/lib/linkding/
mkdir -p ${PATH_DEB}/usr/lib/systemd/system/
cp -p /tmp/src//linkding.service ${PATH_DEB}/usr/lib/systemd/system/
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,16 @@
[Unit]
Description=linkding
After=network.target
[Service]
EnvironmentFile=/etc/default/linkding
ExecStart=/usr/bin/python3 /usr/share/linkding/manage.py runserver 0.0.0.0:8000
WorkingDirectory=/var/lib/linkding
StandardOutput=inherit
StandardError=inherit
Restart=always
User=linkding
Group=linkding
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
/etc/default/linkding

View File

@ -0,0 +1,8 @@
Package: linkding
Version: %VERSION%
Section: contrib
Priority: optional
Architecture: all
Depends: python3 ( >= 3.10 ), python-is-python3, python3-pip, build-essential, python3-dev
Maintainer: Thomas Legay <thomas@lgy.fr>
Description: linkding

View File

@ -0,0 +1,19 @@
#!/bin/bash
#Allready create on package then no -md
id linkding &> /dev/null || useradd linkding -r -s /bin/false -d /var/lib/linkding
chown linkding:linkding /var/lib/linkding -R
#Need to be remove because usr need to be in read only
chown linkding:linkding /usr/share/linkding/bookmarks/static -R
su - -s /usr/bin/bash linkding -c "pip3 install -r /usr/share/linkding/requirements.txt --no-warn-script-location"
#Upgrade Database
su - -s /usr/bin/bash linkding -c "python /usr/share/linkding/manage.py migrate"
#Create secret
su - -s /usr/bin/bash linkding -c "python /usr/share/linkding/manage.py generate_secret_key"