1 # Makefile - installed as /usr/Makefile
3 # Provides simple targets to download and maintain /usr/pkgsrc and /usr/src.
5 ########################################################################
7 ########################################################################
10 MINIX_RELEASE
!= uname
-r
12 ########################################################################
14 ########################################################################
15 PKGSRC_REPO_DIR
:= ${.CURDIR
}/pkgsrc
16 PKGSRC_REPO_URL
:= git
://git.minix3.org
/pkgsrc-ng.git
17 PKGSRC_BRANCH
:= ${MINIX_RELEASE}
18 MSG_RENAMED_BRANCH
:= "\
19 \n======================================================================== \
21 \n Renaming $$$${current_name} to $$$${new_name}. \
22 \n======================================================================== \
25 \n======================================================================== \
27 \n If problems occur you may have to rm -rf ${PKGSRC_REPO_DIR} \
29 \n======================================================================== \
32 .if exists
(${PKGSRC_REPO_DIR}/.git
)
33 # We can only update the repository if it *does* exist
35 # If we can fast-forward, just do it, otherwise rename current branch
36 # and checkout the official branch (also warn the user).
37 @cd
${PKGSRC_REPO_DIR} && git pull
--ff-only || \
38 ( current_name
=$$(git rev-parse
--abbrev-ref HEAD
); \
39 new_name
=$${current_name}-$$(git rev-parse
--short HEAD
); \
40 echo
-e
${MSG_RENAMED_BRANCH}; \
41 echo
-n
"Do you want to continue [Y/n]? "; \
43 if
[ "$${ok}" = "" -o
"$${ok}" = "y" -o
"$${ok}" = "Y" ]; then \
44 git branch
-m
$${new_name}; \
45 git checkout
-t
origin/${PKGSRC_BRANCH}; \
50 @cd
${PKGSRC_REPO_DIR}/minix
&& sh minibootstrap.sh
52 .if
!exists
(${PKGSRC_REPO_DIR}/Makefile
)
53 # If the .git directory is available, but not yet checked out, then
55 @cd
${PKGSRC_REPO_DIR} && git checkout
${PKGSRC_BRANCH}
56 @cd
${PKGSRC_REPO_DIR}/minix
&& sh minibootstrap.sh
58 .
endif # !exists(${PKGSRC_REPO_DIR}/Makefile)
60 # We can only create the repository if it does *not* exist
62 @echo
-e
${MSG_RESET_PKGSRC}
63 @git clone
-b
${PKGSRC_BRANCH} ${PKGSRC_REPO_URL} ${PKGSRC_REPO_DIR}
64 @cd
${PKGSRC_REPO_DIR}/minix
&& sh minibootstrap.sh
66 .
endif # exists(${PKGSRC_REPO_DIR}/.git)
68 ########################################################################
70 ########################################################################
71 SRC_REPO_DIR
:= ${.CURDIR
}/src
72 SRC_REPO_URL
:= git
://git.minix3.org
/minix.git
74 MSG_WRONG_BRANCH_SRC
:= "\
75 \n======================================================================== \
77 \n An unknown branch is presently checked out, please checkout \
78 \n first the following branch: ${SRC_BRANCH} \
79 \n======================================================================== \
82 \n======================================================================== \
84 \n If problems occur you may have to rm -rf ${SRC_REPO_DIR} \
86 \n======================================================================== \
88 .if exists
(${SRC_REPO_DIR}/.git
)
89 # We can only update the repository if it *does* exist
91 @cd
${SRC_REPO_DIR} && \
92 [ "$$(git rev-parse --abbrev-ref HEAD)" = "${SRC_BRANCH}" ] || \
93 ( echo
-e
${MSG_WRONG_BRANCH_SRC}; exit
1 )
94 @cd
${SRC_REPO_DIR} && git pull
96 .if
!exists
(${SRC_REPO_DIR}/Makefile
)
98 @cd
${SRC_REPO_DIR} && git checkout
${SRC_BRANCH}
99 .
endif # !exists(${SRC_REPO_DIR}/Makefile)
101 # We can only create the repository if it does not exist
103 @echo
-e
${MSG_RESET_SRC}
104 @git clone
${SRC_REPO_URL} ${SRC_REPO_DIR}
106 .
endif # exists(${SRC_REPO_DIR}/.git)
108 ########################################################################
110 ########################################################################
112 @pkgin
-y update
2>&1 > /dev
/null
113 @pkgin
-y
install git-base
2>&1 > /dev
/null
116 @echo
"Usage: make [target]"
118 @echo
" Where target is one of:"
119 @echo
" help, all, usage - print this help"
122 .if exists
(${SRC_REPO_DIR}/.git
)
123 @echo
" make src-update - update the src repo from the net"
124 .if
!exists
(${SRC_REPO_DIR}/Makefile
)
125 @echo
" make src-checkout - initial checkout of your pre-packaged"
126 @echo
" pkgsrc repo."
127 .
endif # !exists(${SRC_REPO_DIR}/Makefile)
129 @echo
" make src - fetch initial src repo from the net"
130 .
endif # exists(${SRC_REPO_DIR}/.git)
133 .if exists
(${PKGSRC_REPO_DIR}/.git
)
134 .if
!exists
(${PKGSRC_REPO_DIR}/Makefile
)
135 @echo
" make pkgsrc-checkout - initial checkout of your pre-packaged"
136 @echo
" pkgsrc repo."
137 .
endif # !exists(${PKGSRC_REPO_DIR}/Makefile)
138 @echo
" make pkgsrc-update - update your pkgsrc repo from the net"
140 @echo
" make pkgsrc - fetch initial pkgsrc repo from the net"
141 .
endif # exists(${PKGSRC_REPO_DIR}/.git)
146 .for var in MINIX_RELEASE \
147 SRC_REPO_DIR SRC_REPO_URL SRC_BRANCH \
148 PKGSRC_REPO_DIR PKGSRC_REPO_URL PKGSRC_BRANCH
149 @echo
" ${var} = ${${var}}"