This commit is contained in:
emmett1
2018-09-15 18:03:29 +08:00
parent e8ac380c1a
commit 5e8687e41f
13 changed files with 276 additions and 68 deletions

View File

@@ -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 <https://www.gnu.org/licenses/>.
#
if [ -d $1 ]; then
echo "ERROR: Directory '$1' already exist!"

View File

@@ -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 <https://www.gnu.org/licenses/>.
#
RED='\e[0;31m' #Red
GREEN='\e[0;32m' #Green

View File

@@ -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 <https://www.gnu.org/licenses/>.
#
if [ "$UID" != 0 ]; then
echo "This operation need root access. Exiting..."

107
pkgadd
View File

@@ -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 <https://www.gnu.org/licenses/>.
#
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

View File

@@ -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 <https://www.gnu.org/licenses/>.
#
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})

View File

@@ -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 <https://www.gnu.org/licenses/>.
#
name=${1:-foo}
version=${2:-0.1}

35
pkgdel
View File

@@ -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 <https://www.gnu.org/licenses/>.
#
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

View File

@@ -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 <https://www.gnu.org/licenses/>.
#
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"

View File

@@ -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 <https://www.gnu.org/licenses/>.
#
set -e
INDEX_DIR="/var/lib/scratchpkg/index"

18
revdep
View File

@@ -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 <https://www.gnu.org/licenses/>.
#
while read line; do
if [[ $(echo ${line::1}) = "/" ]]; then

30
scratch
View File

@@ -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 <https://www.gnu.org/licenses/>.
#
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"

View File

@@ -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

View File

@@ -1,6 +1,5 @@
# description :
# backup :
# conflict :
# depends :
# noextract :