From 5e8687e41fed241754bfcdec324c2f443a994c03 Mon Sep 17 00:00:00 2001 From: emmett1 Date: Sat, 15 Sep 2018 18:03:29 +0800 Subject: [PATCH] updated --- extra/portcreate | 18 ++++++++ extra/schroot | 18 ++++++++ extra/updateconf | 18 ++++++++ pkgadd | 107 +++++++++++++++++++++++++++++------------------ pkgbuild | 30 ++++++++++--- pkgcreate | 18 ++++++++ pkgdel | 35 ++++++++++++---- pkgdeplist | 28 ++++++++++--- pkglibdepends | 22 +++++++++- revdep | 18 ++++++++ scratch | 30 ++++++++++--- scratchpkg.repo | 1 + spkgbuild.proto | 1 - 13 files changed, 276 insertions(+), 68 deletions(-) diff --git a/extra/portcreate b/extra/portcreate index a691609..e583593 100755 --- a/extra/portcreate +++ b/extra/portcreate @@ -1,4 +1,22 @@ #!/bin/bash +# +# scratchpkg +# +# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# if [ -d $1 ]; then echo "ERROR: Directory '$1' already exist!" diff --git a/extra/schroot b/extra/schroot index c3d421c..1289c7e 100755 --- a/extra/schroot +++ b/extra/schroot @@ -1,4 +1,22 @@ #!/bin/bash +# +# scratchpkg +# +# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# RED='\e[0;31m' #Red GREEN='\e[0;32m' #Green diff --git a/extra/updateconf b/extra/updateconf index 739795f..2f37685 100755 --- a/extra/updateconf +++ b/extra/updateconf @@ -1,4 +1,22 @@ #!/bin/bash +# +# scratchpkg +# +# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# if [ "$UID" != 0 ]; then echo "This operation need root access. Exiting..." diff --git a/pkgadd b/pkgadd index 259df61..fc60ff8 100755 --- a/pkgadd +++ b/pkgadd @@ -1,10 +1,28 @@ #!/bin/bash +# +# scratchpkg +# +# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# -RED='\e[0;31m' #Red -GREEN='\e[0;32m' #Green -YELLOW='\e[0;33m' #Yellow -CYAN='\e[0;36m' #Cyan -CRESET='\e[0m' #Reset color +RED='\e[0;31m' +GREEN='\e[0;32m' +YELLOW='\e[0;33m' +CYAN='\e[0;36m' +CRESET='\e[0m' trap "interrupted" SIGHUP SIGINT SIGQUIT SIGTERM @@ -132,16 +150,18 @@ parse_opts() { ret() { # remove lock file on exit - rm -f $LOCK_FILE + rm -fr $LOCK_FILE $TMP_PKGADD exit $1 } parse_opts $(extract_opt $@) -INDEX_DIR=$ROOT/var/lib/scratchpkg/index -LOCK_FILE=$ROOT/tmp/spkg.lock -TMP_PKGINSTALL=$ROOT/var/lib/scratchpkg/spkg.install -TMP_PKGINSTALL_BKP=$ROOT/var/lib/scratchpkg/spkg.bkp.install +INDEX_DIR="$ROOT/var/lib/scratchpkg/index" +PKGADD_DIR="$ROOT/var/lib/scratchpkg" +TMP_PKGADD="$PKGADD_DIR/$(basename $0)-$$" +LOCK_FILE="$PKGADD_DIR/spkg.lock" +TMP_PKGINSTALL="$TMP_PKGADD/$(basename $0).install" +TMP_PKGINSTALL_BKP="$TMP_PKGADD/$(basename $0).bkp.install" HOOK_DIR=/etc/hooks # show help page @@ -155,7 +175,7 @@ if [ "$NOCOLOR" ]; then nocolor fi -mkdir -p $INDEX_DIR +mkdir -p $INDEX_DIR $PKGADD_DIR $TMP_PKGADD # check for lock file if [ -f $LOCK_FILE ]; then @@ -206,7 +226,8 @@ fi echo -ne "Loading $BASEPKGNAME...\033[0K\r" # check integrity of package -if ! tar -tf $PKGNAME &>/dev/null; then +tar -tf $PKGNAME > $TMP_PKGADD/files 2>/dev/null +if [ $? != 0 ]; then msgerr "Package '$1' is corrupted!" ret 1 fi @@ -252,7 +273,7 @@ if [ ! "$IGNORE_CONFLICT" ]; then fileconflict+=(${line}) fi fi - done < <(tar -tf "$PKGNAME" --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]} | grep -v '/$') + done < <(cat $TMP_PKGADD/files | grep -Ev '(.pkginfo|.pkginstall|.pkgreadme)' | grep -v '/$') if [ "${#fileconflict[@]}" -gt 0 ]; then [ "$SILENT_INSTALL" ] && echo @@ -264,29 +285,29 @@ if [ ! "$IGNORE_CONFLICT" ]; then fi fi -if [ "$ROOT" = "" ]; then - if [ ! "$REINSTALL_PKG" ]; then - if [ $(tar -tf "$PKGNAME" | grep -x ".pkginstall") ]; then - source <(tar -xf "$PKGNAME" .pkginstall -O) - fi - fi +if [ $(grep -x .pkginstall $TMP_PKGADD/files) ]; then + source <(tar -xf "$PKGNAME" .pkginstall -O) fi # run preinstall script if no --no-preinstall flag and not upgrade package -if [ ! "$NO_PREINSTALL" ] && [ ! "$UPGRADE_PKG" ]; then - if [ "`type -t pre_install`" = "function" ]; then - [ "$SILENT_INSTALL" ] || msg2 "Running preinstall script..." - pre_install "$version" &>/dev/null +( cd $ROOT/ + if [ ! "$NO_PREINSTALL" ] && [ ! "$UPGRADE_PKG" ]; then + if [ "`type -t pre_install`" = "function" ]; then + [ "$SILENT_INSTALL" ] || msg2 "Running preinstall script..." + pre_install "$version" &>/dev/null + fi fi -fi +) # run preupgrade script if package upgrade -if [ "$UPGRADE_PKG" ] && [ ! "$NO_PREUPGRADE" ]; then - if [ "`type -t pre_upgrade`" = "function" ]; then - [ "$SILENT_INSTALL" ] || msg2 "Running preupgrade script..." - pre_upgrade "$version" "$iversion" &>/dev/null +( cd $ROOT/ + if [ "$UPGRADE_PKG" ] && [ ! "$NO_PREUPGRADE" ]; then + if [ "`type -t pre_upgrade`" = "function" ]; then + [ "$SILENT_INSTALL" ] || msg2 "Running preupgrade script..." + pre_upgrade "$version" "$iversion" &>/dev/null + fi fi -fi +) #installing package into system [ "$SILENT_INSTALL" ] || msg2 "Extracting package..." @@ -334,19 +355,23 @@ mv $TMP_PKGINSTALL $INDEX_DIR/$name/.files [ -f $TMP_PKGINSTALL_BKP ] && mv $TMP_PKGINSTALL_BKP $INDEX_DIR/$name/.bkpfiles tar -x -f $PKGNAME -C $INDEX_DIR/$name .pkginstall .pkgreadme >/dev/null 2>&1 -if [ ! "$NO_POSTINSTALL" ] && [ ! "$UPGRADE_PKG" ]; then - if [ "`type -t post_install`" = "function" ]; then - [ "$SILENT_INSTALL" ] || msg2 "Running postinstall script..." - post_install "$version" &>/dev/null +( cd $ROOT/ + if [ ! "$NO_POSTINSTALL" ] && [ ! "$UPGRADE_PKG" ]; then + if [ "`type -t post_install`" = "function" ]; then + [ "$SILENT_INSTALL" ] || msg2 "Running postinstall script..." + post_install "$version" &>/dev/null + fi fi -fi +) -if [ "$UPGRADE_PKG" ] && [ ! "$NO_POSTUPGRADE" ]; then - if [ "`type -t post_upgrade`" = "function" ]; then - [ "$SILENT_INSTALL" ] || msg2 "Running postupgrade script..." - post_upgrade "$version" "$iversion" &>/dev/null +( cd $ROOT/ + if [ "$UPGRADE_PKG" ] && [ ! "$NO_POSTUPGRADE" ]; then + if [ "`type -t post_upgrade`" = "function" ]; then + [ "$SILENT_INSTALL" ] || msg2 "Running postupgrade script..." + post_upgrade "$version" "$iversion" &>/dev/null + fi fi -fi +) if [ "$ROOT" = "" ]; then runhooks @@ -360,8 +385,8 @@ else fi # running ldconfig -if [ "$ROOT" = "" ] && [ -x /sbin/ldconfig ]; then - /sbin/ldconfig +if [ -x /sbin/ldconfig ]; then + /sbin/ldconfig -r $ROOT/ fi ret 0 diff --git a/pkgbuild b/pkgbuild index d077b02..8675e50 100755 --- a/pkgbuild +++ b/pkgbuild @@ -1,10 +1,28 @@ #!/bin/bash +# +# scratchpkg +# +# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# -RED='\e[0;31m' #Red -GREEN='\e[0;32m' #Green -YELLOW='\e[0;33m' #Yellow -CYAN='\e[0;36m' #Cyan -CRESET='\e[0m' #Reset color +RED='\e[0;31m' +GREEN='\e[0;32m' +YELLOW='\e[0;33m' +CYAN='\e[0;36m' +CRESET='\e[0m' msg() { echo -e "${GREEN}==>${CRESET} $1" @@ -662,7 +680,7 @@ PKGBUILD_BSCRIPT="spkgbuild" SOURCE_DIR="/var/cache/scratchpkg/sources" PACKAGE_DIR="/var/cache/scratchpkg/packages" -WORK_DIR="/var/cache/scratchpkg/work" +WORK_DIR="/tmp/pkgbuild" OPTIONS=(!libtool emptydirs strip docs purge zipman buildflags makeflags) DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc}) diff --git a/pkgcreate b/pkgcreate index cb79a9e..a1e3f08 100755 --- a/pkgcreate +++ b/pkgcreate @@ -1,4 +1,22 @@ #!/bin/bash +# +# scratchpkg +# +# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# name=${1:-foo} version=${2:-0.1} diff --git a/pkgdel b/pkgdel index a8756f6..db2fc16 100755 --- a/pkgdel +++ b/pkgdel @@ -1,10 +1,28 @@ #!/bin/bash +# +# scratchpkg +# +# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# -RED='\e[0;31m' #Red -GREEN='\e[0;32m' #Green -YELLOW='\e[0;33m' #Yellow -CYAN='\e[0;36m' #Cyan -CRESET='\e[0m' #Reset color +RED='\e[0;31m' +GREEN='\e[0;32m' +YELLOW='\e[0;33m' +CYAN='\e[0;36m' +CRESET='\e[0m' trap "interrupted" SIGHUP SIGINT SIGQUIT SIGTERM @@ -134,9 +152,10 @@ ret() { parse_opts $(extract_opt $@) -INDEX_DIR=$ROOT/var/lib/scratchpkg/index -LOCK_FILE=$ROOT/tmp/spkg.lock -HOOK_DIR=/etc/hook +INDEX_DIR="$ROOT/var/lib/scratchpkg/index" +PKGDEL_DIR="$ROOT/var/lib/scratchpkg" +LOCK_FILE="$PKGDEL_DIR/spkg.lock" +HOOK_DIR="/etc/hook" # show help page if [ "$SHOWHELP" ] || [ -z "$RMNAME" ]; then diff --git a/pkgdeplist b/pkgdeplist index bd670fa..1e4aab6 100755 --- a/pkgdeplist +++ b/pkgdeplist @@ -1,10 +1,28 @@ #!/bin/bash +# +# scratchpkg +# +# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# -RED='\e[0;31m' #Red -GREEN='\e[0;32m' #Green -YELLOW='\e[0;33m' #Yellow -CYAN='\e[0;36m' #Cyan -CRESET='\e[0m' #Reset color +RED='\e[0;31m' +GREEN='\e[0;32m' +YELLOW='\e[0;33m' +CYAN='\e[0;36m' +CRESET='\e[0m' INDEX_DIR="/var/lib/scratchpkg/index" REPO_FILE="/etc/scratchpkg.repo" diff --git a/pkglibdepends b/pkglibdepends index 238aee6..7a0fa0b 100755 --- a/pkglibdepends +++ b/pkglibdepends @@ -1,4 +1,24 @@ -#!/bin/bash -e +#!/bin/bash +# +# scratchpkg +# +# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +set -e INDEX_DIR="/var/lib/scratchpkg/index" diff --git a/revdep b/revdep index 545ace9..77dfd0a 100755 --- a/revdep +++ b/revdep @@ -1,4 +1,22 @@ #!/bin/bash +# +# scratchpkg +# +# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# while read line; do if [[ $(echo ${line::1}) = "/" ]]; then diff --git a/scratch b/scratch index 50a614e..85209cb 100755 --- a/scratch +++ b/scratch @@ -1,11 +1,29 @@ #!/bin/bash +# +# scratchpkg +# +# Copyright (c) 2018 by Emmett1 (emmett1.2miligrams@gmail.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# -RED='\e[0;31m' #Red -GREEN='\e[0;32m' #Green -YELLOW='\e[0;33m' #Yellow -CYAN='\e[0;36m' #CyanBlue -PURPLE='\e[0;35m' #Purple -CRESET='\e[0m' #Reset color +RED='\e[0;31m' +GREEN='\e[0;32m' +YELLOW='\e[0;33m' +CYAN='\e[0;36m' +PURPLE='\e[0;35m' +CRESET='\e[0m' msg() { echo -e "${GREEN}==>${CRESET} $1" diff --git a/scratchpkg.repo b/scratchpkg.repo index 4dda314..4b1a6cd 100644 --- a/scratchpkg.repo +++ b/scratchpkg.repo @@ -9,6 +9,7 @@ /usr/ports/xorg https://raw.githubusercontent.com/emmett1/ports/master/xorg /usr/ports/xfce4 https://raw.githubusercontent.com/emmett1/ports/master/xfce4 /usr/ports/kf5 https://raw.githubusercontent.com/emmett1/ports/master/kf5 +/usr/ports/mate https://raw.githubusercontent.com/emmett1/ports/master/mate /usr/ports/lxde https://raw.githubusercontent.com/emmett1/ports/master/lxde /usr/ports/extra https://raw.githubusercontent.com/emmett1/ports/master/extra /usr/ports/git https://raw.githubusercontent.com/emmett1/ports/master/git diff --git a/spkgbuild.proto b/spkgbuild.proto index 3629354..4a21e3d 100644 --- a/spkgbuild.proto +++ b/spkgbuild.proto @@ -1,6 +1,5 @@ # description : # backup : -# conflict : # depends : # noextract :