mirror of
https://github.com/outbackdingo/scratchpkg.git
synced 2026-03-19 21:13:28 +00:00
updated
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash -e
|
||||
|
||||
index_dir="/var/spkg/index"
|
||||
INDEX_DIR="/var/lib/scratchpkg/index"
|
||||
|
||||
source "/usr/share/scratchpkg/color"
|
||||
source "/usr/share/scratchpkg/message"
|
||||
|
||||
basepkg=(linux-api-headers
|
||||
man-pages
|
||||
@@ -71,9 +74,10 @@ rc-init
|
||||
base-meta)
|
||||
|
||||
for list in ${basepkg[@]}; do
|
||||
if [ -d $index_dir/$list ]; then
|
||||
echo "$list is installed"
|
||||
if [ -d $INDEX_DIR/$list ]; then
|
||||
msg "$list is installed"
|
||||
else
|
||||
msg "Installing $list..."
|
||||
case $list in
|
||||
gcc | bash | perl | coreutils | filesystem )
|
||||
scratch -p $list -i -id -ic
|
||||
@@ -82,9 +86,12 @@ for list in ${basepkg[@]}; do
|
||||
scratch -p $list -i -id
|
||||
;;
|
||||
esac
|
||||
if [ ! -d /var/spkg/index/$list ]; then
|
||||
echo "ERROR $list"
|
||||
if [ ! -d $INDEX_DIR/$list ]; then
|
||||
msgerr "Failed installing $list."
|
||||
msgerr "Press ENTER to skip and continue, press CTRL + C to cancel."
|
||||
read
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "/usr/share/scratchpkg/color"
|
||||
source "/usr/share/scratchpkg/message"
|
||||
|
||||
if [ "$UID" != "0" ]; then
|
||||
echo "chroot need root access!"
|
||||
msgerr "Chroot need root access!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LFS=$1
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "Please set mount point for chroot!"
|
||||
msgerr "Please set mount point for chroot!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $LFS ]; then
|
||||
echo "Dir $LFS not exist"
|
||||
msgerr "Dir '$LFS' not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -44,3 +47,5 @@ umount -v $LFS/dev
|
||||
umount -v $LFS/run
|
||||
umount -v $LFS/proc
|
||||
umount -v $LFS/sys
|
||||
|
||||
exit $?
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
INDEX_DIR="/var/lib/scratchpkg/index"
|
||||
CONF_FILE="/etc/scratchpkg.conf"
|
||||
|
||||
if [ ! "$1" ]; then
|
||||
echo "Please specify package name to install."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d $INDEX_DIR/$1 ]; then
|
||||
echo "Package $1 already installed" && exit 0
|
||||
fi
|
||||
|
||||
source "$CONF_FILE"
|
||||
source "/usr/share/scratchpkg/color"
|
||||
source "/usr/share/scratchpkg/message"
|
||||
|
||||
pkgname=$1
|
||||
|
||||
checkpkg() {
|
||||
|
||||
for repo in ${PORT_REPO[@]}; do
|
||||
@@ -8,43 +26,32 @@ checkpkg() {
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ "$PORT_EXIST" ] || (echo "Port $pkgname not exist" && exit 1)
|
||||
[ "$PORT_EXIST" ] || (msgerr "Port '$pkgname' not exist" && exit 1)
|
||||
}
|
||||
|
||||
index_dir="/var/spkg/index"
|
||||
|
||||
if [ ! "$1" ]; then
|
||||
echo "specify package name to install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source /etc/scratchpkg.conf
|
||||
pkgname=$1
|
||||
checkpkg
|
||||
|
||||
if [ -d $index_dir/$1 ]; then
|
||||
echo "Package $1 already installed" && exit 0
|
||||
fi
|
||||
|
||||
for i in $(deplist $1 | awk '{print $1}'); do
|
||||
if [ -d $index_dir/$i ]; then
|
||||
continue
|
||||
else
|
||||
if [ $UID != 0 ]; then
|
||||
if [ -x /usr/bin/fakeroot ]; then
|
||||
echo "==> Build using fakeroot"
|
||||
fakeroot scratch -p $i && sudo scratch -p $i -i || exit 1
|
||||
else
|
||||
sudo scratch -p $i -i || exit 1
|
||||
fi
|
||||
depinst() {
|
||||
|
||||
for i in $(deplist $1 | awk '{print $1}'); do
|
||||
if [ -d $INDEX_DIR/$i ]; then
|
||||
continue
|
||||
else
|
||||
scratch -p $i -i || exit 1
|
||||
msg "Installing $i..."
|
||||
if [ $UID != 0 ]; then
|
||||
sudo scratch -p $i -i
|
||||
else
|
||||
scratch -p $i -i
|
||||
fi
|
||||
if [ ! -d $INDEX_DIR/$i ]; then
|
||||
msgerr "Failed installing $i."
|
||||
msgerr "Press ENTER to skip and continue, press CTRL + C to cancel."
|
||||
read
|
||||
fi
|
||||
fi
|
||||
if [ ! -d $index_dir/$i ]; then
|
||||
echo "Error installing $i..."
|
||||
read
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
checkpkg
|
||||
depinst
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
calcdep() {
|
||||
|
||||
dep=$(scratch -d $1 | awk '{print $3}')
|
||||
dep=$(scratch -d $1 | grep -v "port not exist" | awk '{print $3}')
|
||||
for i in $dep; do
|
||||
deps="$deps $i"
|
||||
done
|
||||
@@ -34,23 +34,22 @@ checkpkg() {
|
||||
[ "$PORT_EXIST" ] || (echo "Port $pkgname not exist" && exit 1)
|
||||
}
|
||||
|
||||
index_dir="/var/spkg/index"
|
||||
INDEX_DIR="/var/lib/scratchpkg/index"
|
||||
CONF_FILE="/etc/scratchpkg.conf"
|
||||
|
||||
if [ ! "$1" ]; then
|
||||
echo "specify package name to list its dependencies"
|
||||
echo "Please specify package name to list its dependencies"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source /etc/scratchpkg.conf
|
||||
source "$CONF_FILE"
|
||||
source "/usr/share/scratchpkg/color"
|
||||
pkgname=$1
|
||||
|
||||
checkpkg # check for existence port
|
||||
calcdep $pkgname # calculate dependencies
|
||||
loop # loop through all dependencies
|
||||
|
||||
#echo $deps | tr ' ' '\n'
|
||||
#read
|
||||
|
||||
# filter all same dependencies and sort backwards
|
||||
for i in $(echo $deps | tr ' ' '\n'); do
|
||||
[ $(echo $filterdep | tr ' ' '\n' | grep -x $i) ] || filterdep="$filterdep $i"
|
||||
@@ -59,8 +58,8 @@ done
|
||||
filterdep="$filterdep $pkgname" # add package to install to final dependency list
|
||||
|
||||
for alldep in $(echo $filterdep | tr ' ' '\n'); do
|
||||
if [ -d $index_dir/$alldep ]; then
|
||||
echo "$alldep [installed]"
|
||||
if [ -d $INDEX_DIR/$alldep ]; then
|
||||
echo -e "$alldep ${color_green}[installed]${color_reset}"
|
||||
else
|
||||
echo "$alldep"
|
||||
fi
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
INDEX_DIR="/var/lib/scratchpkg/index"
|
||||
|
||||
source "/usr/share/scratchpkg/color"
|
||||
source "/usr/share/scratchpkg/message"
|
||||
|
||||
if [ ! $1 ]; then
|
||||
echo -e "this script requires one arguments."
|
||||
exit 1
|
||||
msgerr "This script requires one arguments."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d /var/spkg/index/$1 ]; then
|
||||
echo "Package $1 not installed"
|
||||
if [ ! -d $INDEX_DIR/$1 ]; then
|
||||
msgerr "Package '$1' not installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -18,11 +23,10 @@ pushd / >/dev/null
|
||||
for i in ${NEEDED_LIB[@]}; do
|
||||
if [ "$i" != "ld-linux-x86-64.so.2" ]; then
|
||||
libpath=$(ldd "$LINE" | grep -v "not found" | grep -w "$i" | awk '{print $3}')
|
||||
#echo "==> $libpath"
|
||||
if [ "$libpath" ]; then
|
||||
FILEPATH=$(readlink -f $(echo $libpath))
|
||||
FILENAME=$(echo $FILEPATH | sed -e '1s/^.//')
|
||||
PKG_NAME=$(basename $(dirname $(grep -Rx $FILENAME /var/spkg/index | cut -d ':' -f1)))
|
||||
PKG_NAME=$(basename $(dirname $(grep -Rx $FILENAME $INDEX_DIR | cut -d ':' -f1)))
|
||||
if [ "$PKG_NAME" != $1 ]; then
|
||||
if [ ! "$(echo "$deppkg" | grep -w "$PKG_NAME")" ]; then
|
||||
deppkg="$deppkg $PKG_NAME "
|
||||
@@ -34,7 +38,7 @@ pushd / >/dev/null
|
||||
fi
|
||||
done
|
||||
esac
|
||||
done < <(tac /var/spkg/index/$1/.files | grep -E ^"(bin/|lib/|libexec/|sbin/|usr/bin/|usr/lib/|usr/libexec/|usr/sbin/)" | grep -v "/$")
|
||||
done < <(tac $INDEX_DIR/$1/.files | grep -E ^"(bin/|lib/|libexec/|sbin/|usr/bin/|usr/lib/|usr/libexec/|usr/sbin/)" | grep -v "/$")
|
||||
popd >/dev/null
|
||||
|
||||
echo "Shared lib from package(s):"
|
||||
|
||||
@@ -1,37 +1,38 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash -e
|
||||
|
||||
index_dir="/var/spkg/index"
|
||||
INDEX_DIR="/var/lib/scratchpkg/index"
|
||||
|
||||
source "/usr/share/scratchpkg/color"
|
||||
source "/usr/share/scratchpkg/message"
|
||||
|
||||
if [ ! "$1" ]; then
|
||||
echo "specify list file"
|
||||
msgerr "Please specify list file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$1" ]; then
|
||||
echo "file $1 not exist"
|
||||
msgerr "File '$1' not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
list=$(cat $1)
|
||||
|
||||
for i in $list; do
|
||||
if [ -d $index_dir/$i ]; then
|
||||
echo "$i is installed"
|
||||
if [ -d $INDEX_DIR/$i ]; then
|
||||
msg "$i is installed"
|
||||
else
|
||||
echo "installing $i..."
|
||||
msg "installing $i..."
|
||||
if [ $UID != 0 ]; then
|
||||
if [ -x /usr/bin/fakeroot ]; then
|
||||
echo "==> Build using fakeroot"
|
||||
fakeroot scratch -p $i && sudo scratch -p $i -i
|
||||
else
|
||||
sudo scratch -p $i -i
|
||||
fi
|
||||
sudo scratch -p $i -i
|
||||
else
|
||||
scratch -p $i -i
|
||||
fi
|
||||
if [ ! -d $index_dir/$i ]; then
|
||||
echo "Error installing $i..."
|
||||
if [ ! -d $INDEX_DIR/$i ]; then
|
||||
msgerr "Failed installing $i."
|
||||
msgerr "Press ENTER to skip and continue, press CTRL + C to cancel."
|
||||
read
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
10
extra/revdep
10
extra/revdep
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
INDEX_DIR="/var/spkg/index"
|
||||
COLOR="/usr/share/scratchpkg/color"
|
||||
INDEX_DIR="/var/lib/scratchpkg/index"
|
||||
|
||||
. $COLOR
|
||||
source "/usr/share/scratchpkg/color"
|
||||
source "/usr/share/scratchpkg/message"
|
||||
|
||||
onepkg() {
|
||||
|
||||
@@ -58,14 +58,14 @@ allpkg() {
|
||||
echo -e "${color_green}>>>${color_reset} $rebuild"
|
||||
done
|
||||
else
|
||||
echo "All packages is doing fine."
|
||||
msg "All packages is doing fine."
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
if [ "$1" ]; then
|
||||
if [ ! -d "$INDEX_DIR/$1" ]; then
|
||||
echo "Package '$1' not installed"
|
||||
msgerr "Package '$1' not installed"
|
||||
exit 1
|
||||
else
|
||||
onepkg $1
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
source "/usr/share/scratchpkg/color"
|
||||
source "/usr/share/scratchpkg/message"
|
||||
|
||||
faileduppkg=()
|
||||
successuppkg=()
|
||||
|
||||
@@ -10,27 +13,28 @@ if [[ ! $(scratch -cu | grep "up to date") ]]; then
|
||||
for i in ${outdatepkg[@]}; do
|
||||
if [ $UID != 0 ]; then
|
||||
if [ $(type -pa sudo) ]; then
|
||||
echo -e "[ $count/$totalopkgs ] Updating package $i..."
|
||||
echo -e "[ $count/$totalopkgs ] Updating $i..."
|
||||
sudo scratch -u -p $i && successuppkg+=($i) || faileduppkg+=($i)
|
||||
else
|
||||
echo "Updating package need root access!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo -e "[ $count/$totalopkgs ] Updating package $i..."
|
||||
echo -e "[ $count/$totalopkgs ] Updating $i..."
|
||||
scratch -u -p $i && successuppkg+=($i) || faileduppkg+=($i)
|
||||
fi
|
||||
echo
|
||||
((count++))
|
||||
done
|
||||
else
|
||||
echo "All packages is up to date."
|
||||
msg "All packages is up to date."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${#successuppkg[@]}" -gt 0 ]; then
|
||||
echo "Success update this package(s):"
|
||||
echo "Successfully update this package(s):"
|
||||
echo ${successuppkg[@]} | tr ' ' '\n'
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ "${#faileduppkg[@]}" -gt 0 ]; then
|
||||
|
||||
@@ -4,6 +4,7 @@ FUNCTIONS=${FUNCTIONS:-'/usr/share/scratchpkg'}
|
||||
|
||||
source "$FUNCTIONS/options"
|
||||
source "$FUNCTIONS/color"
|
||||
source "$FUNCTIONS/message"
|
||||
|
||||
### SET SOME VALUE ###
|
||||
CONF_FILE="/etc/scratchpkg.conf"
|
||||
@@ -49,34 +50,6 @@ popd() {
|
||||
command popd >/dev/null
|
||||
}
|
||||
|
||||
msg() {
|
||||
echo -e "${color_green}==>${color_reset} $1"
|
||||
}
|
||||
|
||||
msginfo() {
|
||||
echo -e "${color_cyan}==> INFO:${color_reset} $1"
|
||||
}
|
||||
|
||||
msgerr() {
|
||||
echo -e "${color_red}==> ERROR:${color_reset} $1"
|
||||
}
|
||||
|
||||
msgwarn() {
|
||||
echo -e "${color_yellow}==> WARNING:${color_reset} $1"
|
||||
}
|
||||
|
||||
msg2() {
|
||||
echo -e "${color_blue} ->${color_reset} $1"
|
||||
}
|
||||
|
||||
msg3() {
|
||||
echo -e "$1"
|
||||
}
|
||||
|
||||
msg4() {
|
||||
echo -e " $1"
|
||||
}
|
||||
|
||||
rmdir_silent() {
|
||||
command rmdir "$@" 2> /dev/null
|
||||
}
|
||||
|
||||
29
functions/message
Normal file
29
functions/message
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
msg() {
|
||||
echo -e "${color_green}==>${color_reset} $1"
|
||||
}
|
||||
|
||||
msginfo() {
|
||||
echo -e "${color_cyan}==> INFO:${color_reset} $1"
|
||||
}
|
||||
|
||||
msgerr() {
|
||||
echo -e "${color_red}==> ERROR:${color_reset} $1"
|
||||
}
|
||||
|
||||
msgwarn() {
|
||||
echo -e "${color_yellow}==> WARNING:${color_reset} $1"
|
||||
}
|
||||
|
||||
msg2() {
|
||||
echo -e "${color_blue} ->${color_reset} $1"
|
||||
}
|
||||
|
||||
msg3() {
|
||||
echo -e "$1"
|
||||
}
|
||||
|
||||
msg4() {
|
||||
echo -e " $1"
|
||||
}
|
||||
Reference in New Issue
Block a user