diff options
| author | Simon Rettberg | 2013-08-20 20:03:34 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2013-08-20 20:03:34 +0200 |
| commit | 5ecba3429f3c5d75550137eb2c815ebb62dfdffb (patch) | |
| tree | 2e461f6c4386b73063e9328fe72aaa086296bb47 /remote/setup_target | |
| parent | [dnbd3] add systemd service + script to load the module and launch the user s... (diff) | |
| download | tm-scripts-5ecba3429f3c5d75550137eb2c815ebb62dfdffb.tar.gz tm-scripts-5ecba3429f3c5d75550137eb2c815ebb62dfdffb.tar.xz tm-scripts-5ecba3429f3c5d75550137eb2c815ebb62dfdffb.zip | |
Switch to using /etc/tmpfiles.d for creating files/dirs in /run
Also added a sanity check after processing each module, which will abort if anything is placed in /run directly
Diffstat (limited to 'remote/setup_target')
| -rwxr-xr-x | remote/setup_target | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/remote/setup_target b/remote/setup_target index 8160de3e..1b857eda 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -362,6 +362,10 @@ process_module() { copy_static_data pinfo "## Post copy" post_copy + # Sanity checks + [ -e "$TARGET_BUILD_DIR/var/run" -a ! -L "$TARGET_BUILD_DIR/var/run" ] && perror "Messup datected: $TARGET_BUILD_DIR/var/run exists and is not a symlink!" + [ -e "$TARGET_BUILD_DIR/var/lock" -a ! -L "$TARGET_BUILD_DIR/var/lock" ] && perror "Messup datected: $TARGET_BUILD_DIR/var/lock exists and is not a symlink!" + [ -n "$(ls -A "$TARGET_BUILD_DIR/run")" ] && perror "Messup detected: $TARGET_BUILD_DIR/run is not empty. You cannot place static files there, use /etc/tmpfiles.d instead!" # set MODULE_BUILD_SIZE calc_size pinfo "Module completed. Total size: ${MODULE_BUILD_SIZE}" @@ -408,20 +412,6 @@ post_process_target() { ldconfig -v -r "${TARGET_BUILD_DIR}" -f "/ldconf-temp" unlink "$LDTEMP" - # Hacky way of making sure /run and /var/run are actually the same directory - local DIR_RUN="$TARGET_BUILD_DIR/run" - local DIR_VAR_RUN="$TARGET_BUILD_DIR/var/run" - [ -L "$DIR_RUN" ] && perror "$DIR_RUN is a symbolic link, refusing to work!" - if [ -d "$DIR_RUN" -o -d "$DIR_VAR_RUN" ]; then - mkdir -p "$DIR_RUN" || perror "Could not create $DIR_RUN" - if [ -d "$DIR_VAR_RUN" -a ! -L "$DIR_VAR_RUN" ]; then - mv "$DIR_VAR_RUN/"* "$DIR_RUN/" || perror "Could not move contents of $DIR_VAR_RUN to $DIR_RUN" - rmdir "$DIR_VAR_RUN" || perror "Could not delete $DIR_VAR_RUN after moving contents to $DIR_RUN" - fi - if [ ! -L "$DIR_VAR_RUN" ]; then - ln -sf "../run" "$DIR_VAR_RUN" || perror "Could not create symbolic link $DIR_VAR_RUN to ../run" - fi - fi } clean_modules() { |
