User Tools

Site Tools


linux:lfs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:lfs [2017/12/18 15:51]
vamp898
linux:lfs [2017/12/18 15:55]
vamp898
Line 1: Line 1:
-====== ​Package Management ​====== +[[Linux:​LFS:​Package Management]]
-Everything is placed under ''/​usr/​src/​packagename/​packageversion''​ +
-===== samples ===== +
-==== install.sh ==== +
- +
-<code bash> +
-VER="​$( pwd | cut -d '/'​ -f 5 )" +
-PKG="​$( pwd | cut -d '/'​ -f 4-5 )" +
-SRC="​$( pwd | cut -d '/'​ -f 4 )-${VER}"​ +
-JOBS=-j8 +
-NEEDS=""​ +
- +
-### DEPCHECK ### +
-for i in ${NEEDS}; do +
-        if [ ! -d /​usr/​pkg/​${i} ​]; then +
-                echo "need: ${i}"​ +
-                exit 6 +
-        fi +
-done +
- +
-### UNPACK ### +
-tar xf ${SRC}.tar.* +
-cd ${SRC} +
-if [ "​$?"​ != "​0"​ ]; then +
-        echo "Error in unpack"​ +
-        exit 1 +
-fi +
- +
-### CONFIGURE ### +
-./configure --prefix=/​usr +
-if [ "​$?"​ != "​0"​ ]; then +
-        echo "Error in configure"​ +
-        exit 2 +
-fi +
- +
-### MAKE ### +
-make ${JOBS} +
-if [ "​$?"​ != "​0"​ ]; then +
-        echo "Error in make"​ +
-        exit 3 +
-fi +
- +
-### POSTMAKE ### +
-make DESTDIR=/​usr/​pkg/​${PKG} install +
-if [ "​$?"​ != "​0"​ ]; then +
-        echo "Error in postmake"​ +
-        exit 4 +
-fi +
- +
-### INSTALL ### +
-cd /​usr/​pkg/​${PKG} +
-for i in f d l; do +
-        find ./ -type ${i} | sed '​s/​^.//​g'​ > .${i} +
-done +
-tar cf - . | (cd / ; tar xf - ) +
-if [ "​$?"​ != "​0"​ ]; then +
-        echo "Error in install"​ +
-        exit 5 +
-fi +
- +
-### CLEANUP ### +
-cd /​usr/​src/​${PKG} +
-rm -rf ${SRC} +
-</​code>​ +
-==== remove.sh ==== +
-<code bash> +
-VER="​$( pwd | cut -d '/'​ -f 5 )" +
-PKG="​$( pwd | cut -d '/'​ -f 4-5 )" +
-PKGBASE="​$( pwd | cut -d '/'​ -f 4 )" +
-cd /​usr/​pkg/​${PKG} +
-if [ "​$?"​ != "​0" ​]; then +
-        echo "cd failed"​ +
-        exit 1 +
-fi +
- +
-### REMOVE LINKS ### +
-cat .l | while read line; do +
-        unlink "​${line}"​ +
-done +
- +
-### REMOVE FILES ### +
-cat .f | while read line; do +
-        rm "​${line}"​ +
-done +
- +
-### REMOVE DIRECTORIES ### +
-tac .d | grep -v ^/$ | while read line; do +
-        rmdir "​${line}"​ --ignore-fail-on-non-empty +
-done +
-cd / +
-rm -rf /​usr/​pkg/​${PKG} +
-rmdir -p /​usr/​pkg/​${PKGBASE} --ignore-fail-on-non-empty +
-</​code>​+
linux/lfs.txt · Last modified: 2017/12/18 15:55 by vamp898