adapt package to use --path argument

This commit is contained in:
Gilrain 2016-08-05 17:15:12 +02:00
parent 063e65e790
commit 8f023cd853
6 changed files with 54 additions and 15 deletions

View file

@ -1,9 +1,9 @@
# Generated by mksrcinfo v8
# Sun Jul 31 15:47:26 UTC 2016
# Fri Aug 5 15:12:33 UTC 2016
pkgbase = asf
pkgdesc = Steam cards farmer.
pkgver = 2.1.3.1
pkgrel = 1
pkgrel = 2
url = https://github.com/JustArchi/ArchiSteamFarm
install = asf.install
changelog = changelog
@ -11,14 +11,17 @@ pkgbase = asf
license = Apache
depends = mono
backup = opt/asf/config/ASF.json
backup = var/lib/asf/ASF.json
source = https://github.com/JustArchi/ArchiSteamFarm/releases/download/2.1.3.1/ASF.zip
source = asf.sh
source = asf-config.sh
source = asf.service
source = asf-user.service
sha256sums = 43db7c2729551fcb7f546a473f6fd90ab7ca296f641f55334b240f3c39109f16
sha256sums = a5d0324c029efb1f99264e787fea26ad53953b4df59bf642bca1ffabad4027f5
sha256sums = 63b8d4718e8cc61016ef415ff418e6180102b077315f5ce77bfcab9c03433565
sha256sums = afeee8eb3f1bafa1b0502ce6be43e5119ab73fdc228a49990c9087462c5464af
sha256sums = 580845c04b2add412f9bc642c429a5dad274d5f637da42dc95ba10993cab7825
sha256sums = c50da9f236788ebce411ff2db524279b22a9077b5d69f4262a2cfe307152c2a1
pkgname = asf

View file

@ -2,33 +2,38 @@
pkgname="asf"
pkgver="2.1.3.1"
pkgrel=1
pkgrel=2
pkgdesc="Steam cards farmer."
arch=('any')
url="https://github.com/JustArchi/ArchiSteamFarm"
license=('Apache')
depends=('mono')
changelog=changelog
backup=('opt/asf/config/ASF.json')
backup=('opt/asf/config/ASF.json' 'var/lib/asf/ASF.json')
install=${pkgname}.install
source=("https://github.com/JustArchi/ArchiSteamFarm/releases/download/${pkgver}/ASF.zip"
"${pkgname}.sh"
"${pkgname}-config.sh"
"${pkgname}.service")
"${pkgname}.service"
"${pkgname}-user.service")
sha256sums=('43db7c2729551fcb7f546a473f6fd90ab7ca296f641f55334b240f3c39109f16'
'a5d0324c029efb1f99264e787fea26ad53953b4df59bf642bca1ffabad4027f5'
'63b8d4718e8cc61016ef415ff418e6180102b077315f5ce77bfcab9c03433565'
'afeee8eb3f1bafa1b0502ce6be43e5119ab73fdc228a49990c9087462c5464af')
'580845c04b2add412f9bc642c429a5dad274d5f637da42dc95ba10993cab7825'
'c50da9f236788ebce411ff2db524279b22a9077b5d69f4262a2cfe307152c2a1')
package() {
install -d -m 755 "${pkgdir}/opt/${pkgname}"
cp -dpr --no-preserve=ownership *.exe config "${pkgdir}/opt/${pkgname}"
install -d -m 755 "${pkgdir}/var/lib/${pkgname}"
cp -dp --no-preserve=ownership *.exe "${pkgdir}/opt/${pkgname}"
cp -dp --no-preserve=ownership config/* "${pkgdir}/var/lib/${pkgname}"
install -D -m755 "${srcdir}/${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}"
install -D -m755 "${srcdir}/${pkgname}-config.sh" "${pkgdir}/usr/bin/${pkgname}-config"
install -D -m644 "${srcdir}/${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
install -D -m644 "${srcdir}/${pkgname}-user.service" "${pkgdir}/usr/lib/systemd/user/${pkgname}.service"
# disable auto-updates and version checks
sed -i 's/"AutoUpdates": true,/"AutoUpdates": false,/g' ${pkgdir}/opt/asf/config/ASF.json
sed -i 's/"UpdateChannel": 1,/"UpdateChannel": 0,/g' ${pkgdir}/opt/asf/config/ASF.json
sed -i 's/"AutoUpdates": true,/"AutoUpdates": false,/g' ${pkgdir}/var/lib/asf/ASF.json
sed -i 's/"UpdateChannel": 1,/"UpdateChannel": 0,/g' ${pkgdir}/var/lib/asf/ASF.json
}

10
asf-user.service Normal file
View file

@ -0,0 +1,10 @@
[Unit]
Description=ArchiSteamFarm User Service
Documentation=https://github.com/JustArchi/ArchiSteamFarm/wiki
Wants=network.target
[Service]
ExecStart=/usr/bin/asf --server --path %h/.config/asf
[Install]
WantedBy=default.target

View file

@ -5,15 +5,30 @@ post_install() {
groupadd -r asf &> /dev/null
fi
if grep -q "^asf:" /etc/passwd 2> /dev/null ; then
usermod -s /bin/false -c "ArchiSteamFarm daemon" -d /opt/asf -g asf asf &> /dev/null
usermod -s /bin/false -c "ArchiSteamFarm daemon" -d /var/lib/asf -g asf asf &> /dev/null
else
useradd -s /bin/false -c "ArchiSteamFarm daemon user" -d /opt/asf -g asf -r asf &> /dev/null
useradd -s /bin/false -c "ArchiSteamFarm daemon user" -d /var/lib/asf -g asf -r asf &> /dev/null
fi
chown -R asf: /opt/asf
chown -R asf: /var/lib/asf
}
post_upgrade() {
post_install $1
if [ "$(vercmp $2 2.1.3.1-2)" -lt 0 ] && [ grep -q "^asf:" /etc/passwd 2> /dev/null]; then
usermod -s /bin/false -c "ArchiSteamFarm daemon" -d /var/lib/asf -g asf asf &> /dev/null
fi
if [ "$(vercmp $2 2.1.3.1-2)" -lt 0 ] && [ -d /opt/asf/config ]; then
mv /opt/asf/config/* /var/lib/asf/
rm -rf /opt/asf/config/
mv /opt/asf/log.txt /var/lib/asf/
mv /var/lib/asf/ASF.json.pacsave /var/lib/asf/ASF.json
chown -R asf: /var/lib/asf
echo "# ASF config folder has been moved to /var/lib/asf"
echo "# Consider this change when using /usr/bin/asf (e.g. 'asf --path /var/lib/asf')"
fi
}
post_remove() {

View file

@ -7,9 +7,9 @@ After=network.target
[Service]
User=asf
Group=asf
ExecStart=/usr/bin/asf --server
ExecStart=/usr/bin/asf --server --path /var/lib/asf
ProtectSystem=true
ReadWritePaths=/opt/asf
ReadWritePaths=/var/lib/asf
[Install]
WantedBy=multi-user.target

View file

@ -1,3 +1,9 @@
2016-08-05 Gilrain <gilrain+libre.arch A_T castelmo DOT_ re>
* 2.1.3.1-2:
package: config folder moved to /var/lib/asf
service: rename ReadWriteDirectories to ReadWritePaths
service: soft dependency on network.target
service: add user service file
2016-07-24 Gilrain <gilrain+libre.arch A_T castelmo DOT_ re>
* 2.1.3.1-1:
It's now possible to use CustomGamePlayedWhileIdle and GamesPlayedWhileIdle at the same time, to play specific appIDs while showing custom status in Steam Network. Please note that the order of display is not guaranteed in this case.